Skip to content

Commit

Permalink
return --no-mysql option
Browse files Browse the repository at this point in the history
  • Loading branch information
idk1703 committed Dec 13, 2023
1 parent 942ec80 commit 1e32025
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mocktest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Build SourceMod
working-directory: sourcemod
run: |
python configure.py --enable-optimize --sdks=mock --targets=x86_64
python configure.py --no-mysql --enable-optimize --sdks=mock --targets=x86_64
ambuild objdir
- name: Build hl2sdk-mock
Expand Down
2 changes: 2 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
help='Enable debugging symbols')
parser.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt',
help='Enable optimization')
parser.options.add_argument('--no-mysql', action='store_false', default=True, dest='hasMySql',
help='Disable building MySQL extension')
parser.options.add_argument('-s', '--sdks', default='present', dest='sdks',
help='Build against specified SDKs; valid args are "none", "all", "present",'
' or comma-delimited list of engine names')
Expand Down
91 changes: 46 additions & 45 deletions extensions/mysql/AMBuilder
Original file line number Diff line number Diff line change
@@ -1,54 +1,55 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os

libmariadb = builder.Build('mariadb/AMBuilder')
libopenssl = {}
if os.name != 'nt':
libopenssl = builder.Build('openssl/AMBuilder')
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-']

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,
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'),
]
elif binary.compiler.target.platform == 'windows':
binary.compiler.defines += ['WIN32_LEAN_AND_MEAN']
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
binary.compiler.cxxflags += ['-fno-rtti']
elif binary.compiler.family == 'msvc':
binary.compiler.cxxflags += ['/GR-']

binary.compiler.postlink += [
'ws2_32.lib',
'shlwapi.lib',
'crypt32.lib',
'secur32.lib',
libmariadb[arch].binary,
]

binary.sources += [
'../../public/smsdk_ext.cpp',
'mysql/MyBasicResults.cpp',
'mysql/MyBoundResults.cpp',
'mysql/MyDatabase.cpp',
'mysql/MyDriver.cpp',
'mysql/MyStatement.cpp',
'extension.cpp'
]
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']
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)]
SM.extensions += [builder.Add(binary)]

0 comments on commit 1e32025

Please sign in to comment.