-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup CMake finding of Vulkan & installation code
Adds extensive integration tests that exercise the various ways of finding the Vulkan-Headers. vk-bootstrap should now use the Vulkan-Headers or Vulkan::Headers targets if they were already defined (such as is the case of FetchContent), and will look for the VulkanHeaders package and Vulkan package as a fallback, and will FetchContent Vulkan-Headers directly if that fails. This should make integration seamless with the various ways vulkan-headers is acquired. The vk-bootstrap-vulkan-headers target was dropped in favor of directly linking to Vulkan-Headers (creating a target by that name if none exists).
- Loading branch information
1 parent
83826b9
commit b85733b
Showing
5 changed files
with
209 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
cmake_minimum_required(VERSION 3.14.2) | ||
|
||
project(IntegrationTests LANGUAGES CXX) | ||
|
||
if (VULKAN_HEADER_VERSION_GIT_TAG) | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
VulkanHeadersIntegrationTest | ||
GIT_REPOSITORY https://github.com/KhronosGroup/Vulkan-Headers | ||
GIT_TAG ${VULKAN_HEADER_VERSION_GIT_TAG} | ||
) | ||
FetchContent_MakeAvailable(VulkanHeadersIntegrationTest) | ||
|
||
if (NOT TARGET Vulkan-Headers) | ||
message(FATAL_ERROR "Vulkan-Headers target not defined") | ||
endif() | ||
endif() | ||
|
||
if (FIND_PACKAGE_VULKAN_HEADERS) | ||
find_package(Vulkan-Headers REQUIRED) | ||
endif() | ||
|
||
if (FIND_PACKAGE_VULKAN) | ||
find_package(Vulkan REQUIRED) | ||
endif() | ||
|
||
if (ADD_SUBDIRECTORY_TESTING) | ||
add_subdirectory(../.. ${CMAKE_CURRENT_BINARY_DIR}/vk-bootstrap) | ||
endif() | ||
|
||
if (FIND_PACKAGE_TESTING) | ||
find_package(vk-bootstrap CONFIG REQUIRED) | ||
endif() | ||
|
||
if (NOT TARGET vk-bootstrap::vk-bootstrap) | ||
message(FATAL_ERROR "vk-bootstrap::vk-bootstrap target not defined") | ||
endif() | ||
|
||
add_executable(integration_test integration_test.cpp) | ||
target_link_libraries(integration_test vk-bootstrap::vk-bootstrap) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "VkBootstrap.h" | ||
|
||
int main() { | ||
[[maybe_unused]] vkb::InstanceBuilder builder{}; | ||
return 0; | ||
} |