-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConstruct
95 lines (80 loc) · 2.52 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
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
from glob import glob
from pathlib import Path
env = SConscript("godot-cpp/SConstruct")
env.Append(CPPDEFINES={"nnabla_static_lib": 1})
debug_or_release = "release" if env["target"] == "template_release" else "debug"
if env["platform"] == "windows":
libraries = [
"nnabla_utils",
"nnabla",
"hdf5",
"hdf5_hl",
"archive",
"libprotobuf",
]
env.Append(
LIBPATH=[
"thirdparty/nnabla/build.cmake/bin/Release",
"thirdparty/nnabla/third_party/inst_hdf5-hdf5-1_12_2/lib",
"thirdparty/nnabla/third_party/inst_libarchive-3.7.2/lib",
"thirdparty/nnabla/third_party/inst_protobuf-3.20.1/lib",
]
)
env.Append(LIBS=libraries)
else:
env.Append(
LIBPATH=[
"thirdparty/nnabla/build.cmake/lib",
"thirdparty/nnabla/third_party/inst_hdf5-hdf5-1_12_2/lib",
"thirdparty/nnabla/third_party/inst_libarchive-3.7.2/lib",
"thirdparty/nnabla/third_party/inst_protobuf-3.20.1/lib",
]
)
env.Append(
LIBS=[
"nnabla_utils",
"nnabla",
"hdf5",
"hdf5_hl",
"archive",
"protobuf",
]
)
env.Append(CPPPATH=["thirdparty/nnabla/include"])
env.Append(CPPPATH=["src/"])
sources = glob("src/*.cpp")
(extension_path,) = glob("demo/addons/*/*.gdextension")
# Find the addon path (e.g. project/addons/example).
addon_path = Path(extension_path).parent
# Find the project name from the gdextension file (e.g. example).
project_name = Path(extension_path).stem
# 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 + "')")
# Create the library target (e.g. libexample.linux.debug.x86_64.so).
debug_or_release = "release" if env["target"] == "template_release" else "debug"
if env["platform"] == "macos":
library = env.SharedLibrary(
"{0}/bin/lib{1}.{2}.{3}.framework/{1}.{2}.{3}".format(
addon_path,
project_name,
env["platform"],
debug_or_release,
),
source=sources,
)
else:
library = env.SharedLibrary(
"{}/bin/lib{}.{}.{}.{}{}".format(
addon_path,
project_name,
env["platform"],
debug_or_release,
env["arch"],
env["SHLIBSUFFIX"],
),
source=sources,
)
Default(library)