Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
graph/CMakeLists.txt

37 lines
976 B
Text
Raw Normal View History

2018-09-26 17:51:22 -04:00
cmake_minimum_required(VERSION 3.1)
project(Graph)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
2018-09-27 22:47:56 -04:00
set(CMAKE_CXX_STANDARD 14)
2018-09-26 17:51:22 -04:00
find_package(SDL2 REQUIRED)
2018-09-27 00:22:33 -04:00
find_package(Vulkan REQUIRED)
2018-09-26 17:51:22 -04:00
2018-09-29 20:27:07 -04:00
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
2018-09-28 21:08:57 -04:00
add_definitions(-DDEBUG)
endif()
add_executable(Graph
2018-09-27 22:51:26 -04:00
src/main.cpp
2018-10-15 19:52:16 -04:00
src/renderer.cpp
src/worldpass.cpp)
2018-09-27 00:22:33 -04:00
target_link_libraries(Graph PUBLIC SDL2::SDL2 SDL2::SDL2main ${Vulkan_LIBRARY})
2018-09-27 22:51:26 -04:00
target_include_directories(Graph PUBLIC include ${Vulkan_INCLUDE_DIRS})
2018-10-15 19:52:16 -04:00
macro(compile_shader src)
add_custom_command(
OUTPUT ${src}.spv
COMMAND glslangValidator -V ${CMAKE_CURRENT_SOURCE_DIR}/shaders/${src} -o ${CMAKE_CURRENT_SOURCE_DIR}/build/${src}.spv
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/shaders/${src}
)
list(APPEND SPV_FILES ${src}.spv)
endmacro()
compile_shader(triangle.vert)
compile_shader(triangle.frag)
add_custom_target(BuildShaders DEPENDS ${SPV_FILES})
add_dependencies(Graph BuildShaders)