Skip to content

Commit 6d6683b

Browse files
authored
Remove OpenXR dependencies (#1521)
The OpenXR dependency used by Windows builds needs to be updated to work without errors when using CMake 4, but XR is not supported on Windows anymore so there is no easy way to test the changes. To fix this issue, this change removes XR support on Windows and removes the OpenXR dependencies since they are only being used on Windows (Android and iOS use different XR implementations).
1 parent c5c12e4 commit 6d6683b

18 files changed

+8
-3370
lines changed

Apps/Playground/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ elseif(WINDOWS_STORE)
9393
${APPX_ASSETS}
9494
"UWP/App.cpp"
9595
"UWP/App.h")
96-
set(ADDITIONAL_LIBRARIES PRIVATE NativeXr)
9796
elseif(WIN32)
9897
set(SOURCES
9998
${SOURCES}
@@ -104,7 +103,7 @@ elseif(WIN32)
104103
"Win32/Resource.h"
105104
"Win32/small.ico"
106105
"Win32/targetver.h")
107-
set(ADDITIONAL_LIBRARIES PRIVATE NativeXr NativeCamera)
106+
set(ADDITIONAL_LIBRARIES PRIVATE NativeCamera)
108107
endif()
109108

110109
if(WIN32)

Apps/Playground/UWP/App.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <Babylon/ScriptLoader.h>
55
#include <Babylon/Plugins/NativeEngine.h>
66
#include <Babylon/Plugins/NativeOptimizations.h>
7-
#include <Babylon/Plugins/NativeXr.h>
87
#include <Babylon/Polyfills/Console.h>
98
#include <Babylon/Polyfills/Window.h>
109
#include <Babylon/Polyfills/XMLHttpRequest.h>
@@ -401,8 +400,6 @@ void App::RestartRuntime(Windows::Foundation::Rect bounds)
401400

402401
Babylon::Plugins::NativeOptimizations::Initialize(env);
403402

404-
Babylon::Plugins::NativeXr::Initialize(env);
405-
406403
m_nativeInput = &Babylon::Plugins::NativeInput::CreateForJavaScript(env);
407404
});
408405

Apps/Playground/Win32/App.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <Babylon/Plugins/NativeCapture.h>
1818
#include <Babylon/Plugins/NativeEngine.h>
1919
#include <Babylon/Plugins/NativeOptimizations.h>
20-
#include <Babylon/Plugins/NativeXr.h>
2120
#include <Babylon/Plugins/NativeCamera.h>
2221
#include <Babylon/Plugins/NativeInput.h>
2322
#include <Babylon/Plugins/TestUtils.h>
@@ -191,8 +190,6 @@ namespace
191190

192191
Babylon::Plugins::NativeCamera::Initialize(env);
193192

194-
Babylon::Plugins::NativeXr::Initialize(env);
195-
196193
nativeInput = &Babylon::Plugins::NativeInput::CreateForJavaScript(env);
197194

198195
Babylon::Plugins::TestUtils::Initialize(env, hWnd);

CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ FetchContent_Declare(ios-cmake
3838
FetchContent_Declare(JsRuntimeHost
3939
GIT_REPOSITORY https://github.com/BabylonJS/JsRuntimeHost.git
4040
GIT_TAG c64c8a8cfc95b187e9547b165f02633909568c22)
41-
FetchContent_Declare(OpenXR-MixedReality
42-
GIT_REPOSITORY https://github.com/microsoft/OpenXR-MixedReality.git
43-
GIT_TAG 67424511525b96a36847f2a96d689d99e5879503)
44-
FetchContent_Declare(OpenXR-SDK
45-
GIT_REPOSITORY https://github.com/KhronosGroup/OpenXR-SDK.git
46-
GIT_TAG 458984d7f59d1ae6dc1b597d94b02e4f7132eaba)
4741
FetchContent_Declare(SPIRV-Cross
4842
GIT_REPOSITORY https://github.com/BabylonJS/SPIRV-Cross.git
4943
GIT_TAG 6abfcf066d171e9ade7604d91381ebebe4209edc)

Dependencies/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ endif()
189189
# --------------------------------------------------
190190
# xr
191191
# --------------------------------------------------
192-
# Currently supported on Windows via OpenXR, Android via ARCore, and iOS via ARKit.
193-
if(BABYLON_NATIVE_PLUGIN_NATIVEXR AND (WIN32 OR ANDROID OR IOS))
192+
# Currently supported on Android via ARCore, and iOS via ARKit.
193+
if(BABYLON_NATIVE_PLUGIN_NATIVEXR AND (ANDROID OR IOS))
194194
add_subdirectory(xr)
195195
set_property(TARGET xr PROPERTY FOLDER Dependencies/xr)
196196
warnings_as_errors(xr)

Dependencies/xr/CMakeLists.txt

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@ endif()
2424

2525
project(xr)
2626

27-
28-
if(WIN32)
29-
# Avoid picking up system installed jsoncpp in favor of source distributed with openxr_loader project
30-
set(BUILD_WITH_SYSTEM_JSONCPP OFF BOOL "disable using system installed jsoncpp")
31-
FetchContent_MakeAvailable_With_Message(OpenXR-SDK OpenXR-MixedReality)
32-
33-
set_property(TARGET openxr_loader PROPERTY FOLDER Dependencies/xr/OpenXR)
34-
set_property(TARGET generate_openxr_header PROPERTY FOLDER Dependencies/xr/OpenXR/Generated)
35-
set_property(TARGET xr_global_generated_files PROPERTY FOLDER Dependencies/xr/OpenXR/Generated)
36-
set_property(TARGET uninstall PROPERTY FOLDER Dependencies/xr/OpenXR/Generated)
37-
endif()
38-
3927
set(DYNAMIC_LOADER OFF CACHE BOOL "Build the loader as a .dll library")
4028

4129
set(SOURCES "Include/XR.h"
@@ -49,26 +37,6 @@ elseif (IOS)
4937
set(SOURCES ${SOURCES}
5038
"Source/ARKit/Include/IXrContextARKit.h"
5139
"Source/ARKit/XR.mm")
52-
else()
53-
set(SOURCES ${SOURCES}
54-
"Source/OpenXR/XR.cpp")
55-
56-
if(WIN32)
57-
set(SOURCES ${SOURCES} "Source/OpenXR/Windows/XrPlatform.h")
58-
else()
59-
message(FATAL_ERROR "OpenXR support not available for platform ${CMAKE_SYSTEM_NAME}")
60-
endif()
61-
62-
set(SOURCES ${SOURCES}
63-
"Source/OpenXR/Include/IXrContextOpenXR.h"
64-
"Source/OpenXR/XrPlatformCommon.h"
65-
"Source/OpenXR/XrRegistry.h"
66-
"Source/OpenXR/XrSupportedExtensions.h"
67-
"Source/OpenXR/SceneUnderstanding.h"
68-
"Source/OpenXR/SceneUnderstanding.cpp"
69-
"Source/OpenXR/XrInput.h"
70-
"Source/OpenXR/XrInput.cpp")
71-
set_property(TARGET openxr_loader PROPERTY UNITY_BUILD false)
7240
endif()
7341

7442
add_library(xr ${SOURCES})
@@ -95,20 +63,6 @@ if (ANDROID)
9563
target_link_libraries(xr PRIVATE glm arcore AndroidExtensions)
9664
elseif (IOS)
9765
target_link_libraries(xr PRIVATE "-framework ARKit")
98-
else()
99-
if(WIN32)
100-
target_include_directories(xr PRIVATE "Source/OpenXR/Windows")
101-
endif()
102-
103-
target_include_directories(xr PRIVATE "${openxr-mixedreality_SOURCE_DIR}/openxr_preview/include")
104-
target_include_directories(xr PRIVATE "${openxr-mixedreality_SOURCE_DIR}/shared")
105-
target_include_directories(xr PRIVATE "Source/OpenXR")
106-
107-
target_include_directories(xrInternal INTERFACE "${openxr-mixedreality_SOURCE_DIR}/openxr_preview/include")
108-
target_include_directories(xrInternal INTERFACE "${openxr-mixedreality_SOURCE_DIR}/shared")
109-
target_include_directories(xrInternal INTERFACE "Source/OpenXR")
110-
111-
target_link_libraries(xr PRIVATE openxr_loader)
11266
endif()
11367

11468
target_link_libraries(xr

Dependencies/xr/Source/OpenXR/Include/IXrContextOpenXR.h

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)