From d1ab2550250372af64038d7022efb609f1b7c5fb Mon Sep 17 00:00:00 2001 From: Ron Bessems Date: Wed, 28 Feb 2024 12:13:07 -0800 Subject: [PATCH] Resolve issue 125 --- .github/workflows/build-host-windows.yml | 1 - Chapter1/CMakeLists.txt | 1 + Chapter2/CMakeLists.txt | 1 + Chapter3/CMakeLists.txt | 1 + Chapter4/CMakeLists.txt | 1 + Chapter5/CMakeLists.txt | 1 + Chapter6_1_Multiview/Chapter6/CMakeLists.txt | 1 + GraphicsAPI_Test/CMakeLists.txt | 2 +- GraphicsAPI_Test/main.cpp | 6 ++++++ 9 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-host-windows.yml b/.github/workflows/build-host-windows.yml index afe7ec4..dbd7c45 100644 --- a/.github/workflows/build-host-windows.yml +++ b/.github/workflows/build-host-windows.yml @@ -8,7 +8,6 @@ on: jobs: build: - if: false name: Windows Build runs-on: ${{matrix.os}} strategy: diff --git a/Chapter1/CMakeLists.txt b/Chapter1/CMakeLists.txt index a79aa61..05cd680 100644 --- a/Chapter1/CMakeLists.txt +++ b/Chapter1/CMakeLists.txt @@ -158,6 +158,7 @@ else() # Windows / Linux # OpenGL include(../cmake/gfxwrapper.cmake) if(TARGET openxr-gfxwrapper) + target_include_directories(${PROJECT_NAME} PUBLIC ${openxr_SOURCE_DIR}/src/common) target_link_libraries(${PROJECT_NAME} openxr-gfxwrapper) target_compile_definitions(${PROJECT_NAME} PUBLIC XR_TUTORIAL_USE_OPENGL) endif() diff --git a/Chapter2/CMakeLists.txt b/Chapter2/CMakeLists.txt index 0da9769..0109904 100644 --- a/Chapter2/CMakeLists.txt +++ b/Chapter2/CMakeLists.txt @@ -99,6 +99,7 @@ if (ANDROID) # Android # XR_DOCS_TAG_BEGIN_Gfxwrapper include(../cmake/gfxwrapper.cmake) if(TARGET openxr-gfxwrapper) + target_include_directories(${PROJECT_NAME} PUBLIC ${openxr_SOURCE_DIR}/src/common) target_link_libraries(${PROJECT_NAME} openxr-gfxwrapper) target_compile_definitions(${PROJECT_NAME} PUBLIC XR_TUTORIAL_USE_OPENGL_ES) endif() diff --git a/Chapter3/CMakeLists.txt b/Chapter3/CMakeLists.txt index 34307d8..490d538 100644 --- a/Chapter3/CMakeLists.txt +++ b/Chapter3/CMakeLists.txt @@ -115,6 +115,7 @@ if (ANDROID) # Android # XR_DOCS_TAG_BEGIN_Gfxwrapper include(../cmake/gfxwrapper.cmake) if(TARGET openxr-gfxwrapper) + target_include_directories(${PROJECT_NAME} PUBLIC ${openxr_SOURCE_DIR}/src/common) target_link_libraries(${PROJECT_NAME} openxr-gfxwrapper) target_compile_definitions(${PROJECT_NAME} PUBLIC XR_TUTORIAL_USE_OPENGL_ES) endif() diff --git a/Chapter4/CMakeLists.txt b/Chapter4/CMakeLists.txt index effde88..36e0e79 100644 --- a/Chapter4/CMakeLists.txt +++ b/Chapter4/CMakeLists.txt @@ -218,6 +218,7 @@ else() # Windows / Linux # OpenGL include(../cmake/gfxwrapper.cmake) if(TARGET openxr-gfxwrapper) + target_include_directories(${PROJECT_NAME} PUBLIC ${openxr_SOURCE_DIR}/src/common) target_link_libraries(${PROJECT_NAME} openxr-gfxwrapper) target_compile_definitions(${PROJECT_NAME} PUBLIC XR_TUTORIAL_USE_OPENGL) endif() diff --git a/Chapter5/CMakeLists.txt b/Chapter5/CMakeLists.txt index 2063055..bdf7846 100644 --- a/Chapter5/CMakeLists.txt +++ b/Chapter5/CMakeLists.txt @@ -115,6 +115,7 @@ if (ANDROID) # Android # XR_DOCS_TAG_BEGIN_Gfxwrapper include(../cmake/gfxwrapper.cmake) if(TARGET openxr-gfxwrapper) + target_include_directories(${PROJECT_NAME} PUBLIC ${openxr_SOURCE_DIR}/src/common) target_link_libraries(${PROJECT_NAME} openxr-gfxwrapper) target_compile_definitions(${PROJECT_NAME} PUBLIC XR_TUTORIAL_USE_OPENGL_ES) endif() diff --git a/Chapter6_1_Multiview/Chapter6/CMakeLists.txt b/Chapter6_1_Multiview/Chapter6/CMakeLists.txt index e4c931b..6239ca7 100644 --- a/Chapter6_1_Multiview/Chapter6/CMakeLists.txt +++ b/Chapter6_1_Multiview/Chapter6/CMakeLists.txt @@ -128,6 +128,7 @@ if (ANDROID) # Android # XR_DOCS_TAG_BEGIN_Gfxwrapper include(../cmake/gfxwrapper.cmake) if(TARGET openxr-gfxwrapper) + target_include_directories(${PROJECT_NAME} PUBLIC ${openxr_SOURCE_DIR}/src/common) target_link_libraries(${PROJECT_NAME} openxr-gfxwrapper) target_compile_definitions(${PROJECT_NAME} PUBLIC XR_TUTORIAL_USE_OPENGL_ES) endif() diff --git a/GraphicsAPI_Test/CMakeLists.txt b/GraphicsAPI_Test/CMakeLists.txt index 517c11e..30cf2f9 100644 --- a/GraphicsAPI_Test/CMakeLists.txt +++ b/GraphicsAPI_Test/CMakeLists.txt @@ -72,7 +72,7 @@ if (Vulkan_FOUND) endif() # Fix redirection to a different project's build folder -target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/../Chapter2/openxr/src/common) +target_include_directories(${PROJECT_NAME} PUBLIC ${openxr_SOURCE_DIR}/src/common) target_link_libraries(${PROJECT_NAME} openxr-gfxwrapper) target_compile_definitions(${PROJECT_NAME} PUBLIC XR_TUTORIAL_USE_OPENGL) diff --git a/GraphicsAPI_Test/main.cpp b/GraphicsAPI_Test/main.cpp index e0c5534..fd01a59 100644 --- a/GraphicsAPI_Test/main.cpp +++ b/GraphicsAPI_Test/main.cpp @@ -237,7 +237,9 @@ int main() { } else if (apiType == D3D12) { graphicsAPI = new GraphicsAPI_D3D12(); } else if (apiType == VULKAN) { +#ifdef XR_TUTORIAL_USE_VULKAN graphicsAPI = new GraphicsAPI_Vulkan(); +#endif } else { return -1; } @@ -255,7 +257,11 @@ int main() { // Swapchain const uint32_t swapchainCount = 3; +#ifdef XR_TUTORIAL_USE_VULKAN swapchainFormat = apiType == VULKAN ? VK_FORMAT_B8G8R8A8_UNORM : DXGI_FORMAT_B8G8R8A8_UNORM; +#else + swapchainFormat = DXGI_FORMAT_B8G8R8A8_UNORM; +#endif void *swapchain = graphicsAPI->CreateDesktopSwapchain({width, height, swapchainCount, window, swapchainFormat, false}); void *swapchainImages[swapchainCount] = {nullptr, nullptr, nullptr}; void *swapchainImageViews[swapchainCount] = {nullptr, nullptr, nullptr};