-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmake.ps1
More file actions
89 lines (75 loc) · 2.63 KB
/
make.ps1
File metadata and controls
89 lines (75 loc) · 2.63 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
77
78
79
80
81
82
83
84
85
86
87
88
89
param(
[string] $renderLibVersion = "0.3.2",
[string] $localRenderLibPath = $null
)
function Ensure-Dir {
param(
[string] $path
)
New-Item -ItemType Directory -Force $path > $null
}
if ($localRenderLibPath)
{
echo "Using local prebuilt Embree from $localRenderLibPath"
Remove-Item -Recurse -Force ./prebuilt
Copy-Item -Force -Recurse -Path $localRenderLibPath -Destination ./prebuilt
}
elseif (-not(Test-Path -Path "prebuilt" -PathType Container))
{
# Download the prebuilt binaries for TBB and Embree from GitHub
Invoke-WebRequest -Uri "https://github.com/pgrit/RenderLibs/releases/download/v$renderLibVersion/RenderLibs-v$renderLibVersion.zip" -OutFile "prebuilt.zip"
Expand-Archive "prebuilt.zip" -DestinationPath ./prebuilt
rm prebuilt.zip
}
# Copy the shared libraries to the Runtimes folder for packaging in .NET
Ensure-Dir runtimes
Ensure-Dir runtimes/linux-x64
Ensure-Dir runtimes/linux-x64/native
cp prebuilt/linux/lib/libembree4.so.4 runtimes/linux-x64/native/
cp prebuilt/linux/lib/libtbb.so.12.12 runtimes/linux-x64/native/libtbb.so.12
Ensure-Dir runtimes/win-x64
Ensure-Dir runtimes/win-x64/native
cp prebuilt/win/bin/embree4.dll runtimes/win-x64/native/
cp prebuilt/win/bin/tbb12.dll runtimes/win-x64/native/
Ensure-Dir runtimes/osx-x64
Ensure-Dir runtimes/osx-x64/native
cp prebuilt/osx/lib/libembree4.4.dylib runtimes/osx-x64/native/
cp prebuilt/osx/lib/libtbb.12.12.dylib runtimes/osx-x64/native/libtbb.12.dylib
Ensure-Dir runtimes/osx-arm64
Ensure-Dir runtimes/osx-arm64/native
cp prebuilt/osx-arm64/lib/libembree4.4.dylib runtimes/osx-arm64/native/
cp prebuilt/osx-arm64/lib/libtbb.12.12.dylib runtimes/osx-arm64/native/libtbb.12.dylib
Ensure-Dir build
cd build
try
{
if ([environment]::OSVersion::IsMacOS())
{
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64" ..
if (-not $?) { throw "CMake configure failed" }
cmake --build . --config Release
if (-not $?) { throw "Build failed" }
# Empty the build folder first to avoid cache issues
rm -rf *
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="arm64" ..
if (-not $?) { throw "CMake configure failed" }
cmake --build . --config Release
if (-not $?) { throw "Build failed" }
}
else
{
cmake -DCMAKE_BUILD_TYPE=Release ..
if (-not $?) { throw "CMake configure failed" }
cmake --build . --config Release
if (-not $?) { throw "Build failed" }
}
}
finally
{
cd ..
}
# Test the C# wrapper
dotnet build
if (-not $?) { throw "Build failed" }
dotnet test
if (-not $?) { throw "Tests failed" }