Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
project(EXAMPLEVULKAN C)
find_package(Vulkan REQUIRED)
add_subdirectory(deps)
add_subdirectory(lib)
add_executable(${PROJECT_NAME} src/main.c)
# ##############################################################################
# Configure the compiler
# ##############################################################################
target_compile_options(${PROJECT_NAME} PUBLIC -Wall -Wextra)
target_compile_features(${PROJECT_NAME} PUBLIC c_std_11)
target_compile_features(${PROJECT_NAME} PUBLIC c_restrict)
if (CMAKE_BUILD_TYPE MATCHES Debug)
target_compile_options(${PROJECT_NAME} PUBLIC -g)
add_definitions(-DDEBUG=1)
else()
target_compile_options(${PROJECT_NAME} PUBLIC -O3 -flto)
add_definitions(-DNDEBUG=1)
endif()
# ##############################################################################
# Add dependencies
# ##############################################################################
target_link_libraries(${PROJECT_NAME} PUBLIC glfw)
if (VULKAN_FOUND)
message(STATUS "Found Vulkan: ${Vulkan_INCLUDE_DIRS}")
include_directories(${Vulkan_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${Vulkan_LIBRARIES})
endif (VULKAN_FOUND)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.