-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (39 loc) · 1.83 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
cmake_minimum_required(VERSION 3.1)
project(VulkanDemo)
set(BIN_NAME "vkdemo")
set(NDEBUG)
set(shader_source "${CMAKE_SOURCE_DIR}/shaders")
set(shader_destination "${CMAKE_CURRENT_BINARY_DIR}/shaders")
set(texture_source "${CMAKE_SOURCE_DIR}/textures")
set(texture_destination "${CMAKE_CURRENT_BINARY_DIR}/textures")
set(models_source "${CMAKE_SOURCE_DIR}/models")
set(models_destination "${CMAKE_CURRENT_BINARY_DIR}/models")
file(GLOB SOURCES "src/*.cpp")
include_directories("include")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(assimp REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_search_module(GLFW REQUIRED glfw3)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Wall")
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
set (CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_executable(${BIN_NAME} ${SOURCES})
target_link_libraries(${BIN_NAME} glfw)
target_link_libraries(${BIN_NAME} vulkan)
target_link_libraries(${BIN_NAME} assimp)
# Compile shaders
add_custom_command(TARGET ${BIN_NAME} PRE_BUILD
COMMAND /bin/sh ${CMAKE_SOURCE_DIR}/shaders/compile.sh)
add_custom_command(TARGET ${BIN_NAME}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${shader_source} ${shader_destination}
DEPENDS ${shader_destination}
COMMENT "symbolic link resource folder from ${shader_source} => ${shader_destination}")
add_custom_command(TARGET ${BIN_NAME}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${texture_source} ${texture_destination}
DEPENDS ${texture_destination}
COMMENT "symbolic link resource folder from ${texture_source} => ${texture_destination}")
add_custom_command(TARGET ${BIN_NAME}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${models_source} ${models_destination}
DEPENDS ${models_destination}
COMMENT "symbolic link resource folder from ${models_source} => ${models_destination}")