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
|
|
|
|
2021-01-09 16:35:40 +00:00
|
|
|
# TODO Support is turned off for now because Godot 3 doesn't compile with C++17.
|
2021-02-21 03:02:32 +00:00
|
|
|
# FastNoise2 use C++17 features and STL both in its headers and runtime as well.
|
2021-01-09 16:35:40 +00:00
|
|
|
# SIMD noise support would have to wait for Godot 4...
|
2021-02-21 03:02:32 +00:00
|
|
|
FAST_NOISE_2_SRC = False
|
|
|
|
FAST_NOISE_2_STATIC = False
|
2021-05-08 19:27:33 +01:00
|
|
|
|
|
|
|
if env['target'] == 'debug':
|
|
|
|
RUN_TESTS = True
|
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",
|
2021-02-17 20:34:35 +00:00
|
|
|
"util/godot/*.cpp",
|
2021-01-09 16:35:40 +00:00
|
|
|
#"util/noise/*.cpp",
|
|
|
|
"util/noise/fast_noise_lite.cpp",
|
|
|
|
"util/noise/fast_noise_lite_gradient.cpp",
|
|
|
|
|
2019-05-30 00:45:19 +01:00
|
|
|
"terrain/*.cpp",
|
2021-02-07 21:40:55 +00:00
|
|
|
"terrain/instancing/*.cpp",
|
|
|
|
|
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",
|
|
|
|
"thirdparty/sqlite/*.c"
|
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-02-14 21:55:31 +00:00
|
|
|
"editor/instance_library/*.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-04-03 20:40:35 +01:00
|
|
|
if RUN_TESTS:
|
|
|
|
voxel_files += [
|
|
|
|
"tests/tests.cpp"
|
|
|
|
]
|
|
|
|
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:
|
|
|
|
# Build from source. Should be the simplest, but requires C++17
|
|
|
|
SConscript('thirdparty/fast_noise_2/SConscript', exports = ["env", "env_voxel"])
|
|
|
|
|
|
|
|
if FAST_NOISE_2_STATIC:
|
|
|
|
# Build from a pre-built static lib. This requires to check every build combination (and have them as well),
|
|
|
|
# AND it also requires C++17 due to differences of runtimes.
|
|
|
|
fn2_path = "C:/Projects/FastNoise2/0.7-alpha"
|
|
|
|
|
|
|
|
if env["platform"] == "windows":
|
|
|
|
if env.msvc:
|
|
|
|
if env['bits'] == '64':
|
|
|
|
env_voxel.Append(LIBPATH = [fn2_path + "/lib/win64-msvc"])
|
|
|
|
else:
|
|
|
|
raise RuntimeError("FastNoise2 32-bit builds are not supported yet")
|
|
|
|
else:
|
|
|
|
raise RuntimeError("FastNoise2 can only be built with MSVC at the moment")
|
|
|
|
|
|
|
|
env_voxel.Append(CPPPATH = [fn2_path + '/include'])
|
|
|
|
if env['target'] == 'debug':
|
|
|
|
env_voxel.Append(LIBS = ['FastNoise'])
|
|
|
|
else:
|
|
|
|
env_voxel.Append(LIBS = ['FastNoiseD'])
|
|
|
|
else:
|
|
|
|
raise RuntimeError("FastNoise2 can only be built on Windows at the moment")
|
|
|
|
|
|
|
|
voxel_files += [
|
|
|
|
"util/noise/fast_noise_2.cpp"
|
|
|
|
]
|
2019-05-30 00:45:19 +01:00
|
|
|
|
2021-02-21 03:02:32 +00:00
|
|
|
env_voxel.Append(CPPDEFINES = ["VOXEL_FAST_NOISE_2_SUPPORT"])
|
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
|
|
|
|
2019-05-30 00:45:19 +01:00
|
|
|
# Doesn't work, because reasons
|
|
|
|
#if env.msvc:
|
|
|
|
# env_voxel.Append(CXXFLAGS=['/std:c++17'])
|
|
|
|
#else:
|
|
|
|
# env_voxel.Append(CXXFLAGS=['-std=c++17'])
|
2019-08-23 22:49:43 +01:00
|
|
|
|
|
|
|
# This also 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'])
|