Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified app/src/legacyXr/assets/gamenative_openxr_runtime32.dll
Binary file not shown.
Binary file modified app/src/legacyXr/assets/gamenative_openxr_runtime64.dll
Binary file not shown.
8 changes: 7 additions & 1 deletion app/src/legacyXr/assets/payload.version
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
3 fb4792ecc21725bec26e3e1754af6c954b39e0f641192d257e578629dea9c92c eb77fcd88b7a93c1fd28e8aaa05b22d0d454a11ebf488743cb4008a058d93e8e
schema 4
gamenative_openxr_runtime64.dll fb33c0718d08fa66219615c0b5e45e419d2b8edec002db664b4738de335bcd95
gamenative_openxr_runtime32.dll 3df91ab0b2cc6fc6f5ef50ffe1d1f232df03ce71e3a8a4a78e891511a790c5db
gamenative_xr_unixbridge.dll 669db5bc31a3437693925b07a897594b4f2b40a57c2ea169a5f9c4fbf0d78abe
gamenative_xr_unixbridge32.dll 31bfc6815873e513991563bd781dc3a3272b8c13b78a66e9f9b8d7eb7509875e
gamenative_xr_unixbridge.so e4e1cb74f4ee1a068e52fa81582e8cf206ea91fa574f51f545d3cc18a00ee9e0
opencomposite_x64.dll 827ad85f3606a4dc4a8f5561a8ca69e4c6c1b5d2b9cd3315a461b9270b08242c
Binary file modified app/src/modernXr/assets/gamenative_openxr_runtime32.dll
Binary file not shown.
Binary file modified app/src/modernXr/assets/gamenative_openxr_runtime64.dll
Binary file not shown.
8 changes: 7 additions & 1 deletion app/src/modernXr/assets/payload.version
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
3 fb4792ecc21725bec26e3e1754af6c954b39e0f641192d257e578629dea9c92c eb77fcd88b7a93c1fd28e8aaa05b22d0d454a11ebf488743cb4008a058d93e8e
schema 4
gamenative_openxr_runtime64.dll fb33c0718d08fa66219615c0b5e45e419d2b8edec002db664b4738de335bcd95
gamenative_openxr_runtime32.dll 3df91ab0b2cc6fc6f5ef50ffe1d1f232df03ce71e3a8a4a78e891511a790c5db
gamenative_xr_unixbridge.dll 669db5bc31a3437693925b07a897594b4f2b40a57c2ea169a5f9c4fbf0d78abe
gamenative_xr_unixbridge32.dll 31bfc6815873e513991563bd781dc3a3272b8c13b78a66e9f9b8d7eb7509875e
gamenative_xr_unixbridge.so e4e1cb74f4ee1a068e52fa81582e8cf206ea91fa574f51f545d3cc18a00ee9e0
opencomposite_x64.dll 827ad85f3606a4dc4a8f5561a8ca69e4c6c1b5d2b9cd3315a461b9270b08242c
21 changes: 14 additions & 7 deletions tools/build-windows-xr-runtime.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
param(
[ValidateSet("Release", "Debug")]
[string]$Configuration = "Release"
)

Expand Down Expand Up @@ -38,11 +39,14 @@ foreach ($architecture in @("x64", "x86")) {
}
}

# Freestanding prevents builtin memory-loop recognition from making our CRT-less
# memcpy/memset implementations call themselves. Keep normal floating-point semantics.
$optimization = if ($Configuration -eq "Release") { "-O2" } else { "-O0" }
$runtimeSource = Join-Path $source "gamenative_openxr_runtime.c"
$runtime64 = Join-Path $build "gamenative_openxr_runtime64.dll"
$runtime32 = Join-Path $build "gamenative_openxr_runtime32.dll"
Invoke-Tool { & $clang --target=x86_64-w64-windows-gnu -shared -nostdlib "-Wl,-e,DllMain" -I $include -o $runtime64 $runtimeSource (Join-Path $source "gamenative_openxr_runtime_x64.def") $imports["ws2_32-x64"] $imports["kernel32-x64"] $imports["ntdll-x64"] $imports["dxgi-x64"] } "x64 OpenXR runtime"
Invoke-Tool { & $clang --target=i686-w64-windows-gnu -shared -nostdlib "-Wl,-e,DllMain" -I $include -o $runtime32 $runtimeSource (Join-Path $source "gamenative_openxr_runtime_x86.def") $imports["ws2_32-x86"] $imports["kernel32-x86"] $imports["ntdll-x86"] $imports["dxgi-x86"] } "x86 OpenXR runtime"
Invoke-Tool { & $clang --target=x86_64-w64-windows-gnu -shared -nostdlib -ffreestanding $optimization "-Wl,-e,DllMain" -I $include -o $runtime64 $runtimeSource (Join-Path $source "gamenative_openxr_runtime_x64.def") $imports["ws2_32-x64"] $imports["kernel32-x64"] $imports["ntdll-x64"] $imports["dxgi-x64"] } "x64 OpenXR runtime"
Invoke-Tool { & $clang --target=i686-w64-windows-gnu -shared -nostdlib -ffreestanding $optimization "-Wl,-e,DllMain" -I $include -o $runtime32 $runtimeSource (Join-Path $source "gamenative_openxr_runtime_x86.def") $imports["ws2_32-x86"] $imports["kernel32-x86"] $imports["ntdll-x86"] $imports["dxgi-x86"] } "x86 OpenXR runtime"

