2016-05-01 06:00:02 -07:00
|
|
|
Import('env')
|
2019-05-29 16:45:19 -07:00
|
|
|
Import('env_modules')
|
2016-05-01 06:00:02 -07:00
|
|
|
|
2021-01-09 08:35:40 -08:00
|
|
|
# TODO Support is turned off for now because Godot 3 doesn't compile with C++17.
|
2021-02-20 19:02:32 -08:00
|
|
|
# FastNoise2 use C++17 features and STL both in its headers and runtime as well.
|
2021-01-09 08:35:40 -08:00
|
|
|
# SIMD noise support would have to wait for Godot 4...
|
2021-02-20 19:02:32 -08:00
|
|
|
FAST_NOISE_2_SRC = False
|
|
|
|
FAST_NOISE_2_STATIC = False
|
2021-01-09 08:35:40 -08:00
|
|
|
|
2019-05-29 16:45:19 -07:00
|
|
|
env_voxel = env_modules.Clone()
|
2016-05-01 06:00:02 -07:00
|
|
|
|
2021-01-09 08:35:40 -08:00
|
|
|
voxel_files = [
|
2019-05-29 16:45:19 -07:00
|
|
|
"*.cpp",
|
2021-01-28 14:02:49 -08:00
|
|
|
|
2021-02-21 15:58:00 -08:00
|
|
|
"constants/*.cpp",
|
|
|
|
|
2019-05-29 16:45:19 -07:00
|
|
|
"meshers/blocky/*.cpp",
|
|
|
|
"meshers/transvoxel/*.cpp",
|
|
|
|
"meshers/dmc/*.cpp",
|
2020-09-10 16:36:23 -07:00
|
|
|
"meshers/cubes/*.cpp",
|
2019-05-29 16:45:19 -07:00
|
|
|
"meshers/*.cpp",
|
2021-01-28 14:02:49 -08:00
|
|
|
|
2019-05-29 16:45:19 -07:00
|
|
|
"streams/*.cpp",
|
2021-01-28 14:02:49 -08:00
|
|
|
"streams/sqlite/*.cpp",
|
2021-01-31 08:51:42 -08:00
|
|
|
"streams/region/*.cpp",
|
2021-01-28 14:02:49 -08:00
|
|
|
|
2020-09-14 11:33:02 -07:00
|
|
|
"storage/*.cpp",
|
2021-01-28 14:02:49 -08:00
|
|
|
|
2020-01-26 14:34:26 -08:00
|
|
|
"generators/*.cpp",
|
2020-02-19 11:26:14 -08:00
|
|
|
"generators/graph/*.cpp",
|
2020-12-18 13:19:02 -08:00
|
|
|
"generators/simple/*.cpp",
|
2021-01-09 08:35:40 -08:00
|
|
|
|
2021-01-28 14:02:49 -08:00
|
|
|
"util/*.cpp",
|
2021-02-17 12:34:35 -08:00
|
|
|
"util/godot/*.cpp",
|
2021-01-09 08:35:40 -08:00
|
|
|
#"util/noise/*.cpp",
|
|
|
|
"util/noise/fast_noise_lite.cpp",
|
|
|
|
"util/noise/fast_noise_lite_gradient.cpp",
|
|
|
|
|
2019-05-29 16:45:19 -07:00
|
|
|
"terrain/*.cpp",
|
2021-02-07 13:40:55 -08:00
|
|
|
"terrain/instancing/*.cpp",
|
|
|
|
|
2020-08-23 17:49:23 -07:00
|
|
|
"server/*.cpp",
|
2020-01-26 12:29:44 -08:00
|
|
|
"edition/*.cpp",
|
2021-01-28 14:02:49 -08:00
|
|
|
|
|
|
|
"thirdparty/lz4/*.c",
|
|
|
|
"thirdparty/sqlite/*.c"
|
2019-05-29 16:45:19 -07:00
|
|
|
]
|
|
|
|
|
2020-12-04 14:01:41 -08:00
|
|
|
if env["tools"]:
|
|
|
|
# Editor-only stuff
|
2021-01-09 08:35:40 -08:00
|
|
|
voxel_editor_files = [
|
2020-12-04 14:01:41 -08:00
|
|
|
"editor/*.cpp",
|
|
|
|
"editor/graph/*.cpp",
|
|
|
|
"editor/terrain/*.cpp",
|
2021-01-01 16:59:12 -08:00
|
|
|
"editor/fast_noise_lite/*.cpp",
|
2021-02-14 13:55:31 -08:00
|
|
|
"editor/instance_library/*.cpp",
|
2020-12-04 14:01:41 -08:00
|
|
|
]
|
2021-01-09 08:35:40 -08:00
|
|
|
voxel_files += voxel_editor_files
|
2020-12-04 14:01:41 -08:00
|
|
|
|
2021-01-28 14:02:49 -08: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-20 19:02:32 -08: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-29 16:45:19 -07:00
|
|
|
|
2021-02-20 19:02:32 -08:00
|
|
|
env_voxel.Append(CPPDEFINES = ["VOXEL_FAST_NOISE_2_SUPPORT"])
|
2021-01-09 08:35:40 -08:00
|
|
|
|
2021-02-20 19:02:32 -08:00
|
|
|
# ----------------------------------------------------------------------------------------------------------------------
|
2021-01-09 08:35:40 -08:00
|
|
|
|
2021-02-20 19:02:32 -08:00
|
|
|
for f in voxel_files:
|
|
|
|
env_voxel.add_source_files(env.modules_sources, f)
|
2021-01-09 08:35:40 -08:00
|
|
|
|
2021-02-20 19:02:32 -08:00
|
|
|
# TODO Check webassembly builds (`env["platform"] == "javascript"`)
|
2021-01-09 08:35:40 -08:00
|
|
|
|
2020-03-28 08:20:49 -07:00
|
|
|
# Ignored clang warnings because Godot's codebase is old and isn't using override yet
|
2021-01-09 08:35:40 -08:00
|
|
|
if env['platform'] in ['osx', 'android']:
|
|
|
|
env_voxel.Append(CXXFLAGS=['-Wno-inconsistent-missing-override'])
|
2020-03-28 08:20:49 -07:00
|
|
|
|
2019-05-29 16:45:19 -07: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 14:49:43 -07: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'])
|