-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSConstruct
More file actions
96 lines (76 loc) · 2.82 KB
/
SConstruct
File metadata and controls
96 lines (76 loc) · 2.82 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
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
#!/usr/bin/env python
from glob import glob
from pathlib import Path
import fnmatch
import os
try:
env = Environment()
print(env.ARGUMENTS)
except:
# Default tools with no platform defaults to gnu toolchain.
# We apply platform specific toolchains via our custom tools.
env = Environment(tools=["default"], PLATFORM="")
# TODO: Do not copy environment after godot-cpp/test is updated <https://github.com/godotengine/godot-cpp/blob/master/test/SConstruct>.
env = SConscript("godot-cpp/SConstruct")
# For some reason the
print(env["CPPDEFINES"])
print(env["CXXFLAGS"])
print(env["disable_exceptions"])
if env["disable_exceptions"]:
if env.get("is_msvc", False):
env.Append(CPPDEFINES=[("_HAS_EXCEPTIONS", 0)])
env.Append(CXXFLAGS=["/EHsc"])
else:
env.Append(CXXFLAGS=["-fno-exceptions"])
elif env.get("is_msvc", False):
env.Append(CXXFLAGS=["/EHsc"])
# Initial options inheriting from CLI args
opts = Variables([], ARGUMENTS)
opts.Add("Boost_INCLUDE_DIR", "boost library include path", "")
opts.Add("Boost_LIBRARY_DIRS", "boost library library path", "")
opts.Add("precision","floating point precision","single")
opts.Update(env)
boost_path = Dir(env['Boost_INCLUDE_DIR'])
env["precision"] = env['precision']
# Add Included files.
env.Append(CPPPATH=["src/","thirdparty/",boost_path])
sources = []
for root,dirnames,filenames in os.walk("./src/"):
for filename in fnmatch.filter(filenames,"*.cpp"):
print(os.path.join(root, filename))
sources.append(Glob(os.path.join(root, filename)))
for root,dirnames,filenames in os.walk("./thirdparty/"):
for filename in fnmatch.filter(filenames,"*.cpp"):
sources.append(Glob(os.path.join(root, filename)))
# Find gdextension path even if the directory or extension is renamed (e.g. project/addons/example/example.gdextension).
# (extension_path,) = glob("project/addons/*/*.gdextension")
# Find the addon path (e.g. project/addons/example).
addon_path = "addons/MotionMatching/"
# Find the project name from the gdextension file (e.g. example).
project_name = "MotionMatching"
# TODO: Cache is disabled currently.
scons_cache_path = os.environ.get("SCONS_CACHE")
if scons_cache_path != None:
CacheDir(scons_cache_path)
print("Scons cache enabled... (path: '" + scons_cache_path + "')")
if env["platform"] == "macos":
library = env.SharedLibrary(
addon_path + "bin/lib{0}.{1}.{2}.framework/{0}.{1}.{2}".format(
project_name,
env["platform"],
env["target"],
),
source=sources,
)
else:
library = env.SharedLibrary(
addon_path + "bin/lib{}.{}.{}.{}{}".format(
project_name,
env["platform"],
env["target"],
env["arch"],
env["SHLIBSUFFIX"],
),
source=sources,
)
Default(library)