From cf6b1a9270bdea43ced631a28cf1c67548f25e12 Mon Sep 17 00:00:00 2001 From: Lukasz Izdebski Date: Wed, 6 Oct 2021 13:30:04 +0200 Subject: [PATCH] Doxygen added to CMake, shader project dependency added to Sample Project --- CMakeLists.txt | 24 ++++++++++++++++++++++++ Doxyfile | 4 ++-- src/CMakeLists.txt | 12 ++++++++++-- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb1e124..74b428d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,4 +31,28 @@ message(STATUS "VMA_DEBUG_INITIALIZE_ALLOCATIONS = ${VMA_DEBUG_INITIALIZE_ALLOCA message(STATUS "VMA_DEBUG_GLOBAL_MUTEX = ${VMA_DEBUG_GLOBAL_MUTEX}") message(STATUS "VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT = ${VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT}") +IF(VMA_BUILD_SAMPLE) + SET(VMA_BUILD_SAMPLE_SHADERS ON) +ENDIF(VMA_BUILD_SAMPLE) + +find_package(Doxygen) +option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" OFF) + +if (DOXYGEN_FOUND AND BUILD_DOCUMENTATION) + # set input and output files + set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile) + set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) + + # request to configure the file + configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) + # note the option ALL which allows to build the docs together with the application + add_custom_target( doc_doxygen ALL + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen" + VERBATIM ) +else (DOXYGEN_FOUND AND BUILD_DOCUMENTATION) + message("Doxygen need to be installed to generate the doxygen documentation") +endif (DOXYGEN_FOUND AND BUILD_DOCUMENTATION) + add_subdirectory(src) diff --git a/Doxyfile b/Doxyfile index 9cbc624..9328512 100644 --- a/Doxyfile +++ b/Doxyfile @@ -58,7 +58,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = docs +OUTPUT_DIRECTORY = ../docs # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and @@ -864,7 +864,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = include/vk_mem_alloc.h +INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include/vk_mem_alloc.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eccf82e..5142e34 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,10 @@ set(VMA_LIBRARY_SOURCE_FILES VmaUsage.cpp ) +set(CMAKE_DEBUG_POSTFIX d) +set(CMAKE_RELWITHDEBINFO_POSTFIX rd) +set(CMAKE_MINSIZEREL_POSTFIX s) + add_library(VulkanMemoryAllocator ${VMA_LIBRARY_SOURCE_FILES}) set_target_properties( @@ -33,6 +37,9 @@ target_compile_definitions( VMA_RECORDING_ENABLED=$ ) +install(TARGETS VulkanMemoryAllocator DESTINATION lib) +install(FILES ../include/vk_mem_alloc.h DESTINATION include) + if (VMA_BUILD_SAMPLE) if(WIN32) set(VMA_SAMPLE_SOURCE_FILES @@ -43,7 +50,8 @@ if (VMA_BUILD_SAMPLE) ) add_executable(VmaSample ${VMA_SAMPLE_SOURCE_FILES}) - + add_dependencies(VmaSample VmaSampleShaders) + # Visual Studio specific settings if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*") # Use Unicode instead of multibyte set @@ -73,8 +81,8 @@ if (VMA_BUILD_SAMPLE) target_link_libraries( VmaSample - PRIVATE + VulkanMemoryAllocator Vulkan::Vulkan )