Skip to content

Commit

Permalink
[CMake] Fixed XR-related files compilation on first generation
Browse files Browse the repository at this point in the history
- 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`
  • Loading branch information
Razakhel committed Nov 15, 2024
1 parent 2586810 commit 2d04b19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
22 changes: 10 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions src/RaZ/XR/XrSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2d04b19

Please sign in to comment.