godot_voxel/SCsub

133 lines
3.8 KiB
Plaintext
Raw Normal View History

Import('env')
2019-05-30 00:45:19 +01:00
Import('env_modules')
# Note, support for FastNoise2 requires C++17, and doesn't work yet on ARM.
FAST_NOISE_2_SRC = env["voxel_fast_noise_2"]
RUN_TESTS = env["voxel_tests"]
2019-05-30 00:45:19 +01:00
env_voxel = env_modules.Clone()
voxel_files = [
2019-05-30 00:45:19 +01:00
"*.cpp",
2021-01-28 22:02:49 +00:00
"constants/*.cpp",
2019-05-30 00:45:19 +01:00
"meshers/blocky/*.cpp",
"meshers/transvoxel/*.cpp",
"meshers/dmc/*.cpp",
"meshers/cubes/*.cpp",
2019-05-30 00:45:19 +01:00
"meshers/*.cpp",
2021-01-28 22:02:49 +00:00
2019-05-30 00:45:19 +01:00
"streams/*.cpp",
2021-01-28 22:02:49 +00:00
"streams/sqlite/*.cpp",
2021-01-31 16:51:42 +00:00
"streams/region/*.cpp",
2021-01-28 22:02:49 +00:00
"storage/*.cpp",
2021-01-28 22:02:49 +00:00
"generators/*.cpp",
"generators/graph/*.cpp",
"generators/simple/*.cpp",
2021-01-28 22:02:49 +00:00
"util/*.cpp",
"util/math/*.cpp",
2021-02-17 20:34:35 +00:00
"util/godot/*.cpp",
"util/noise/fast_noise_lite/*.cpp",
"util/noise/gd_noise_range.cpp",
2021-12-29 19:08:23 +00:00
"util/tasks/*.cpp",
2019-05-30 00:45:19 +01:00
"terrain/*.cpp",
2021-02-07 21:40:55 +00:00
"terrain/instancing/*.cpp",
"terrain/fixed_lod/*.cpp",
"terrain/variable_lod/*.cpp",
2021-02-07 21:40:55 +00:00
"server/*.cpp",
"edition/*.cpp",
2021-01-28 22:02:49 +00:00
"thirdparty/lz4/*.c",
"thirdparty/sqlite/*.c",
"thirdparty/meshoptimizer/*.cpp"
2019-05-30 00:45:19 +01:00
]
if env["tools"]:
# Editor-only stuff
voxel_editor_files = [
"editor/*.cpp",
"editor/graph/*.cpp",
"editor/terrain/*.cpp",
2021-01-02 00:59:12 +00:00
"editor/fast_noise_lite/*.cpp",
2021-12-30 22:20:30 +00:00
"editor/instancer/*.cpp",
"editor/instance_library/*.cpp",
"editor/vox/*.cpp",
]
voxel_files += voxel_editor_files
env_voxel.Append(CPPDEFINES=[
# See https://github.com/zeux/meshoptimizer/issues/311
"MESHOPTIMIZER_ZYLANN_NEVER_COLLAPSE_BORDERS",
# Because of the above, the MeshOptimizer library in this module is different to an official one.
# Godot 4 includes an official version, which means they would both conflict at linking time.
# To prevent this clash we wrap the entire library within an additional namespace.
# This should be solved either by solving issue #311 or by porting the module to a dynamic library (GDExtension).
"MESHOPTIMIZER_ZYLANN_WRAP_LIBRARY_IN_NAMESPACE"
])
2021-04-03 20:40:35 +01:00
if RUN_TESTS:
voxel_files += [
2021-06-19 18:34:50 +01:00
"tests/*.cpp"
2021-04-03 20:40:35 +01:00
]
env_voxel.Append(CPPDEFINES={"VOXEL_RUN_TESTS": 0})
2021-01-28 22:02:49 +00:00
if env["platform"] == "windows":
# When compiling SQLite with Godot on Windows with MSVC, it produces the following warning:
# `sqlite3.c(42754): warning C4996: 'GetVersionExA': was declared deprecated `
# To fix it, let's indicate to SQLite it should not use this function, even if it is available.
# https://stackoverflow.com/questions/20031597/error-c4996-received-when-compiling-sqlite-c-in-visual-studio-2013
env_voxel.Append(CPPDEFINES={"SQLITE_WIN32_GETVERSIONEX": 0})
# ----------------------------------------------------------------------------------------------------------------------
# FastNoise 2
if FAST_NOISE_2_SRC:
if not env.msvc:
# TODO 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"])
2021-12-31 05:06:00 +00:00
env_voxel.Append(CPPPATH=["thirdparty/fast_noise_2/include"])
voxel_files += [
"util/noise/fast_noise_2.cpp"
]
2019-05-30 00:45:19 +01:00
2021-12-31 05:06:00 +00:00
if env["tools"]:
voxel_files += [
"editor/fast_noise_2/*.cpp"
]
# ----------------------------------------------------------------------------------------------------------------------
for f in voxel_files:
env_voxel.add_source_files(env.modules_sources, f)
# TODO Check webassembly builds (`env["platform"] == "javascript"`)
2020-03-28 23:20:49 +08:00
# Ignored clang warnings because Godot's codebase is old and isn't using override yet
if env['platform'] in ['osx', 'android']:
env_voxel.Append(CXXFLAGS=['-Wno-inconsistent-missing-override'])
2020-03-28 23:20:49 +08:00
# 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'])