Repository navigation
Expand file tree
/
Copy pathAMBuilder
More file actions
49 lines (39 loc) · 1.61 KB
/
Copy pathAMBuilder
File metadata and controls
49 lines (39 loc) · 1.61 KB
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
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
# Name of your extesion, this will also be it's file name.
projectName = 'timerex'
# smsdk_ext.cpp will be automatically added later
sourceFiles = [
'timerex/extension.cpp',
]
project = Extension.HL2Project(builder, projectName + '.ext')
if os.path.isfile(os.path.join(builder.currentSourcePath, 'sdk', 'smsdk_ext.cpp')):
# Use the copy included in the project
project.sources += [os.path.join('sdk', 'smsdk_ext.cpp')]
else:
# Use the copy included with SM 1.6 and newer
project.sources += [os.path.join(Extension.sm_root, 'public', 'smsdk_ext.cpp')]
project.sources += sourceFiles
for cxx in builder.targets:
binary = Extension.HL2Config(builder, project, projectName + '.ext', cxx)
arch = {'x86': 'i686', 'x86_64': 'x86_64'}[binary.compiler.target.arch]
if builder.options.opt == '1':
directory = 'release'
else:
directory = 'debug'
path = ''
if binary.compiler.target.platform == 'linux':
path = os.path.join(builder.currentSourcePath, 'target', f'{arch}-unknown-linux-musl', directory, 'libtimerex.a')
elif binary.compiler.target.platform == 'windows':
path = os.path.join(builder.currentSourcePath, 'target', f'{arch}-pc-windows-msvc', directory, 'timerex.lib')
else:
raise
binary.compiler.postlink += [path]
binary.compiler.cxxincludes += [os.path.join(builder.currentSourcePath, 'timerex')]
if binary.compiler.family == 'msvc':
binary.compiler.linkflags += [
'userenv.lib',
'ws2_32.lib',
"ntdll.lib",
]
Extension.extensions = builder.Add(project)