forked from Poggicek/mysql_mm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAMBuilder
77 lines (65 loc) · 2.57 KB
/
AMBuilder
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
# Here only one sdk should be available to generate only one executable in the end,
# as multi-sdk loading isn't supported out of the box by metamod, and would require specifying the full path in the vdf
# which in the end would ruin the multi-platform (unix, win etc) loading by metamod as it won't be able to append platform specific extension
# so just fall back to the single binary.
# Multi-sdk solutions should be manually loaded with a custom plugin loader (examples being sourcemod, stripper:source)
for sdk_target in MMSPlugin.sdk_targets:
sdk = sdk_target.sdk
cxx = sdk_target.cxx
binary = MMSPlugin.HL2Library(builder, cxx, MMSPlugin.plugin_name, sdk)
binary.compiler.cxxincludes += [
os.path.join(builder.sourcePath, 'src'),
]
binary.sources += [
'src/sql_mm.cpp',
'src/mysql/operations/mysql_connect.cpp',
'src/mysql/operations/mysql_query.cpp',
'src/mysql/operations/mysql_transact.cpp',
'src/mysql/mysql_database.cpp',
'src/mysql/mysql_result.cpp',
'src/mysql/mysql_client.cpp',
'vendor/sqlite-source/sqlite3.c',
'src/sqlite/operations/sqlite_connectop.cpp',
'src/sqlite/operations/sqlite_queryop.cpp',
'src/sqlite/operations/sqlite_transactop.cpp',
'src/sqlite/sqlite_client.cpp',
'src/sqlite/sqlite_database.cpp',
'src/sqlite/sqlite_result.cpp',
'src/sqlite/sqlite_query.cpp',
]
binary.compiler.defines += [
'SQLITE_OMIT_LOAD_EXTENSION',
'SQLITE_THREADSAFE',
'SQLITE_USE_URI',
'SQLITE_ALLOW_URI_AUTHORITY',
]
if binary.compiler.target.platform == 'linux':
binary.sources += [
'src/utils/plat_linux.cpp'
]
binary.compiler.postlink += [
'/usr/lib/x86_64-linux-gnu/libmysqlclient.a',
'-ldl',
'-lz',
'-lpthread',
'-lm',
]
binary.compiler.postlink += ['-lrt', '-lssl', '-lcrypto']
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
binary.compiler.cxxflags += ['-fno-rtti']
if binary.compiler.target.platform == 'windows':
binary.compiler.defines += ['WIN32_LEAN_AND_MEAN']
binary.compiler.cxxincludes += [
os.path.join(builder.sourcePath, 'vendor', 'mysql', 'include'),
]
binary.compiler.postlink += [
'crypt32.lib',
os.path.join(builder.sourcePath, 'vendor', 'mysql', 'lib', 'mysqlclient.lib'),
]
binary.custom = [builder.tools.Protoc(protoc = sdk_target.protoc, sources = [
os.path.join(sdk['path'], 'common', 'network_connection.proto'),
])]
nodes = builder.Add(binary)
MMSPlugin.binaries += [nodes]