function Assert-Machine {
param([string]$Path, [int]$Expected)
Expand All @@ -53,8 +57,11 @@ function Assert-Machine {
}
Assert-Machine $runtime64 0x8664
Assert-Machine $runtime32 0x014c
Copy-Item -Force -LiteralPath $runtime64 -Destination (Join-Path $output "gamenative_openxr_runtime64.dll")
Copy-Item -Force -LiteralPath $runtime32 -Destination (Join-Path $output "gamenative_openxr_runtime32.dll")
$hash64 = (Get-FileHash -Algorithm SHA256 -LiteralPath $runtime64).Hash.ToLowerInvariant()
$hash32 = (Get-FileHash -Algorithm SHA256 -LiteralPath $runtime32).Hash.ToLowerInvariant()
Set-Content -NoNewline -LiteralPath (Join-Path $output "payload.version") -Value "3 $hash64 $hash32"
foreach ($flavor in @("modernXr", "legacyXr")) {
$assets = Join-Path $repository "app\src\$flavor\assets"
New-Item -ItemType Directory -Force -Path $assets | Out-Null
Copy-Item -Force -LiteralPath $runtime64 -Destination (Join-Path $assets "gamenative_openxr_runtime64.dll")
Copy-Item -Force -LiteralPath $runtime32 -Destination (Join-Path $assets "gamenative_openxr_runtime32.dll")
}
& (Join-Path $PSScriptRoot "verify-xr-payload.ps1")
Copy-Item -Force -LiteralPath (Join-Path $output "payload.version") -Destination (Join-Path $repository "app\src\legacyXr\assets\payload.version")
6 changes: 3 additions & 3 deletions tools/build-xr-payload-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ for lib in ws2_32 kernel32 ntdll dxgi; do
"$bin/llvm-dlltool" -m i386 -k -d "$source_dir/${lib}_x86.def" -l "$work/lib${lib}_x86.a"
done

# The two OpenXR runtime DLLs (CRT-less PE, built with the NDK's clang).
"$bin/clang" --target=x86_64-w64-windows-gnu -shared -nostdlib -Wl,-e,DllMain -I "$work/inc" \
# Release optimization; freestanding keeps our CRT-less memory helpers from recursing.
"$bin/clang" --target=x86_64-w64-windows-gnu -shared -nostdlib -ffreestanding -O2 -Wl,-e,DllMain -I "$work/inc" \
-o "$output/gamenative_openxr_runtime64.dll" \
"$source_dir/gamenative_openxr_runtime.c" "$source_dir/gamenative_openxr_runtime_x64.def" \
"$work/libws2_32_x64.a" "$work/libkernel32_x64.a" "$work/libntdll_x64.a" "$work/libdxgi_x64.a"
"$bin/clang" --target=i686-w64-windows-gnu -shared -nostdlib -Wl,-e,DllMain -I "$work/inc" \
"$bin/clang" --target=i686-w64-windows-gnu -shared -nostdlib -ffreestanding -O2 -Wl,-e,DllMain -I "$work/inc" \
-o "$output/gamenative_openxr_runtime32.dll" \
"$source_dir/gamenative_openxr_runtime.c" "$source_dir/gamenative_openxr_runtime_x86.def" \
"$work/libws2_32_x86.a" "$work/libkernel32_x86.a" "$work/libntdll_x86.a" "$work/libdxgi_x86.a"
Expand Down
Loading