2016-05-01 15:00:02 +02:00
|
|
|
Import('env')
|
2019-05-30 00:45:19 +01:00
|
|
|
Import('env_modules')
|
2016-05-01 15:00:02 +02:00
|
|
|
|
2022-03-30 23:17:27 +01:00
|
|
|
# Note, support for FastNoise2 requires C++17, and doesn't work yet on ARM.
|
|
|
|
FAST_NOISE_2_SRC = env["voxel_fast_noise_2"]
|
2021-05-08 19:27:33 +01:00
|
|
|
|
2022-03-20 18:29:31 +00:00
|
|
|
RUN_TESTS = env["voxel_tests"]
|
2021-01-09 16:35:40 +00:00
|
|
|
|
2019-05-30 00:45:19 +01:00
|
|
|
env_voxel = env_modules.Clone()
|
2016-05-01 15:00:02 +02:00
|
|
|
|
2021-01-09 16:35:40 +00:00
|
|
|
voxel_files = [
|
2019-05-30 00:45:19 +01:00
|
|
|
"*.cpp",
|
2021-01-28 22:02:49 +00:00
|
|
|
|
2021-02-21 23:58:00 +00:00
|
|
|
"constants/*.cpp",
|
|
|
|
|
2019-05-30 00:45:19 +01:00
|
|
|
"meshers/blocky/*.cpp",
|
|
|
|
"meshers/transvoxel/*.cpp",
|
|
|
|
"meshers/dmc/*.cpp",
|
2020-09-11 00:36:23 +01:00
|
|
|
"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
|
|
|
|
2020-09-14 19:33:02 +01:00
|
|
|
"storage/*.cpp",
|
2021-01-28 22:02:49 +00:00
|
|
|
|
2020-01-26 22:34:26 +00:00
|
|
|
"generators/*.cpp",
|
2020-02-19 19:26:14 +00:00
|
|
|
"generators/graph/*.cpp",
|
2020-12-18 21:19:02 +00:00
|
|
|
"generators/simple/*.cpp",
|
2021-01-09 16:35:40 +00:00
|
|
|
|
2021-01-28 22:02:49 +00:00
|
|
|
"util/*.cpp",
|
2022-02-05 16:14:57 +00:00
|
|
|
|
|
|
|
"util/math/*.cpp",
|
|
|
|
|
2021-02-17 20:34:35 +00:00
|
|
|
"util/godot/*.cpp",
|
2022-02-05 16:14:57 +00:00
|
|
|
|
2022-04-03 20:07:17 +01:00
|
|
|
"util/noise/fast_noise_lite/*.cpp",
|
|
|
|
"util/noise/gd_noise_range.cpp",
|
2022-02-05 16:14:57 +00:00
|
|
|
|
2022-04-19 00:32:37 +01:00
|
|
|
"util/thread/*.cpp",
|
|
|
|
|
2021-12-29 19:08:23 +00:00
|
|
|
"util/tasks/*.cpp",
|
2022-04-07 22:34:07 +01:00
|
|
|
"util/tasks/godot/*.cpp",
|
2021-01-09 16:35:40 +00:00
|
|
|
|
2019-05-30 00:45:19 +01:00
|
|
|
"terrain/*.cpp",
|
2021-02-07 21:40:55 +00:00
|
|
|
"terrain/instancing/*.cpp",
|
2022-03-20 22:57:53 +00:00
|
|
|
"terrain/fixed_lod/*.cpp",
|
|
|
|
"terrain/variable_lod/*.cpp",
|
2021-02-07 21:40:55 +00:00
|
|
|
|
2020-08-24 01:49:23 +01:00
|
|
|
"server/*.cpp",
|
2020-01-26 20:29:44 +00:00
|
|
|
"edition/*.cpp",
|
2021-01-28 22:02:49 +00:00
|
|
|
|
|
|
|
"thirdparty/lz4/*.c",
|
2021-07-11 16:19:49 +01:00
|
|
|
"thirdparty/sqlite/*.c",
|
|
|
|
"thirdparty/meshoptimizer/*.cpp"
|
2019-05-30 00:45:19 +01:00
|
|
|
]
|
|
|
|
|
2020-12-04 22:01:41 +00:00
|
|
|
if env["tools"]:
|
|
|
|
# Editor-only stuff
|
2021-01-09 16:35:40 +00:00
|
|
|
voxel_editor_files = [
|
2020-12-04 22:01:41 +00:00
|
|
|
"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",
|
2021-02-14 21:55:31 +00:00
|
|
|
"editor/instance_library/*.cpp",
|
2021-07-31 18:48:47 +01:00
|
|
|
"editor/vox/*.cpp",
|
2020-12-04 22:01:41 +00:00
|
|
|
]
|
2021-01-09 16:35:40 +00:00
|
|
|
voxel_files += voxel_editor_files
|
2020-12-04 22:01:41 +00:00
|
|
|
|
2021-12-13 21:38:10 +00:00
|
|
|
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).
|
2022-04-10 20:10:33 +01:00
|
|
|
"MESHOPTIMIZER_ZYLANN_WRAP_LIBRARY_IN_NAMESPACE",
|
|
|
|
# Tell engine-agnostic code we are using Godot Engine
|
|
|
|
"ZN_GODOT"
|
2021-12-13 21:38:10 +00:00
|
|
|
])
|
2021-07-11 16:19:49 +01:00
|
|
|
|
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})
|
|
|
|
|
2021-02-21 03:02:32 +00:00
|
|
|
# ----------------------------------------------------------------------------------------------------------------------
|
|
|
|
# FastNoise 2
|
|
|
|
|
|
|
|
if FAST_NOISE_2_SRC:
|
2022-01-08 18:58:31 +00:00
|
|
|
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"])
|
|
|
|
|
2021-02-21 03:02:32 +00:00
|
|
|
# Build from source. Should be the simplest, but requires C++17
|
|
|
|
SConscript('thirdparty/fast_noise_2/SConscript', exports = ["env", "env_voxel"])
|
2022-01-08 18:58:31 +00:00
|
|
|
|
2021-12-31 05:06:00 +00:00
|
|
|
env_voxel.Append(CPPPATH=["thirdparty/fast_noise_2/include"])
|
|
|
|
|
2021-02-21 03:02:32 +00:00
|
|
|
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"
|
|
|
|
]
|
2021-01-09 16:35:40 +00:00
|
|
|
|
2021-02-21 03:02:32 +00:00
|
|
|
# ----------------------------------------------------------------------------------------------------------------------
|
2021-01-09 16:35:40 +00:00
|
|
|
|
2021-02-21 03:02:32 +00:00
|
|
|
for f in voxel_files:
|
|
|
|
env_voxel.add_source_files(env.modules_sources, f)
|
2021-01-09 16:35:40 +00:00
|
|
|
|
2021-02-21 03:02:32 +00:00
|
|
|
# TODO Check webassembly builds (`env["platform"] == "javascript"`)
|
2021-01-09 16:35:40 +00:00
|
|
|
|
2020-03-28 23:20:49 +08:00
|
|
|
# Ignored clang warnings because Godot's codebase is old and isn't using override yet
|
2021-01-09 16:35:40 +00:00
|
|
|
if env['platform'] in ['osx', 'android']:
|
|
|
|
env_voxel.Append(CXXFLAGS=['-Wno-inconsistent-missing-override'])
|
2020-03-28 23:20:49 +08:00
|
|
|
|
2022-01-08 18:56:06 +00:00
|
|
|
# Doesn't work, since the rest of Godot doesn't use this, linking fails.
|
2019-08-23 22:49:43 +01:00
|
|
|
# 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'])
|