-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
285 lines (247 loc) · 7.45 KB
/
setup.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
import pathlib
import os
import glob
current_directory = pathlib.Path.cwd()
thirdparty_directory = current_directory / "thirdparty"
print("Current Directory: " + str(current_directory))
os.system("chcp 65001")
os.system("vswhere.exe -latest -property installationPath > temp.txt")
f = open("temp.txt")
vs_path = pathlib.Path(f.read().strip("\n"))
f.close()
if not vs_path.exists():
print("Cannot find visual studio, abort")
exit(0)
if os.system("cmake --version") != 0:
print("Cannot find CMake, abort")
exit(0)
print("Download or build libraries?\n 1 - All\n 2 - Manually\n 3 - All Required\n 4 - Skip")
op = int(input())
if op != 4:
print("== library glm ==")
os.system("vcpkg install glm")
print("====\n")
print("== library PugiXML ==")
os.system("vcpkg install pugixml")
print("====\n")
print("== library nlohmann json ==")
os.system("vcpkg install nlohmann_json")
print("====\n")
print("== library cppcodec ==")
os.system("vcpkg install cppcodec")
print("====\n")
print("== library stb ==")
os.system("vcpkg install stb")
print("====\n")
print("== library exprtk ==")
os.system("vcpkg install exprtk")
print("====\n")
print("== library sha1 ==")
ok = True
address = "https://github.com/tkgamegroup/sha1.git"
lib_dir = thirdparty_directory / "sha1"
if not lib_dir.exists():
if op == 2:
print("Download SHA1 from %s into %s ? y/n" % (address, str(lib_dir)))
ok = input() == "y"
if ok:
os.system("git clone --depth 1 %s %s && echo ok" % (address, str(lib_dir)))
else:
print("%s exists, skip download" % str(lib_dir))
print("====\n")
# (Optional)
if op != 3:
print("== library curl ==")
ok = True
if op == 2:
print("Install curl ? y/n")
ok = input() == "y"
if ok:
os.system("vcpkg install curl[ssl]")
print("====\n")
# (Optional)
if op != 3:
print("== library msdfgen ==")
ok = True
if op == 2:
print("Install msdfgen ? y/n")
ok = input() == "y"
if ok:
os.system("vcpkg install msdfgen")
print("====\n")
print("== library gli ==")
os.system("vcpkg install gli")
print("====\n")
print("== library SPIRV-Cross ==")
os.system("vcpkg install spirv-cross")
print("====\n")
# (Optional)
if op != 3:
print("== library assimp ==")
ok = True
if op == 2:
print("Install assimp ? y/n")
ok = input() == "y"
if ok:
os.system("vcpkg install assimp")
print("====\n")
# (Optional)
'''
if op != 3:
print("== library PhysX ==")
ok = True
address = "https://github.com/NVIDIAGameWorks/PhysX.git"
lib_dir = parent_directory / "PhysX"
if op == 2:
print("Download PhysX from %s into %s ? y/n" % (address, str(lib_dir)))
ok = input() == "y"
if ok:
if not lib_dir.exists():
os.system("git clone --depth 1 %s %s && echo ok" % (address, str(lib_dir)))
else:
print("%s exists, skip download" % str(lib_dir))
print("====\n")
'''
# (Optional)
if op != 3:
print("== library box2d ==")
ok = True
if op == 2:
print("Install Box2d ? y/n")
ok = input() == "y"
if ok:
os.system("vcpkg install box2d")
print("====\n")
# (Optional)
if op != 3:
print("== library recastnavigation ==")
ok = True
if op == 2:
print("Install recastnavigation ? y/n")
ok = input() == "y"
if ok:
os.system("vcpkg install recastnavigation")
print("====\n")
# (Optional)
if op != 3:
print("== library Font-Awesome ==")
ok = True
address = "https://github.com/tkgamegroup/Font-Awesome.git"
lib_dir = thirdparty_directory / "Font-Awesome"
if not lib_dir.exists():
if op == 2:
print("Download Font-Awesome from %s into %s ? y/n" % (address, str(lib_dir)))
ok = input() == "y"
if ok:
os.system("git clone --depth 1 %s %s && echo ok" % (address, str(lib_dir)))
else:
print("%s exists, skip download" % str(lib_dir))
print("====\n")
# (Optional)
if op != 3:
print("== library imgui ==")
ok = True
address = "https://github.com/tkgamegroup/imgui.git"
lib_dir = thirdparty_directory / "imgui"
if not lib_dir.exists():
if op == 2:
print("Download imgui from %s into %s ? y/n" % (address, str(lib_dir)))
ok = input() == "y"
if ok:
os.system("git clone --depth 1 --branch docking %s %s && echo ok" % (address, str(lib_dir)))
else:
print("%s exists, skip download" % str(lib_dir))
print("====\n")
# (Optional)
if op != 3:
print("== library ImGuizmo ==")
ok = True
address = "https://github.com/tkgamegroup/ImGuizmo.git"
lib_dir = thirdparty_directory / "ImGuizmo"
if not lib_dir.exists():
if op == 2:
print("Download ImGuizmo from %s into %s ? y/n" % (address, str(lib_dir)))
ok = input() == "y"
if ok:
os.system("git clone --depth 1 %s %s && echo ok" % (address, str(lib_dir)))
else:
print("%s exists, skip download" % str(lib_dir))
print("====\n")
# (Optional)
if op != 3:
print("== library ImGui-Node-Editor ==")
ok = True
address = "https://github.com/tkgamegroup/imgui-node-editor.git"
lib_dir = thirdparty_directory / "imgui-node-editor"
if not lib_dir.exists():
if op == 2:
print("Download ImGui-Node-Editor from %s into %s ? y/n" % (address, str(lib_dir)))
ok = input() == "y"
if ok:
os.system("git clone --depth 1 %s %s && echo ok" % (address, str(lib_dir)))
else:
print("%s exists, skip download" % str(lib_dir))
print("====\n")
# (Optional)
if op != 3:
print("== library FortuneAlgorithm ==")
ok = True
address = "https://github.com/tkgamegroup/FortuneAlgorithm.git"
lib_dir = thirdparty_directory / "FortuneAlgorithm"
if not lib_dir.exists():
if op == 2:
print("Download FortuneAlgorithm from %s into %s ? y/n" % (address, str(lib_dir)))
ok = input() == "y"
if ok:
os.system("git clone --depth 1 %s %s && echo ok" % (address, str(lib_dir)))
else:
print("%s exists, skip download" % str(lib_dir))
ok = True
bud_dir = lib_dir / "build"
if not bud_dir.exists():
if op == 2:
print("Build FortuneAlgorithm into %s ? y/n" % str(bud_dir))
ok = input() == "y"
if ok:
bud_dir.mkdir()
os.system("cmake -S \"%s\" -B \"%s\"" % (lib_dir, bud_dir))
os.chdir("%s/MSBuild/Current/Bin" % str(vs_path));
files = glob.glob("%s/*.sln" % str(bud_dir))
if len(files) > 0:
os.system("msbuild \"%s\"" % files[0])
else:
print("CMake Failed")
os.chdir(current_directory)
else:
print("%s exists, skip build" % str(bud_dir))
print("====\n")
cmake_cl = "cmake -B build "
path = thirdparty_directory / "sha1"
if path.exists():
cmake_cl += "-DSHA1_INCLUDE_DIR=\"%s\" " % str(path)
path = thirdparty_directory / "PhysX"
if path.exists():
cmake_cl += "-DPHYSX_INCLUDE_DIR=\"%s\" " % str(path)
path = thirdparty_directory / "Font-Awesome"
if path.exists():
cmake_cl += "-DFONT_AWESOME_DIR=\"%s\" " % str(path)
path = thirdparty_directory / "imgui"
if path.exists():
cmake_cl += "-DIMGUI_DIR=\"%s\" " % str(path)
path = thirdparty_directory / "ImGuizmo"
if path.exists():
cmake_cl += "-DIM_GUIZMO_DIR=\"%s\" " % str(path)
path = thirdparty_directory / "imgui-node-editor"
if path.exists():
cmake_cl += "-DIMGUI_NODE_EDITOR_DIR=\"%s\" " % str(path)
path = thirdparty_directory / "FortuneAlgorithm"
if path.exists():
cmake_cl += "-DFORTUNE_ALGORITHM_DIR=\"%s\" " % str(path)
os.system(cmake_cl)
print("\nSet environment variable of Flame Engine:")
os.system("setx FLAME_PATH \"%s\"" % str(current_directory))
print("\nRegister DIA dll ? y/n")
if input() == "y":
os.system("regsvr32 \"%s/DIA SDK/bin/amd64/msdia140.dll\"" % str(vs_path))
print("\nDone.")
os.system("pause")