Fix MySQL extension build using vs2015 (#824)

MySQL defines its own timespec_t. Official mysql builds are built using VS2013, so you still need to compile the client library yourself to be able to link it, but this change makes the dbi extension compatible with future versions already.
This commit is contained in:
peace-maker 2018-06-05 15:29:11 +02:00 committed by Nicholas Hastings
parent ddebc2a075
commit 9cc518e408
3 changed files with 5 additions and 4 deletions

View File

@ -182,7 +182,7 @@ class SMConfig(object):
if builder.options.mysql_path: if builder.options.mysql_path:
self.mysql_root['x86'] = builder.options.mysql_path self.mysql_root['x86'] = builder.options.mysql_path
else: else:
for i in range(7): for i in range(10):
self.mysql_root['x86'] = ResolveEnvPath('MYSQL55', 'mysql-5.' + str(i)) self.mysql_root['x86'] = ResolveEnvPath('MYSQL55', 'mysql-5.' + str(i))
if self.mysql_root['x86']: if self.mysql_root['x86']:
break break
@ -192,10 +192,10 @@ class SMConfig(object):
# For now, ignore 64-bit MySQL on Windows # For now, ignore 64-bit MySQL on Windows
if 'x64' in self.archs and builder.target.platform != 'windows': if 'x64' in self.archs and builder.target.platform != 'windows':
if builder.options.mysql_path: if builder.options.mysql64_path:
self.mysql_root['x64'] = builder.options.mysql64_path self.mysql_root['x64'] = builder.options.mysql64_path
else: else:
for i in range(7): for i in range(10):
self.mysql_root['x64'] = ResolveEnvPath('MYSQL55_64', 'mysql-5.' + str(i) + '-x86_64') self.mysql_root['x64'] = ResolveEnvPath('MYSQL55_64', 'mysql-5.' + str(i) + '-x86_64')
if self.mysql_root['x64']: if self.mysql_root['x64']:
break break

View File

@ -42,6 +42,7 @@ if SM.mysql_root:
if binary.compiler.family == 'msvc' and binary.compiler.version >= 1900: if binary.compiler.family == 'msvc' and binary.compiler.version >= 1900:
binary.sources += [ 'msvc15hack.c' ] binary.sources += [ 'msvc15hack.c' ]
binary.compiler.linkflags += ['legacy_stdio_definitions.lib', 'legacy_stdio_wide_specifiers.lib'] binary.compiler.linkflags += ['legacy_stdio_definitions.lib', 'legacy_stdio_wide_specifiers.lib']
binary.compiler.defines += ['HAVE_STRUCT_TIMESPEC']
SM.extensions += [builder.Add(binary)] SM.extensions += [builder.Add(binary)]

View File

@ -39,9 +39,9 @@
#include <WinSock2.h> #include <WinSock2.h>
#endif #endif
#include <mysql.h>
#include <my_global.h> #include <my_global.h>
#include <my_sys.h> #include <my_sys.h>
#include <mysql.h>
#include <sh_string.h> #include <sh_string.h>
#include <sh_list.h> #include <sh_list.h>