Skip to content

Commit

Permalink
Merge pull request #249 from rpavlik/fix-multiconfig-ninja
Browse files Browse the repository at this point in the history
cmake: Fix multi-config Ninja in OpenXR-SDK.
  • Loading branch information
rpavlik authored Apr 12, 2021
2 parents 68bc4a5 + 31aed42 commit 227a10a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changes/sdk/pr.249.gh.OpenXR-SDK-Source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- issue.231.gh.OpenXR-SDK-Source
---
loader: Fix building OpenXR-SDK with CMake's multi-config Ninja generator.
8 changes: 7 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,16 @@ set(GENERATED_OUTPUT)
set(GENERATED_DEPENDS)
run_xr_xml_generate(utility_source_generator.py xr_generated_dispatch_table.h)
run_xr_xml_generate(utility_source_generator.py xr_generated_dispatch_table.c)
add_custom_target(xr_global_generated_files DEPENDS ${GENERATED_DEPENDS})
if(GENERATED_DEPENDS)
add_custom_target(xr_global_generated_files DEPENDS ${GENERATED_DEPENDS})
else()
add_custom_target(xr_global_generated_files)
endif()

set_target_properties(xr_global_generated_files PROPERTIES FOLDER ${CODEGEN_FOLDER})

set(COMMON_GENERATED_OUTPUT ${GENERATED_OUTPUT})
set(COMMON_GENERATED_DEPENDS ${GENERATED_DEPENDS})
if(NOT MSVC)
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
Expand Down
5 changes: 4 additions & 1 deletion src/loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ endif()
# List of all files externally generated outside of the loader that the loader
# needs to build with.
set(LOADER_EXTERNAL_GEN_FILES ${COMMON_GENERATED_OUTPUT})
set(LOADER_EXTERNAL_GEN_DEPENDS ${COMMON_GENERATED_DEPENDS})
run_xr_xml_generate(loader_source_generator.py xr_generated_loader.hpp)
run_xr_xml_generate(loader_source_generator.py xr_generated_loader.cpp)

Expand Down Expand Up @@ -86,7 +87,9 @@ else()
endif()
set_target_properties(openxr_loader PROPERTIES FOLDER ${LOADER_FOLDER})

set_source_files_properties(${LOADER_EXTERNAL_GEN_FILES} PROPERTIES GENERATED TRUE)
if(LOADER_EXTERNAL_GEN_DEPENDS)
set_source_files_properties(${LOADER_EXTERNAL_GEN_DEPENDS} PROPERTIES GENERATED TRUE)
endif()
add_dependencies(openxr_loader generate_openxr_header xr_global_generated_files)
target_include_directories(
openxr_loader
Expand Down

0 comments on commit 227a10a

Please sign in to comment.