-
Notifications
You must be signed in to change notification settings - Fork 7
/
SConstruct
68 lines (57 loc) · 3.04 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
66
67
68
#!/usr/bin/env python
import os
import sys
VariantDir('build/src','extension/src', duplicate=False)
VariantDir('build/T5Integration','extension/T5Integration', duplicate=False)
env = SConscript('godot-cpp/SConstruct')
tilt_five_headers_path = 'extension/TiltFiveNDK/include'
tilt_five_library_path = 'extension/TiltFiveNDK/lib/' + { 'windows' : 'win/x86_64', 'linux' : 'linux/x86_64', 'android' : 'android/arm64-v8a'}[env["platform"]]
tilt_five_library = {'windows' : 'TiltFiveNative.dll.if', 'linux' : 'libTiltFiveNative.so', 'android' : 'libTiltFiveNative.so'}[env["platform"]]
# For the reference:
# - CCFLAGS are compilation flags shared between C and C++
# - CFLAGS are for C-specific compilation flags
# - CXXFLAGS are for C++-specific compilation flags
# - CPPFLAGS are for pre-processor flags
# - CPPDEFINES are for pre-processor defines
# - LINKFLAGS are for linking flags
# tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=['extension/src/','extension/T5Integration/',tilt_five_headers_path])
sources = Glob('build/src/*.cpp')
sources += Glob('build/T5Integration/*.cpp')
env.Append(LIBPATH=[tilt_five_library_path])
env.Append(LIBS=[tilt_five_library])
if env['platform'] == 'windows':
env['t5_shared_lib'] = 'TiltFiveNative.dll'
env['CXXFLAGS'].remove('/std:c++17')
env.Append(CXXFLAGS=['/std:c++20'])
env.Append(CXXFLAGS=['/Zc:__cplusplus'])
library = env.SharedLibrary(
'build/bin/libgdtiltfive{}{}'.format(env['suffix'], env['SHLIBSUFFIX']),
source=sources,
)
elif env['platform'] == 'linux':
env['t5_shared_lib'] = 'libTiltFiveNative.so'
env['CXXFLAGS'].remove('-std=c++17')
env.Append(CXXFLAGS=['-std=c++20'])
env.Append(RPATH=env.Literal('\\$$ORIGIN' ))
library = env.SharedLibrary(
'build/bin/libgdtiltfive{}{}'.format(env['suffix'], env['SHLIBSUFFIX']),
source=sources,
)
elif env['platform'] == 'android':
env['t5_shared_lib'] = 'libTiltFiveNative.so'
env['CXXFLAGS'].remove('-std=c++17')
env.Append(CXXFLAGS=['-std=c++20'])
env.Append(CXXFLAGS=['-stdlib=libc++'])
env.Append(CCFLAGS=['-fPIC'])
env.Append(RPATH=env.Literal('\\$$ORIGIN' ))
library = env.SharedLibrary(
'build/bin/libgdtiltfive{}{}'.format(env['suffix'], env['SHLIBSUFFIX']),
source=sources,
)
f1 = env.Command('example.gd/addons/tiltfive/bin/libgdtiltfive{}{}'.format(env['suffix'], env['SHLIBSUFFIX']), library, Copy('$TARGET', '$SOURCE') )
f2 = env.Command('example.gd/addons/tiltfive/bin/{}'.format(env['t5_shared_lib']), tilt_five_library_path + '/{}'.format(env['t5_shared_lib']), Copy('$TARGET', '$SOURCE') )
f3 = env.Command('example.csharp/addons/tiltfive/bin/libgdtiltfive{}{}'.format(env['suffix'], env['SHLIBSUFFIX']), library, Copy('$TARGET', '$SOURCE') )
f4 = env.Command('example.csharp/addons/tiltfive/bin/{}'.format(env['t5_shared_lib']), tilt_five_library_path + '/{}'.format(env['t5_shared_lib']), Copy('$TARGET', '$SOURCE') )
env.Alias('example', [f1, f2, f3, f4])
Default(library)