-
-
Notifications
You must be signed in to change notification settings - Fork 241
/
common.py
162 lines (134 loc) · 5.44 KB
/
common.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import glob
# Gets sources and configurations that are common to compiling as a module and an extension.
# For module-specific configuration, see `SCsub`.
# For extension-specific configuration, see `SConstruct`.
def get_sources(env, is_editor_build, include_tests):
env.Append(CPPPATH=["."])
env.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",
])
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.Append(CPPDEFINES={"SQLITE_WIN32_GETVERSIONEX": 0})
sources = [
"constants/*.cpp",
"meshers/blocky/*.cpp",
"meshers/blocky/types/*.cpp",
"meshers/transvoxel/*.cpp",
"meshers/dmc/*.cpp",
"meshers/cubes/*.cpp",
"meshers/*.cpp",
"streams/*.cpp",
"streams/sqlite/*.cpp",
"streams/region/*.cpp",
"streams/vox/*.cpp",
"storage/*.cpp",
"storage/metadata/*.cpp",
"generators/*.cpp",
"generators/graph/*.cpp",
"generators/simple/*.cpp",
"generators/multipass/*.cpp",
"modifiers/*.cpp",
"modifiers/godot/*.cpp",
"terrain/*.cpp",
"terrain/instancing/*.cpp",
"terrain/fixed_lod/*.cpp",
"terrain/variable_lod/*.cpp",
"engine/*.cpp",
"engine/gpu/*.cpp",
"engine/detail_rendering/*.cpp",
"edition/*.cpp",
"shaders/*.cpp",
"register_types.cpp",
# Utility
"util/*.cpp",
"util/containers/*.cpp",
"util/math/*.cpp",
"util/memory/*.cpp",
"util/noise/fast_noise_lite/*.cpp",
"util/noise/gd_noise_range.cpp",
"util/noise/spot_noise_gd.cpp",
"util/string/*.cpp",
"util/thread/thread.cpp",
"util/thread/spatial_lock_2d.cpp",
"util/thread/spatial_lock_3d.cpp",
"util/tasks/*.cpp",
"util/tasks/godot/*.cpp",
"util/godot/classes/array_mesh.cpp",
"util/godot/classes/concave_polygon_shape_3d.cpp",
"util/godot/classes/geometry_2d.cpp",
"util/godot/classes/geometry_instance_3d.cpp",
"util/godot/classes/input_event_key.cpp",
"util/godot/classes/mesh.cpp",
"util/godot/classes/multimesh.cpp",
"util/godot/classes/node.cpp",
"util/godot/classes/object.cpp",
"util/godot/classes/project_settings.cpp",
"util/godot/classes/rendering_device.cpp",
"util/godot/classes/rendering_server.cpp",
"util/godot/classes/resource_loader.cpp",
"util/godot/classes/shader.cpp",
"util/godot/core/string.cpp",
"util/godot/core/variant.cpp",
"util/godot/core/packed_arrays.cpp",
"util/godot/direct_mesh_instance.cpp",
"util/godot/direct_multimesh_instance.cpp",
"util/godot/direct_static_body.cpp",
"util/godot/file_utils.cpp",
"util/godot/shader_material_pool.cpp",
"util/io/*.cpp",
# Thirdparty
"thirdparty/lz4/*.c",
# "thirdparty/sqlite/*.c",
"thirdparty/meshoptimizer/*.cpp"
]
if is_editor_build:
sources += [
"editor/*.cpp",
"editor/terrain/*.cpp",
"editor/fast_noise_lite/*.cpp",
"editor/spot_noise/*.cpp",
"editor/vox/*.cpp",
"editor/instancer/*.cpp",
"editor/instance_library/*.cpp",
"editor/mesh_sdf/*.cpp",
"editor/graph/*.cpp",
"editor/blocky_library/*.cpp",
"editor/blocky_library/types/*.cpp",
"editor/multipass/*.cpp",
"util/godot/debug_renderer.cpp",
"util/godot/check_ref_ownership.cpp",
"util/godot/classes/editor_plugin.cpp",
"util/godot/classes/editor_import_plugin.cpp",
"util/godot/classes/editor_inspector_plugin.cpp",
"util/godot/classes/editor_property.cpp",
"util/godot/classes/editor_settings.cpp",
"util/godot/classes/graph_edit.cpp", # Not editor-only, but only used in editor for now
"util/godot/classes/graph_node.cpp" # Not editor-only, but only used in editor for now
]
if include_tests:
sources += [
"tests/*.cpp",
"tests/util/*.cpp",
"tests/voxel/*.cpp"
]
def process_glob_paths(p_sources):
out = []
for path in p_sources:
if '*' in path:
paths = glob.glob(path)
out += paths
else:
out.append(path)
return out
sources = process_glob_paths(sources)
return sources