forked from Zylann/godot_voxel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCsub
97 lines (71 loc) · 3.18 KB
/
SCsub
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
97
# This is the entry point for SCons to build this engine as a module.
# It has to be integrated to Godot's codebase, so it cannot be run on its own, see `README` for more information.
# To build as an extension, see `SConstruct`.
Import("env")
Import("env_modules")
import common
# Note, support for FastNoise2 requires C++17, and only works on x86.
FAST_NOISE_2_SRC = env["voxel_fast_noise_2"]
if not env["arch"].startswith("x86"):
FAST_NOISE_2_SRC = False
RUN_TESTS = env["voxel_tests"]
env_voxel = env_modules.Clone()
voxel_files = common.get_sources(env_voxel, env.editor_build)
env_voxel.Append(CPPDEFINES=[
# Tell engine-agnostic code we are using Godot Engine as a module
"ZN_GODOT"
])
if RUN_TESTS:
voxel_files += [
"tests/*.cpp"
]
if FAST_NOISE_2_SRC:
voxel_files += ["tests/fast_noise_2/*.cpp"]
env_voxel.Append(CPPDEFINES={"VOXEL_RUN_TESTS": 0})
# ----------------------------------------------------------------------------------------------------------------------
# SQLite
env_sqlite = env_voxel.Clone()
# Turn off some warnings produced when compiling with warnings=extra
if env["warnings"] == "extra":
env_sqlite.disable_warnings()
# if not env_sqlite.msvc:
# env_sqlite.Append(CXXFLAGS=["-Wno-discarded-qualifiers"])
# TODO Enhancement: the way SQLite is integrated should not be duplicated between Godot and GodotCpp targets.
# Had to do so, because this line below is specific to Godot's build system!
env_sqlite.add_source_files(env.modules_sources, ["thirdparty/sqlite/sqlite3.c"])
# ----------------------------------------------------------------------------------------------------------------------
# FastNoise 2
if FAST_NOISE_2_SRC:
if not env.msvc:
# TODO Enhancement: workaround for https://github.com/Auburn/FastNoise2/issues/80
# FastNoise2 is using MSVC-specific compiler directives.
# Done before calling FastNoise2 SConscript, as FastNoise2 also includes the headers
env_voxel.Append(CXXFLAGS=["-Wno-unknown-pragmas"])
# Build from source. Should be the simplest, but requires C++17
SConscript("thirdparty/fast_noise_2/SConscript", exports = ["env", "env_voxel"])
env_voxel.Append(CPPPATH=["thirdparty/fast_noise_2/include"])
voxel_files += [
"util/noise/fast_noise_2.cpp"
]
if env.editor_build:
voxel_files += [
"editor/fast_noise_2/*.cpp"
]
# ----------------------------------------------------------------------------------------------------------------------
# Tracy library
# Expects Tracy to be inside the `thirdparty` folder of Godot (not this module)
# env.Append(CPPDEFINES="TRACY_ENABLE")
# env_voxel.Append(CPPDEFINES="TRACY_ENABLE")
# voxel_files += [
# "#thirdparty/tracy/TracyClient.cpp"
# ]
# ----------------------------------------------------------------------------------------------------------------------
for f in voxel_files:
env_voxel.add_source_files(env.modules_sources, f)
# TODO Feature: check webassembly builds (`env["platform"] == "javascript"`)
# Doesn't work, since the rest of Godot doesn't use this, linking fails.
# No safe STL boundary checks for you.
#if env["target"] == "debug":
# if env.msvc:
# # Enable STL bound checks, Godot's master environment doesn't do it
# env_voxel.Append(CXXFLAGS=["/D_DEBUG"])