forked from Tencent/puerts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JsEnv.Build.cs
457 lines (422 loc) · 22.3 KB
/
JsEnv.Build.cs
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
/*
* Tencent is pleased to support the open source community by making Puerts available.
* Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
* Puerts is licensed under the BSD 3-Clause License, except for the third-party components listed in the file 'LICENSE' which may be subject to their corresponding license terms.
* This file is subject to the terms and conditions defined in file 'LICENSE', which is part of this source code package.
*/
using UnrealBuildTool;
using System.IO;
using System.Reflection;
public class JsEnv : ModuleRules
{
private bool UseNewV8 = false;
private bool UseNodejs = false;
private bool UseQuickjs = false;
private bool WithFFI = false;
public JsEnv(ReadOnlyTargetRules Target) : base(Target)
{
//PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDefinitions.Add("USING_IN_UNREAL_ENGINE");
PublicDependencyModuleNames.AddRange(new string[]
{
"Core", "CoreUObject", "Engine", "InputCore", "Serialization", "OpenSSL","UMG"
});
bEnableExceptions = true;
bEnableUndefinedIdentifierWarnings = false; // 避免在VS 2017编译时出现C4668错误
var ContextField = GetType().GetField("Context", BindingFlags.Instance | BindingFlags.NonPublic);
if (ContextField != null)
{
var bCanHotReloadField = ContextField.FieldType.GetField("bCanHotReload", BindingFlags.Instance | BindingFlags.Public);
if (bCanHotReloadField != null)
{
bCanHotReloadField.SetValue(ContextField.GetValue(this), false);
}
}
if (UseNewV8)
{
ThirdParty(Target);
}
else if (UseNodejs)
{
ThirdPartyNodejs(Target);
}
else if (UseQuickjs)
{
ThirdPartyQJS(Target);
}
else
{
OldThirdParty(Target);
}
if (WithFFI) AddFFI(Target);
string coreJSPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Content"));
string destDirName = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "..", "..", "Content"));
DirectoryCopy(coreJSPath, destDirName, true);
}
void OldThirdParty(ReadOnlyTargetRules Target)
{
string LibraryPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "Library"));
if (Target.Platform == UnrealTargetPlatform.Win64)
{
//if (Target.bBuildEditor)
//{
// WinDll(Path.Combine(LibraryPath, "V8"));
//}
//else
{
string V8LibraryPath = Path.Combine(LibraryPath, "V8", "Win64");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "encoding.lib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "inspector.lib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "inspector_string_conversions.lib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "v8_base_without_compiler_0.lib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "v8_base_without_compiler_1.lib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "v8_compiler.lib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "v8_external_snapshot.lib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "v8_libbase.lib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "v8_libplatform.lib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "v8_libsampler.lib"));
}
}
else if (Target.Platform == UnrealTargetPlatform.Android)
{
if (Target.Version.MajorVersion == 4 && Target.Version.MinorVersion >= 25)
{
// for arm7
string V8LibraryPath = Path.Combine(LibraryPath, "V8", "Android", "armeabi-v7a", "8.4.371.19");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libwee8.a"));
// for arm64
V8LibraryPath = Path.Combine(LibraryPath, "V8", "Android", "arm64-v8a", "8.4.371.19");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libwee8.a"));
}
else if (Target.Version.MajorVersion == 4 && Target.Version.MinorVersion < 25 && Target.Version.MinorVersion >= 22)
{
// for arm7
string V8LibraryPath = Path.Combine(LibraryPath, "V8", "Android", "armeabi-v7a", "7.4.288");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_base.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_external_snapshot.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libbase.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libplatform.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libsampler.a"));
// for arm64
V8LibraryPath = Path.Combine(LibraryPath, "V8", "Android", "arm64-v8a", "7.4.288");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_base.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_external_snapshot.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libbase.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libplatform.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libsampler.a"));
}
else if (Target.Version.MajorVersion == 4 && Target.Version.MinorVersion < 22)
{
string V8LibraryPath = Path.Combine(LibraryPath, "V8", "Android", "armeabi-v7a", "7.4.288");
PublicLibraryPaths.Add(V8LibraryPath);
V8LibraryPath = Path.Combine(LibraryPath, "V8", "Android", "arm64-v8a", "7.4.288");
PublicLibraryPaths.Add(V8LibraryPath);
PublicAdditionalLibraries.Add("inspector");
PublicAdditionalLibraries.Add("v8_base");
PublicAdditionalLibraries.Add("v8_external_snapshot");
PublicAdditionalLibraries.Add("v8_libbase");
PublicAdditionalLibraries.Add("v8_libplatform");
PublicAdditionalLibraries.Add("v8_libsampler");
}
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
// PublicFrameworks.AddRange(new string[] { "WebKit", "JavaScriptCore" });
PublicFrameworks.AddRange(new string[] { "WebKit" });
string V8LibraryPath = Path.Combine(LibraryPath, "V8", "macOS");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libbindings.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libencoding.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector_string_conversions.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libtorque_base.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libtorque_generated_definitions.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libtorque_generated_initializers.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_base_without_compiler.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_compiler.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_external_snapshot.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_init.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_initializers.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libbase.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libplatform.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libsampler.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_nosnapshot.a"));
}
else if (Target.Platform == UnrealTargetPlatform.IOS)
{
PublicFrameworks.AddRange(new string[] { "WebKit" });
string V8LibraryPath = Path.Combine(LibraryPath, "V8", "iOS", "arm64");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libbindings.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libencoding.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libinspector_string_conversions.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libtorque_generated_definitions.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_base_without_compiler.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_compiler.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_external_snapshot.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libbase.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libplatform.a"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libsampler.a"));
//PublicAdditionalLibraries.Add(Path.Combine(Path.Combine(LibraryPath, "ffi", "iOS"), "libffi.a"));
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
string V8LibraryPath = Path.Combine(LibraryPath, "V8", "Linux");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libwee8.a"));
}
string HeaderPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "Include"));
// External headers
if (Target.Platform == UnrealTargetPlatform.Android)
{
if (Target.Version.MajorVersion == 4 && Target.Version.MinorVersion >= 25)
{
PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "v8", "8.4.371.19") });
}
else if (Target.Version.MajorVersion == 4 && Target.Version.MinorVersion < 25)
{
PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "v8", "7.4.288") });
}
}
//else if (Target.bBuildEditor && Target.Platform == UnrealTargetPlatform.Win64)
//{
// PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "v8", "8.4.371.19") });
//}
else if (Target.Platform == UnrealTargetPlatform.Win64 ||
Target.Platform == UnrealTargetPlatform.IOS ||
Target.Platform == UnrealTargetPlatform.Mac ||
Target.Platform == UnrealTargetPlatform.Linux)
{
PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "v8", "7.7.299") });
}
PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "websocketpp") });
PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "asio") });
}
void AddFFI(ReadOnlyTargetRules Target)
{
string HeaderPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "Include"));
string LibraryPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "Library"));
if (Target.Platform == UnrealTargetPlatform.Win64)
{
PublicIncludePaths.AddRange(new string[] {Path.Combine(HeaderPath, "ffi", "Win64")});
PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "ffi", "Win64", "ffi.lib"));
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
PublicIncludePaths.AddRange(new string[] {Path.Combine(HeaderPath, "ffi", "macOS")});
PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "ffi", "macOS", "libffi.a"));
}
else if (Target.Platform == UnrealTargetPlatform.IOS)
{
PublicIncludePaths.AddRange(new string[] {Path.Combine(HeaderPath, "ffi", "iOS")});
PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "ffi", "iOS", "libffi.a"));
}
else if (Target.Platform == UnrealTargetPlatform.Android)
{
PublicIncludePaths.AddRange(new string[] {Path.Combine(HeaderPath, "ffi", "Android")});
PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "ffi", "Android", "armeabi-v7a", "libffi.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibraryPath, "ffi", "Android", "arm64-v8a", "libffi.a"));
}
PrivateDefinitions.Add("WITH_FFI");
}
void AddRuntimeDependencies(string[] DllNames, string LibraryPath, bool Delay)
{
string BinariesDir = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Binaries", "Win64"));
foreach (var DllName in DllNames)
{
if(Delay) PublicDelayLoadDLLs.Add(DllName);
var DllPath = Path.Combine(LibraryPath, DllName);
var DestDllPath = Path.Combine(BinariesDir, DllName);
if (!Directory.Exists(BinariesDir))
{
Directory.CreateDirectory(BinariesDir);
}
try
{
System.IO.File.Delete(DestDllPath);
}
catch { }
if (!System.IO.File.Exists(DestDllPath) && System.IO.File.Exists(DllPath))
{
System.IO.File.Copy(DllPath, DestDllPath, false);
}
RuntimeDependencies.Add(DestDllPath);
}
}
void WinDll(string LibraryPath)
{
string V8LibraryPath = Path.Combine(LibraryPath, "Win64DLL");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "v8.dll.lib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "v8_libplatform.dll.lib"));
AddRuntimeDependencies(new string[]
{
"v8.dll",
"v8_libplatform.dll",
"v8_libbase.dll",
"zlib.dll"
}, V8LibraryPath, false);
}
void MacDylib(string LibraryPath)
{
string V8LibraryPath = Path.Combine(LibraryPath, "macOSdylib");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8.dylib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libplatform.dylib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libv8_libbase.dylib"));
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libchrome_zlib.dylib"));
}
void ThirdParty(ReadOnlyTargetRules Target)
{
//Add header
string HeaderPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "Include"));
PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "websocketpp") });
PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "asio") });
PublicIncludePaths.AddRange(new string[] { Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "v8", "Inc") });
string LibraryPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "v8", "Lib"));
if (Target.Platform == UnrealTargetPlatform.Win64)
{
if (!Target.bBuildEditor)
{
string V8LibraryPath = Path.Combine(LibraryPath, "Win64MD");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "wee8.lib"));
}
else
{
WinDll(LibraryPath);
}
}
else if (Target.Platform == UnrealTargetPlatform.Android)
{
string V8LibraryPath = Path.Combine(LibraryPath, "Android", "armeabi-v7a");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libwee8.a"));
V8LibraryPath = Path.Combine(LibraryPath, "Android", "arm64-v8a");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libwee8.a"));
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
//PublicFrameworks.AddRange(new string[] { "WebKit", "JavaScriptCore" });
//PublicFrameworks.AddRange(new string[] { "WebKit" });
if (!Target.bBuildEditor)
{
string V8LibraryPath = Path.Combine(LibraryPath, "macOS");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libwee8.a"));
}
else
{
MacDylib(LibraryPath);
}
}
else if (Target.Platform == UnrealTargetPlatform.IOS)
{
PublicFrameworks.AddRange(new string[] { "WebKit" });
string V8LibraryPath = Path.Combine(LibraryPath, "iOS", "arm64");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libwee8.a"));
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
string V8LibraryPath = Path.Combine(LibraryPath, "Linux");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libwee8.a"));
}
}
void ThirdPartyNodejs(ReadOnlyTargetRules Target)
{
PrivateDefinitions.Add("WITHOUT_INSPECTOR");//node already had one
PrivateDefinitions.Add("WITH_NODEJS");
string HeaderPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "libnode"));
PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "include") });
PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "deps", "v8", "include") });
PublicIncludePaths.AddRange(new string[] { Path.Combine(HeaderPath, "deps", "uv", "include") });
string LibraryPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "libnode", "lib"));
if (Target.Platform == UnrealTargetPlatform.Win64)
{
string V8LibraryPath = Path.Combine(LibraryPath, "Win64");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libnode.lib"));
AddRuntimeDependencies(new string[]
{
"libnode.dll",
}, V8LibraryPath, false);
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
string V8LibraryPath = Path.Combine(LibraryPath, "macOS");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libnode.dylib"));
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
string V8LibraryPath = Path.Combine(LibraryPath, "Linux");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libnode.so"));
}
}
void ThirdPartyQJS(ReadOnlyTargetRules Target)
{
PrivateDefinitions.Add("WITHOUT_INSPECTOR");
PrivateDefinitions.Add("WITH_QUICKJS");
PublicIncludePaths.AddRange(new string[] { Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "quickjs", "Inc") });
string LibraryPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "ThirdParty", "quickjs", "Lib"));
if (Target.Platform == UnrealTargetPlatform.Win64)
{
string V8LibraryPath = Path.Combine(LibraryPath, "Win64MD");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "quickjs.dll.lib"));
AddRuntimeDependencies(new string[]
{
"libgcc_s_seh-1.dll",
"libwinpthread-1.dll",
"msys-quickjs.dll"
}, V8LibraryPath, true);
}
else if (Target.Platform == UnrealTargetPlatform.Android)
{
string V8LibraryPath = Path.Combine(LibraryPath, "Android", "armeabi-v7a");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libquickjs.a"));
V8LibraryPath = Path.Combine(LibraryPath, "Android", "arm64-v8a");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libquickjs.a"));
}
else if (Target.Platform == UnrealTargetPlatform.Mac)
{
// PublicFrameworks.AddRange(new string[] { "WebKit", "JavaScriptCore" });
PublicFrameworks.AddRange(new string[] { "WebKit" });
string V8LibraryPath = Path.Combine(LibraryPath, "macOS");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libquickjs.a"));
}
else if (Target.Platform == UnrealTargetPlatform.IOS)
{
PublicFrameworks.AddRange(new string[] { "WebKit" });
string V8LibraryPath = Path.Combine(LibraryPath, "iOS", "arm64");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libquickjs.a"));
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
string V8LibraryPath = Path.Combine(LibraryPath, "Linux");
PublicAdditionalLibraries.Add(Path.Combine(V8LibraryPath, "libquickjs.a"));
}
}
private static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs)
{
DirectoryInfo dir = new DirectoryInfo(sourceDirName);
if (!dir.Exists)
{
throw new DirectoryNotFoundException(
"Source directory does not exist or could not be found: "
+ sourceDirName);
}
if (!Directory.Exists(destDirName))
{
Directory.CreateDirectory(destDirName);
}
// Get the files in the directory and copy them to the new location.
FileInfo[] files = dir.GetFiles();
foreach (FileInfo file in files)
{
string temppath = Path.Combine(destDirName, file.Name);
file.CopyTo(temppath, true);
}
if (copySubDirs)
{
DirectoryInfo[] dirs = dir.GetDirectories();
foreach (DirectoryInfo subdir in dirs)
{
string temppath = Path.Combine(destDirName, subdir.Name);
DirectoryCopy(subdir.FullName, temppath, copySubDirs);
}
}
}
}