1-
21# This is the entry point for SCons to build this engine as a module.
32# It has to be integrated to Godot's codebase, so it cannot be run on its own, see `README` for more information.
43# To build as an extension, see `SConstruct`.
@@ -11,82 +10,67 @@ import voxel_version
1110
1211voxel_version.generate_version_header(True)
1312
14- # Note, support for FastNoise2 requires C++17, and only works on x86 .
13+ # Note, support for FastNoise2 requires C++17.
1514FAST_NOISE_2_SRC = env["voxel_fast_noise_2"]
16- if not env["arch"].startswith("x86"):
17- FAST_NOISE_2_SRC = False
1815
1916env_voxel = env_modules.Clone()
2017
2118voxel_files = common.get_sources(env_voxel, env.editor_build)
2219
23- env_voxel.Append(CPPDEFINES=[
24- # Tell engine-agnostic code we are using Godot Engine as a module
25- "ZN_GODOT"
26- ])
20+ env_voxel.Append(
21+ CPPDEFINES=[
22+ # Tell engine-agnostic code we are using Godot Engine as a module
23+ "ZN_GODOT"
24+ ]
25+ )
2726
2827if env["voxel_sqlite"]:
29- env_sqlite = env_voxel.Clone()
28+ env_sqlite = env_voxel.Clone()
3029
31- # Turn off warnings, we get some with Clang and with `warnings=extra`
32- env_sqlite.disable_warnings()
30+ # Turn off warnings, we get some with Clang and with `warnings=extra`
31+ env_sqlite.disable_warnings()
3332
34- # if not env_sqlite.msvc:
35- # env_sqlite.Append(CXXFLAGS=["-Wno-discarded-qualifiers"])
33+ # if not env_sqlite.msvc:
34+ # env_sqlite.Append(CXXFLAGS=["-Wno-discarded-qualifiers"])
3635
37- # TODO Enhancement: the way SQLite is integrated should not be duplicated between Godot and GodotCpp targets.
38- # Had to do so, because this line below is specific to Godot's build system!
39- env_sqlite.add_source_files(env.modules_sources, ["thirdparty/sqlite/sqlite3.c"])
36+ # TODO Enhancement: the way SQLite is integrated should not be duplicated between Godot and GodotCpp targets.
37+ # Had to do so, because this line below is specific to Godot's build system!
38+ env_sqlite.add_source_files(env.modules_sources, ["thirdparty/sqlite/sqlite3.c"])
4039
4140# ----------------------------------------------------------------------------------------------------------------------
4241# FastNoise 2
4342
4443if FAST_NOISE_2_SRC:
45- if not env.msvc:
46- # TODO Enhancement: workaround for https://github.com/Auburn/FastNoise2/issues/80
47- # FastNoise2 is using MSVC-specific compiler directives.
48- # Done before calling FastNoise2 SConscript, as FastNoise2 also includes the headers
49- env_voxel.Append(CXXFLAGS=["-Wno-unknown-pragmas"])
50-
51- # Build from source. Should be the simplest, but requires C++17
52- SConscript("thirdparty/fast_noise_2/SConscript", exports = ["env", "env_voxel"])
53-
54- env_voxel.Append(CPPPATH=["thirdparty/fast_noise_2/include"])
55-
56- voxel_files += [
57- "util/noise/fast_noise_2.cpp"
58- ]
59-
60- if env.editor_build:
61- voxel_files += [
62- "editor/fast_noise_2/*.cpp"
63- ]
64-
65- if env["voxel_tests"]:
66- voxel_files += ["tests/fast_noise_2/*.cpp"]
44+ if not env.msvc:
45+ # TODO Enhancement: workaround for https://github.com/Auburn/FastNoise2/issues/80
46+ # FastNoise2 is using MSVC-specific compiler directives.
47+ # Done before calling FastNoise2 SConscript, as FastNoise2 also includes the headers
48+ env_voxel.Append(CXXFLAGS=["-Wno-unknown-pragmas"])
49+
50+ # Build from source. Should be the simplest, but requires C++17
51+ SConscript("thirdparty/fast_noise_2/SConscript", exports=["env", "env_voxel"])
52+
53+ env_voxel.Append(CPPPATH=["thirdparty/fast_noise_2/include"])
54+
55+ voxel_files += ["util/noise/fast_noise_2.cpp"]
56+
57+ if env.editor_build:
58+ env_voxel.add_source_files(env.modules_sources, "editor/fast_noise_2/*.cpp")
59+
60+ if env["voxel_tests"]:
61+ env_voxel.add_source_files(env.modules_sources, "tests/fast_noise_2/*.cpp")
6762
6863# ----------------------------------------------------------------------------------------------------------------------
6964# Tracy library
7065
7166if env["tracy"]:
72- # This is not a feature of Godot's build system so we have to define a few things ourselves
73- env.Append(CPPDEFINES="TRACY_ENABLE")
74- env_voxel.Append(CPPDEFINES="TRACY_ENABLE")
75- env_voxel.Append(CPPPATH=["#thirdparty/tracy/public"])
76- voxel_files += [
77- "#thirdparty/tracy/public/TracyClient.cpp"
78- ]
67+ # This is not a feature of Godot's build system so we have to define a few things ourselves
68+ env.Append(CPPDEFINES="TRACY_ENABLE")
69+ env_voxel.Append(CPPDEFINES="TRACY_ENABLE")
70+ env_voxel.Append(CPPPATH=["#thirdparty/tracy/public"])
71+ voxel_files += ["#thirdparty/tracy/public/TracyClient.cpp"]
7972
80- # ----------------------------------------------------------------------------------------------------------------------
8173
82- for f in voxel_files:
83- env_voxel.add_source_files(env.modules_sources, f)
74+ env_voxel.add_source_files(env.modules_sources, voxel_files)
8475
8576# TODO Feature: check webassembly builds (`env["platform"] == "javascript"`)
86-
87- # Doesn't work, since the rest of Godot doesn't use this, linking fails.
88- # No safe STL boundary checks for you.
89- #if env["target"] == "debug":
90- # if env.msvc:
91- # # Enable STL bound checks, Godot's master environment doesn't do it
92- # env_voxel.Append(CXXFLAGS=["/D_DEBUG"])
0 commit comments