mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-06 18:08:36 +00:00
68 lines
2.1 KiB
Python
68 lines
2.1 KiB
Python
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
|
import os
|
|
|
|
if builder.options.hasMySql:
|
|
libmariadb = builder.Build('mariadb/AMBuilder')
|
|
libopenssl = {}
|
|
if os.name != 'nt':
|
|
libopenssl = builder.Build('openssl/AMBuilder')
|
|
|
|
for cxx in builder.targets:
|
|
arch = cxx.target.arch
|
|
binary = SM.ExtLibrary(builder, cxx, 'dbi.mysql.ext')
|
|
binary.compiler.cxxincludes += [
|
|
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
|
os.path.join(builder.sourcePath, 'extensions', 'mysql', 'mariadb', 'include'),
|
|
os.path.join(builder.sourcePath, 'extensions', 'mysql', 'mariadb', 'connector', 'include'),
|
|
]
|
|
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
|
|
binary.compiler.cxxflags += ['-fno-rtti']
|
|
elif binary.compiler.family == 'msvc':
|
|
binary.compiler.cxxflags += ['/GR-']
|
|
if builder.options.debug == '1':
|
|
binary.compiler.cflags += ['/MDd']
|
|
else:
|
|
binary.compiler.cflags += ['/MD']
|
|
|
|
binary.compiler.postlink += [
|
|
libmariadb[arch].binary,
|
|
]
|
|
|
|
if binary.compiler.target.platform == 'linux':
|
|
binary.compiler.postlink += [
|
|
'-lz',
|
|
'-lpthread',
|
|
'-lm',
|
|
'-lrt',
|
|
libopenssl['ssl-' + arch].binary,
|
|
libopenssl['crypto-' + arch].binary,
|
|
]
|
|
elif binary.compiler.target.platform == 'windows':
|
|
binary.compiler.defines += ['WIN32_LEAN_AND_MEAN']
|
|
if builder.options.debug == '1':
|
|
binary.compiler.defines += ['_ITERATOR_DEBUG_LEVEL=2']
|
|
binary.compiler.postlink += [
|
|
os.path.join(SM.mysql_root[arch], 'lib', 'debug', 'mysqlclient.lib'),
|
|
]
|
|
else:
|
|
binary.compiler.postlink += [
|
|
os.path.join(SM.mysql_root[arch], 'lib', 'mysqlclient.lib'),
|
|
]
|
|
binary.compiler.postlink += [
|
|
'ws2_32.lib',
|
|
'shlwapi.lib',
|
|
'crypt32.lib',
|
|
'secur32.lib',
|
|
]
|
|
|
|
binary.sources += [
|
|
'../../public/smsdk_ext.cpp',
|
|
'mysql/MyBasicResults.cpp',
|
|
'mysql/MyBoundResults.cpp',
|
|
'mysql/MyDatabase.cpp',
|
|
'mysql/MyDriver.cpp',
|
|
'mysql/MyStatement.cpp',
|
|
'extension.cpp'
|
|
]
|
|
|
|
SM.extensions += [builder.Add(binary)] |