forked from BastiaanOlij/gdprocmesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConstruct
55 lines (43 loc) · 1.85 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
#!python
import os, subprocess
target_path = 'demo/addons/gdprocmesh/bin/'
target_name = 'libgdprocmesh'
# Local dependency paths, adapt them to your setup
godot_headers_path = "godot-cpp/godot_headers/"
cpp_bindings_path = "godot-cpp/"
cpp_library = "godot-cpp"
target = ARGUMENTS.get("target", "debug")
# platform= makes it in line with Godots scons file, keeping p for backwards compatibility
platform = ARGUMENTS.get("p", "windows")
platform = ARGUMENTS.get("platform", platform)
# This makes sure to keep the session environment variables on windows,
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
env = Environment()
if platform == "windows":
env = Environment(ENV = os.environ)
if ARGUMENTS.get("use_llvm", "no") == "yes":
env["CXX"] = "clang++"
if platform == "osx":
target_path += 'osx/'
cpp_library += '.osx.64'
env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64'])
env.Append(LINKFLAGS = ['-arch', 'x86_64'])
if platform == "linux":
target_path += 'x11/'
cpp_library += '.linux.64'
env.Append(CCFLAGS = ['-fPIC', '-g','-O3', '-std=c++17'])
if platform == "windows":
target_path += 'win64/'
cpp_library += '.windows.64'
env.Append(CCFLAGS = ['-DWIN32', '-D_WIN32', '-D_WINDOWS', '-W3', '-GR', '-D_CRT_SECURE_NO_WARNINGS'])
if target == "debug":
env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '-MDd'])
else:
env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '-MD'])
env.Append(CPPPATH=['.', 'src/', godot_headers_path, cpp_bindings_path + 'include/', cpp_bindings_path + 'include/core/', cpp_bindings_path + 'include/gen/'])
env.Append(LIBPATH=[cpp_bindings_path + 'bin/'])
env.Append(LIBS=[cpp_library])
sources = Glob('src/*.cpp')
sources += Glob('src/*/*.cpp')
library = env.SharedLibrary(target=target_path + target_name, source=sources)
Default(library)