-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSConstruct
65 lines (49 loc) · 1.43 KB
/
SConstruct
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
#!python
import sys
import os.path
availableArchs = ['32', '64']
availableOses = ['linux', 'osx']
AddOption('--os',
dest='os',
type='string',
nargs=1,
action='store',
help='Target OS')
AddOption('--arch',
dest='arch',
type='string',
nargs=1,
action='store',
help='Target architecture')
os = GetOption('os')
arch = GetOption('arch')
def buildForSystem(os, arch):
libSuffix = ''
steamPath = os + arch
if arch == '64':
unityArch = 'x86_64'
libSuffix = '64'
else:
unityArch = 'x86'
if arch == '64' and os == 'osx':
steamPath = 'osx32'
env = Environment()
libSources = Glob('NativeSource/src/*.cpp')
targetPath = 'Assets/Plugins/SteamworksWrapper/bin/' + unityArch + '/'
libTarget = 'SteamworksWrapper' + libSuffix
env.Append(CCFLAGS='-g -I/usr/include/root -INativeSource/inc -m' + arch + ' -fPIC -std=c++11 -Wall')
env.Append(LIBPATH=['NativeSource/lib/' + steamPath])
env.Append(LIBS=['steam_api'])
if os == 'osx':
env.Append(LINKFLAGS=['-Wl,-rpath,\'$$ORIGIN\'','-m' + arch])
targetPath += libTarget + '.bundle/Contents/MacOS/'
else:
env.Append(LINKFLAGS=['-Wl,-z,origin','-Wl,-rpath,\'$$ORIGIN\'','-m' + arch])
env.LoadableModule(target = targetPath + libTarget, source = libSources)
if not os in availableOses:
print('Expected OS (--os): ' + ', '.join(availableOses))
exit()
if not arch in availableArchs:
print('Expected architecture (--arch): ' + ', '.join(availableArchs))
exit()
buildForSystem(os, arch)