-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
74 lines (62 loc) · 2.7 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
cmake_minimum_required(VERSION 3.5)
set(PROJNAME vk_timeline_semaphore)
project(${PROJNAME})
#####################################################################################
# look for nvpro_core 1) as a sub-folder 2) at some other locations
# this cannot be put anywhere else since we still didn't find setup.cmake yet
#
if(NOT BASE_DIRECTORY)
find_path(BASE_DIRECTORY
NAMES nvpro_core/cmake/setup.cmake
PATHS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../..
REQUIRED
DOC "Directory containing nvpro_core"
)
endif()
if(EXISTS ${BASE_DIRECTORY}/nvpro_core/cmake/setup.cmake)
include(${BASE_DIRECTORY}/nvpro_core/cmake/setup.cmake)
include(${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
else()
message(FATAL_ERROR "could not find base directory, please set BASE_DIRECTORY to folder containing nvpro_core")
endif()
#####################################################################################
# Add sample packages
#
_add_package_VulkanSDK()
_add_package_IMGUI()
_add_package_shaderc()
_add_nvpro_core_lib()
#####################################################################################
_add_project_definitions(${PROJNAME})
#####################################################################################
# Source files for this project
#
file(GLOB SOURCE_FILES *.cpp *.c)
file(GLOB HEADER_FILES *.h *.hpp shaders/*.h)
file(GLOB SHADER_FILES shaders/*.vert shaders/*.frag shaders/*.comp shaders/*.glsl)
#####################################################################################
# Executable
#
add_executable(${PROJNAME} ${SOURCE_FILES} ${COMMON_SOURCE_FILES} ${SHADER_FILES} ${HEADER_FILES})
#####################################################################################
# Source code groups
#
source_group("Source Files" FILES ${SOURCE_FILES})
source_group("Header Files" FILES ${HEADER_FILES})
source_group("Shader Files" FILES ${SHADER_FILES})
#####################################################################################
# Linkage
#
target_link_libraries(${PROJNAME} ${PLATFORM_LIBRARIES} nvpro_core)
foreach(DEBUGLIB ${LIBRARIES_DEBUG})
target_link_libraries(${PROJNAME} debug ${DEBUGLIB})
endforeach(DEBUGLIB)
foreach(RELEASELIB ${LIBRARIES_OPTIMIZED})
target_link_libraries(${PROJNAME} optimized ${RELEASELIB})
endforeach(RELEASELIB)
#####################################################################################
# copies files that need to be put next to the exe files (ZLib, etc.)
#
_finalize_target( ${PROJNAME} )
install(DIRECTORY ./shaders CONFIGURATIONS Release DESTINATION "bin_${ARCH}/${PROJNAME}/")
install(DIRECTORY ./shaders CONFIGURATIONS Debug DESTINATION "bin_${ARCH}_debug/${PROJNAME}/")