From 2d04b19fc9021592ef37538db2ea0e4e71cc4d44 Mon Sep 17 00:00:00 2001 From: Razakhel Date: Fri, 15 Nov 2024 18:29:43 +0100 Subject: [PATCH] [CMake] Fixed XR-related files compilation on first generation - As RAZ_USE_WINDOW was defined past its usage to add XR files, they weren't added until the second CMake call - Fixed an unused variable warning on `eyeStr` --- CMakeLists.txt | 22 ++++++++++------------ src/RaZ/XR/XrSession.cpp | 6 +++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97cca98c..bc90ec30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,18 +239,6 @@ set( include/RaZ/Utils/*.inl ) -if (NOT RAZ_PLATFORM_MAC AND NOT RAZ_USE_EMSCRIPTEN AND RAZ_USE_WINDOW) - # XR currently isn't available with macOS or Emscripten and requires windowing capabilities - # TODO: this makes XR unavailable from the GUI editor - list( - APPEND - RAZ_SRC - - src/RaZ/XR/*.cpp - include/RaZ/XR/*.hpp - ) -endif () - # Adding every file to be compiled file( GLOB @@ -473,6 +461,16 @@ endif () if (NOT RAZ_PLATFORM_MAC AND NOT RAZ_USE_EMSCRIPTEN AND RAZ_USE_WINDOW) # XR currently isn't available with macOS or Emscripten and requires windowing capabilities # TODO: requiring windowing currently makes XR unavailable from the GUI editor, as it handles the windowing part on its own + + file( + GLOB + RAZ_XR_FILES + + "${PROJECT_SOURCE_DIR}/src/RaZ/XR/*.cpp" + "${PROJECT_SOURCE_DIR}/include/RaZ/XR/*.hpp" + ) + list(APPEND RAZ_FILES ${RAZ_XR_FILES}) + target_link_libraries(RaZ PRIVATE OpenXR) else () list(REMOVE_ITEM RAZ_FILES "${PROJECT_SOURCE_DIR}/src/RaZ/Script/LuaXr.cpp") diff --git a/src/RaZ/XR/XrSession.cpp b/src/RaZ/XR/XrSession.cpp index c03e4756..d174831b 100644 --- a/src/RaZ/XR/XrSession.cpp +++ b/src/RaZ/XR/XrSession.cpp @@ -423,9 +423,9 @@ bool XrSession::renderLayer(RenderLayerInfo& layerInfo, layerInfo.layerProjectionViews.resize(viewCount, { XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW }); for (uint32_t viewIndex = 0; viewIndex < viewCount; ++viewIndex) { - const char* eyeStr = (viewCount == 1 ? "Single view" - : (viewIndex == 0 ? "Left eye" - : "Right eye")); + [[maybe_unused]] const char* eyeStr = (viewCount == 1 ? "Single view" + : (viewIndex == 0 ? "Left eye" + : "Right eye")); ZoneTransientN(cpuEyeZone, eyeStr, true);