Mark vk-bootstrap as static & cleanup CMake

Marks the main vk-bootstrap library as a static library.

Removes unnecessary code, adds a language & description to the project
field.
This commit is contained in:
Charles Giessen 2023-09-24 18:48:10 -06:00 committed by Charles Giessen
parent 83ef1035bf
commit f6006041c6
3 changed files with 39 additions and 37 deletions

View File

@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(VulkanBootstrap) project(VulkanBootstrap
LANGUAGES CXX
DESCRIPTION "A Vulkan utility library to ease the initialization steps in Vulkan")
option(VK_BOOTSTRAP_DISABLE_WARNINGS "Disable warnings during compilation" OFF) option(VK_BOOTSTRAP_DISABLE_WARNINGS "Disable warnings during compilation" OFF)
option(VK_BOOTSTRAP_WERROR "Enable warnings as errors during compilation" OFF) option(VK_BOOTSTRAP_WERROR "Enable warnings as errors during compilation" OFF)
@ -30,7 +32,7 @@ else ()
endif() endif()
endif() endif()
add_library(vk-bootstrap src/VkBootstrap.h src/VkBootstrap.cpp src/VkBootstrapDispatch.h) add_library(vk-bootstrap STATIC src/VkBootstrap.h src/VkBootstrap.cpp src/VkBootstrapDispatch.h)
add_library(vk-bootstrap::vk-bootstrap ALIAS vk-bootstrap) add_library(vk-bootstrap::vk-bootstrap ALIAS vk-bootstrap)
add_library(vk-bootstrap-compiler-warnings INTERFACE) add_library(vk-bootstrap-compiler-warnings INTERFACE)
@ -78,11 +80,12 @@ target_compile_features(vk-bootstrap PUBLIC cxx_std_14)
include(GNUInstallDirs) include(GNUInstallDirs)
install(FILES src/VkBootstrap.h src/VkBootstrapDispatch.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(FILES src/VkBootstrap.h src/VkBootstrapDispatch.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS vk-bootstrap vk-bootstrap-compiler-warnings vk-bootstrap-vulkan-headers install(TARGETS
EXPORT vk-bootstrap-targets vk-bootstrap
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} vk-bootstrap-compiler-warnings
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} vk-bootstrap-vulkan-headers
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) EXPORT
vk-bootstrap-targets)
# By default, we want to only build tests if this repo is built standalone, but still should be configurable by the user # By default, we want to only build tests if this repo is built standalone, but still should be configurable by the user
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)

View File

@ -5,7 +5,7 @@ target_link_libraries(vk-bootstrap-triangle
vk-bootstrap vk-bootstrap
vk-bootstrap-compiler-warnings vk-bootstrap-compiler-warnings
vk-bootstrap-vulkan-headers) vk-bootstrap-vulkan-headers)
target_include_directories(vk-bootstrap-triangle PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) #path to build directory for shaders target_include_directories(vk-bootstrap-triangle PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) # path to build directory for shaders
add_custom_command( add_custom_command(
TARGET vk-bootstrap-triangle TARGET vk-bootstrap-triangle

View File

@ -8,7 +8,6 @@ option(CATCH_ENABLE_WERROR "" OFF)
option(CATCH_INSTALL_DOCS "" OFF) option(CATCH_INSTALL_DOCS "" OFF)
option(CATCH_INSTALL_HELPERS "" OFF) option(CATCH_INSTALL_HELPERS "" OFF)
option(CATCH_INSTALL_EXTRAS "" ON) option(CATCH_INSTALL_EXTRAS "" ON)
set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1) #remove Catch2 target spam
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(