-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
40 lines (30 loc) · 1.57 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
cmake_minimum_required (VERSION 3.0)
project(toucan)
# dependencies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set(OpenGL_GL_PREFERENCE "GLVND")
find_package(glfw3 3.2 REQUIRED)
find_package(Vulkan REQUIRED)
set(CMAKE_CXX_FLAGS "-fdiagnostics-color=always -Wall -Wextra")
set(CMAKE_C_FLAGS "-g -fopenmp -fdiagnostics-color=always -Wall -Wextra")
# vulkan settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include_directories(${Vulkan_INCLUDE_DIR})
set(ENV{VK_INSTANCE_LAYERS} VK_LAYER_LUNARG_standard_validation)
# shader compilation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set(SHADER_DIR ${CMAKE_SOURCE_DIR}/shaders)
add_custom_command(
OUTPUT
${CMAKE_BINARY_DIR}/vertex.vert.sipr
${CMAKE_BINARY_DIR}/vertex.vert.sipr.text
${CMAKE_BINARY_DIR}/fragment.frag.sipr
${CMAKE_BINARY_DIR}/fragment.frag.sipr.text
COMMAND glslangValidator -H -o ${CMAKE_BINARY_DIR}/vertex.vert.sipr ${SHADER_DIR}/vertex.vert > ${CMAKE_BINARY_DIR}/vertex.vert.sipr.text
COMMAND glslangValidator -H -o ${CMAKE_BINARY_DIR}/fragment.frag.sipr ${SHADER_DIR}/fragment.frag > ${CMAKE_BINARY_DIR}/fragment.frag.sipr.text
DEPENDS
${SHADER_DIR}/vertex.vert
${SHADER_DIR}/fragment.frag
)
add_custom_target(shaders DEPENDS ${CMAKE_BINARY_DIR}/fragment.frag.sipr ${CMAKE_BINARY_DIR}/vertex.vert.sipr)
# build ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
add_executable(toucan main.c toucan.c spock.c nets.c graphics.c layout.c link.c)
add_dependencies(toucan shaders)
target_link_libraries(toucan glfw m dl)