-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAMBuildScript
150 lines (140 loc) · 4.76 KB
/
AMBuildScript
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# AMBuildScript for DTBot Template, written by Anonymous Player
# vim: set sts=4 ts=8 sw=4 tw=99 et ft=python:
import os, sys
builder.cxx = builder.DetectCxx(target_arch = 'x86')
# Include search paths
include_paths = [
# os.path.join(builder.options.hl1sdk_path, 'public'),
# os.path.join(builder.options.hl1sdk_path, 'common'),
# os.path.join(builder.options.hl1sdk_path, 'engine'),
# os.path.join(builder.options.hl1sdk_path, 'dlls'),
# os.path.join(builder.options.hl1sdk_path, 'game_shared'),
# os.path.join(builder.options.hl1sdk_path, 'pm_shared'),
# os.path.join(builder.options.mm_path, 'metamod'),
os.path.join(builder.currentSourcePath, 'dtbot', 'HLSDK', 'common'),
os.path.join(builder.currentSourcePath, 'dtbot', 'HLSDK', 'dlls'),
os.path.join(builder.currentSourcePath, 'dtbot', 'HLSDK', 'engine'),
os.path.join(builder.currentSourcePath, 'dtbot', 'HLSDK', 'pm_shared'),
os.path.join(builder.currentSourcePath, 'dtbot', 'metamod'),
os.path.join(builder.currentSourcePath, 'Detour', 'Include'),
os.path.join(builder.currentSourcePath, 'DetourTileCache', 'Include'),
os.path.join(builder.currentSourcePath, 'dtbot', 'fastlz'),
os.path.join(builder.currentSourcePath, 'dtbot', 'src'),
]
# Compiler setup
if builder.cxx.target.platform == 'linux':
# Linux defines
builder.cxx.defines += ['_LINUX', 'POSIX', 'LINUX', 'linux']
# Linux compiler C flags
builder.cxx.cflags += [
'-pipe',
'-fno-strict-aliasing',
'-Wall',
'-Werror',
'-Wno-uninitialized',
'-Wno-unused',
'-Wno-switch',
'-Wno-format',
'-Wno-format-security',
'-Wno-unknown-attributes',
'-Wno-logical-op-parentheses',
'-Wno-return-stack-address',
'-m32',
]
# Linux compiler C++ flags
builder.cxx.cxxflags += [
'-Wno-invalid-offsetof',
'-Wno-write-strings',
'-std=c++17',
]
# Linux linker flags
builder.cxx.linkflags += ['-m32', '-ldl', '-lm']
elif builder.cxx.target.platform == 'windows':
# Windows defines
builder.cxx.defines += [
'_CRT_SECURE_NO_DEPRECATE',
'_CRT_SECURE_NO_WARNINGS',
'_CRT_NONSTDC_NO_DEPRECATE',
'NOMINMAX',
'WIN32',
'_WINDOWS'
]
# Windows compiler C flags
builder.cxx.cflags += []
# Windows compiler C++ flags
builder.cxx.cxxflags += [
'/std:c++17',
'/fp:precise'
]
# Windows linker flags
builder.cxx.linkflags += [
'/EXPORT:GiveFnptrsToDll=_GiveFnptrsToDll@8,@1',
'/SECTION:.data,RW',
'/MACHINE:X86'
]
# Compiler options for optimization ( --enable-optimize )
if builder.options.optimize == '1':
# Shared optimization definitions
builder.cxx.defines += ['NDEBUG']
if builder.cxx.target.platform == 'linux':
# Linux optimization flags
# Was -O3 originally but -O3 is known to sometimes causes issues
# Until the code is profiled, use -O2 instead
builder.cxx.cflags += ['-O2']
elif builder.cxx.target.platform == 'windows':
# Windows optimization flags
builder.cxx.cflags += ['/Ox', '/Zo']
# Windows optimization link flags
builder.cxx.linkflags += ['/OPT:ICF', '/OPT:REF']
# Compiler options for debugging ( --enable-debug )
if builder.options.debug == '1':
# Shared debug definitions
builder.cxx.defines += ['DEBUG', '_DEBUG']
if builder.cxx.target.platform == 'linux':
# Linux debug flags
builder.cxx.cflags += ['-g3', '-O0']
elif builder.cxx.target.platform == 'windows':
# Windows debug flags
builder.cxx.cflags += ['/Od', '/RTC1', '/MTd']
# Windows debug link flags
builder.cxx.linkflags += ['/NODEFAULTLIB:libcmt']
# Handle --enable-static-lib and --enable-shared-lib
if builder.cxx.target.platform == 'linux':
if builder.options.staticlib == '1':
builder.cxx.linkflags += [
'-static-libgcc',
'-static-libstdc++'
]
elif builder.options.sharedlib == '1':
builder.cxx.linkflags += [
'-shared-libgcc',
]
library = builder.cxx.Library('dtbot_mm')
library.compiler.includes += include_paths
library.sources += [
'Detour/Source/DetourNavMeshQuery.cpp',
'Detour/Source/DetourNode.cpp',
'Detour/Source/DetourAlloc.cpp',
'Detour/Source/DetourAssert.cpp',
'Detour/Source/DetourCommon.cpp',
'Detour/Source/DetourNavMesh.cpp',
'Detour/Source/DetourNavMeshBuilder.cpp',
'DetourTileCache/Source/DetourTileCache.cpp',
'DetourTileCache/Source/DetourTileCacheBuilder.cpp',
'dtbot/src/AvHAIConfig.cpp',
'dtbot/src/bot_client.cpp',
'dtbot/src/AvHAIHelper.cpp',
'dtbot/src/AvHAIMath.cpp',
'dtbot/src/AvHAINavigation.cpp',
'dtbot/src/AvHAIPlayer.cpp',
'dtbot/src/AvHAIPlayerManager.cpp',
'dtbot/src/AvHAIPlayerUtil.cpp',
'dtbot/src/AvHAITactical.cpp',
'dtbot/src/AvHAIWeaponHelper.cpp',
'dtbot/src/dllapi.cpp',
'dtbot/src/engine_api.cpp',
'dtbot/src/h_export.cpp',
'dtbot/src/meta_api.cpp',
'dtbot/src/sdk_util.cpp',
]
builder.Add(library)