mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 04:10:06 +00:00
Make building shaders, VMA example application and VMA replay app optional
This commit is contained in:
parent
69747a2bdb
commit
e32721df9e
@ -9,4 +9,9 @@ find_package(Vulkan REQUIRED)
|
|||||||
# Put binaries into bin folder
|
# Put binaries into bin folder
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
|
||||||
|
|
||||||
|
# VulkanMemoryAllocator contains an example application and VmaReplay which are not build by default
|
||||||
|
option(VMA_BUILD_EXAMPLE_APP "Build VulkanMemoryAllocator example application" OFF)
|
||||||
|
option(VMA_BUILD_EXAMPLE_APP_SHADERS "Build VulkanMemoryAllocator example application's shaders" OFF)
|
||||||
|
option(VMA_BUILD_REPLAY_APP "Build VulkanMemoryAllocator replay application" OFF)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
add_subdirectory(Shaders)
|
if(VMA_BUILD_EXAMPLE_APP_SHADERS)
|
||||||
add_subdirectory(VmaReplay)
|
add_subdirectory(Shaders)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(VMA_BUILD_REPLAY_APP)
|
||||||
|
add_subdirectory(VmaReplay)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(VMA_LIBRARY_SOURCE_FILES
|
set(VMA_LIBRARY_SOURCE_FILES
|
||||||
VmaUsage.cpp
|
VmaUsage.cpp
|
||||||
@ -20,10 +25,10 @@ foreach(FILE ${VMA_LIBRARY_SOURCE_FILES})
|
|||||||
source_group("${GROUP}" FILES "${FILE}")
|
source_group("${GROUP}" FILES "${FILE}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_library(VmaLibrary ${VMA_LIBRARY_SOURCE_FILES})
|
add_library(VulkanMemoryAllocator ${VMA_LIBRARY_SOURCE_FILES})
|
||||||
|
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
VmaLibrary PROPERTIES
|
VulkanMemoryAllocator PROPERTIES
|
||||||
|
|
||||||
CXX_EXTENSIONS OFF
|
CXX_EXTENSIONS OFF
|
||||||
# Use C++14
|
# Use C++14
|
||||||
@ -32,14 +37,14 @@ set_target_properties(
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
VmaLibrary
|
VulkanMemoryAllocator
|
||||||
|
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${PROJECT_SOURCE_DIR}/include
|
${PROJECT_SOURCE_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
VmaLibrary
|
VulkanMemoryAllocator
|
||||||
|
|
||||||
PUBLIC
|
PUBLIC
|
||||||
Vulkan::Vulkan
|
Vulkan::Vulkan
|
||||||
@ -67,46 +72,44 @@ foreach(FILE ${VMA_EXAMPLE_SOURCE_FILES})
|
|||||||
source_group("${GROUP}" FILES "${FILE}")
|
source_group("${GROUP}" FILES "${FILE}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
IF (WIN32)
|
if (VMA_BUILD_EXAMPLE_APP)
|
||||||
add_executable(VmaExample ${VMA_EXAMPLE_SOURCE_FILES})
|
if(WIN32)
|
||||||
|
add_executable(VmaExample ${VMA_EXAMPLE_SOURCE_FILES})
|
||||||
|
|
||||||
# Make sure to compile shaders when compiling the example
|
# Visual Studio specific settings
|
||||||
add_dependencies(VmaExample VmaShaders)
|
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
|
||||||
|
# Use Unicode instead of multibyte set
|
||||||
|
add_definitions(-DUNICODE -D_UNICODE)
|
||||||
|
|
||||||
|
# Set VmaExample as startup project
|
||||||
|
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "VmaExample")
|
||||||
|
|
||||||
|
# Enable multithreaded compiling
|
||||||
|
target_compile_options(VmaExample PRIVATE "/MP")
|
||||||
|
|
||||||
# Visual Studio specific settings
|
# Set working directory for Visual Studio debugger
|
||||||
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
|
set_target_properties(
|
||||||
# Use Unicode instead of multibyte set
|
VmaExample
|
||||||
add_definitions(-DUNICODE -D_UNICODE)
|
PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/bin"
|
||||||
|
)
|
||||||
# Set VmaExample as startup project
|
endif()
|
||||||
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "VmaExample")
|
|
||||||
|
|
||||||
# Enable multithreaded compiling
|
|
||||||
target_compile_options(VmaExample PRIVATE "/MP")
|
|
||||||
|
|
||||||
# Set working directory for Visual Studio debugger
|
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
VmaExample
|
VmaExample PROPERTIES
|
||||||
PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/bin"
|
|
||||||
|
CXX_EXTENSIONS OFF
|
||||||
|
# Use C++14
|
||||||
|
CXX_STANDARD 14
|
||||||
|
CXX_STANDARD_REQUIRED ON
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_link_libraries(
|
||||||
|
VmaExample
|
||||||
|
|
||||||
|
PRIVATE
|
||||||
|
VmaLibrary
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
message(STATUS "VmaExample application is not supported to Linux")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
set_target_properties(
|
|
||||||
VmaExample PROPERTIES
|
|
||||||
|
|
||||||
CXX_EXTENSIONS OFF
|
|
||||||
# Use C++14
|
|
||||||
CXX_STANDARD 14
|
|
||||||
CXX_STANDARD_REQUIRED ON
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(
|
|
||||||
VmaExample
|
|
||||||
|
|
||||||
PRIVATE
|
|
||||||
VmaLibrary
|
|
||||||
)
|
|
||||||
|
|
||||||
ELSE()
|
|
||||||
message(STATUS "VmaExample application is not supported to Linux")
|
|
||||||
ENDIF()
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# This file will only be executed if VMA_BUILD_EXAMPLE_APP_SHADERS is set to ON
|
||||||
|
|
||||||
find_program(GLSL_VALIDATOR glslangValidator REQUIRED)
|
find_program(GLSL_VALIDATOR glslangValidator REQUIRED)
|
||||||
|
|
||||||
if(NOT GLSL_VALIDATOR)
|
if(NOT GLSL_VALIDATOR)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
IF (WIN32)
|
# This file will only be executed if VMA_BUILD_REPLAY_APP is set to ON
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
set(VMA_REPLAY_SOURCE_FILES
|
set(VMA_REPLAY_SOURCE_FILES
|
||||||
Common.cpp
|
Common.cpp
|
||||||
Constants.cpp
|
Constants.cpp
|
||||||
@ -14,6 +16,6 @@ IF (WIN32)
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
Vulkan::Vulkan
|
Vulkan::Vulkan
|
||||||
)
|
)
|
||||||
ELSE()
|
else()
|
||||||
message(STATUS "VmaReplay is not supported on Linux")
|
message(STATUS "VmaReplay is not supported on Linux")
|
||||||
ENDIF()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user