-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
76 lines (68 loc) · 2.06 KB
/
build.ps1
File metadata and controls
76 lines (68 loc) · 2.06 KB
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
param(
[ValidateSet("msvc", "gcc")]
[string]$compiler = "gcc",
[switch]$PPL
)
$buildDir = "build"
# Clean build directory
if (Test-Path $buildDir) {
Remove-Item -Path $buildDir -Recurse -Force
Start-Sleep -Milliseconds 100
}
New-Item -ItemType Directory -Path $buildDir -Force | Out-Null
# Compile
switch ($compiler) {
"gcc" {
Write-Host "Compiling with GCC (MinGW)..."
$compilerArgs = @(
"-std=c++23"
"-O3"
"-Isrc"
"-Iexternal"
"-Iexternal/tinyexr"
"-Iexternal/oneapi-tbb-2022_1_0/include"
"src/main.cpp"
"-Lexternal/oneapi-tbb-2022_1_0/lib/mingw-w64-ucrt-x86_64"
"-o"
"$buildDir/main.exe"
"-ltbb12"
"-lz" # zlib for tinyexr
)
$compileResult = & g++ @compilerArgs
Copy-Item "external/oneapi-tbb-2022_1_0/redist/mingw-w64-ucrt-x86_64/libtbb12.dll" "$buildDir"
}
"msvc" {
Write-Host "Compiling with MSVC and $(if ($PPL) { 'PPL' } else { 'TBB' })..."
$compilerArgs = @(
"/O2"
"/std:c++20"
"/utf-8"
"/EHsc"
"/Isrc"
"/Iexternal"
"-Iexternal/tinyexr"
$(if ($PPL) { "/DPPL" } else { "/Iexternal/oneapi-tbb-2022_1_0/include" })
"src/main.cpp"
"external/tinyexr/miniz.c"
"/Fe:$buildDir/main.exe"
)
if (!$PPL) {
$compilerArgs += @(
"/link"
"/LIBPATH:external/oneapi-tbb-2022_1_0/lib/intel64/vc14"
"tbb12.lib"
)
}
$compileResult = & cl @compilerArgs
if ( !$PPL ) {
Copy-Item "external/oneapi-tbb-2022_1_0/redist/intel64/vc14/tbb12.dll" "$buildDir"
}
}
}
if ($LASTEXITCODE -ne 0) {
Write-Error "Compilation failed: $compileResult"
exit 1
}
# Copy assets
Copy-Item "assets" "$buildDir" -Recurse -Force
Write-Host "Build successful!" -ForegroundColor Green