mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 12:20:07 +00:00
Merge pull request #304 from juan-lunarg/juaramos/cmake_cleanup
Minor CMake cleanup
This commit is contained in:
commit
413fc4f988
@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.9)
|
cmake_minimum_required(VERSION 3.9)
|
||||||
|
|
||||||
project(VulkanMemoryAllocator)
|
project(VulkanMemoryAllocator LANGUAGES CXX)
|
||||||
|
|
||||||
# https://cmake.org/cmake/help/latest/variable/PROJECT_IS_TOP_LEVEL.html
|
# https://cmake.org/cmake/help/latest/variable/PROJECT_IS_TOP_LEVEL.html
|
||||||
string(COMPARE EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PROJECT_IS_TOP_LEVEL)
|
string(COMPARE EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PROJECT_IS_TOP_LEVEL)
|
||||||
@ -33,7 +33,7 @@ message(STATUS "VMA_DEBUG_DONT_EXCEED_MAX_MEMORY_ALLOCATION_COUNT = ${VMA_DEBUG_
|
|||||||
|
|
||||||
if(VMA_BUILD_SAMPLE)
|
if(VMA_BUILD_SAMPLE)
|
||||||
set(VMA_BUILD_SAMPLE_SHADERS ON)
|
set(VMA_BUILD_SAMPLE_SHADERS ON)
|
||||||
endif(VMA_BUILD_SAMPLE)
|
endif()
|
||||||
|
|
||||||
option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" OFF)
|
option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" OFF)
|
||||||
|
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
set(VMA_LIBRARY_SOURCE_FILES
|
|
||||||
VmaUsage.cpp
|
|
||||||
VmaUsage.h
|
|
||||||
"${PROJECT_SOURCE_DIR}/include/vk_mem_alloc.h"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Visual Studio only debugger symbols
|
|
||||||
if(WIN32 AND ${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
|
|
||||||
set(VMA_LIBRARY_SOURCE_FILES ${VMA_LIBRARY_SOURCE_FILES} vk_mem_alloc.natvis)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_DEBUG_POSTFIX d)
|
set(CMAKE_DEBUG_POSTFIX d)
|
||||||
set(CMAKE_RELWITHDEBINFO_POSTFIX rd)
|
set(CMAKE_RELWITHDEBINFO_POSTFIX rd)
|
||||||
set(CMAKE_MINSIZEREL_POSTFIX s)
|
set(CMAKE_MINSIZEREL_POSTFIX s)
|
||||||
|
|
||||||
add_library(VulkanMemoryAllocator ${VMA_LIBRARY_SOURCE_FILES})
|
add_library(VulkanMemoryAllocator
|
||||||
|
VmaUsage.cpp
|
||||||
|
VmaUsage.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/vk_mem_alloc.h
|
||||||
|
)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
# Provides MSVC users nicer debugging support
|
||||||
|
target_sources(VulkanMemoryAllocator PRIVATE ${CMAKE_CURRENT_LIST_DIR}/vk_mem_alloc.natvis)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
VulkanMemoryAllocator PROPERTIES
|
VulkanMemoryAllocator PROPERTIES
|
||||||
@ -63,20 +61,19 @@ if(VMA_BUILD_SAMPLE)
|
|||||||
add_executable(VmaSample ${VMA_SAMPLE_SOURCE_FILES})
|
add_executable(VmaSample ${VMA_SAMPLE_SOURCE_FILES})
|
||||||
add_dependencies(VmaSample VulkanMemoryAllocator VmaSampleShaders)
|
add_dependencies(VmaSample VulkanMemoryAllocator VmaSampleShaders)
|
||||||
|
|
||||||
# Visual Studio specific settings
|
if(MSVC)
|
||||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
|
|
||||||
# Use Unicode instead of multibyte set
|
# Use Unicode instead of multibyte set
|
||||||
add_compile_definitions(UNICODE _UNICODE)
|
add_compile_definitions(UNICODE _UNICODE)
|
||||||
|
|
||||||
# Set VmaSample as startup project
|
|
||||||
set_property(DIRECTORY "${PROJECT_SOURCE_DIR}" PROPERTY VS_STARTUP_PROJECT "VmaSample")
|
|
||||||
|
|
||||||
# Add C++ warnings and security checks
|
# Add C++ warnings and security checks
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /permissive- /sdl /W3")
|
add_compile_options(/permissive- /sdl /W3)
|
||||||
|
|
||||||
# Enable multithreaded compiling
|
# Enable multithreaded compiling
|
||||||
target_compile_options(VmaSample PRIVATE "/MP")
|
target_compile_options(VmaSample PRIVATE "/MP")
|
||||||
|
|
||||||
|
# Set VmaSample as startup project
|
||||||
|
set_property(DIRECTORY "${PROJECT_SOURCE_DIR}" PROPERTY VS_STARTUP_PROJECT "VmaSample")
|
||||||
|
|
||||||
# Set working directory for Visual Studio debugger
|
# Set working directory for Visual Studio debugger
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
VmaSample
|
VmaSample
|
||||||
|
Loading…
Reference in New Issue
Block a user