-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
55 lines (41 loc) · 1.19 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
cmake_minimum_required(VERSION 2.8.7)
project(SDL_vulkan)
option(DEV_BUILD "Development Build" OFF)
set(VERSION_MAJOR 0)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
find_package(SDL2 REQUIRED)
find_package(Vulkan REQUIRED)
include_directories(
${SDL2_INCLUDE_DIRS}
${VULKAN_INCLUDE_DIR})
find_package(X11_XCB)
if(X11_XCB_FOUND)
add_definitions(-DHAVE_X11_XCB)
list(APPEND SUBSYSTEMS [X11])
include_directories(${X11_XCB_INCLUDE_DIRS})
endif()
include (CheckCCompilerFlag)
function(add_checked_flag flag var)
check_c_compiler_flag(${flag} HAVE_FLAG_${var})
if(HAVE_FLAG_${var})
add_compile_options(${flag})
endif()
endfunction()
if(DEV_BUILD)
add_checked_flag(-Wall Wall)
add_checked_flag(-Werror Werror)
endif()
add_checked_flag(-std=c99 C99)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
install(DIRECTORY include/ DESTINATION include)
add_subdirectory(src)
add_subdirectory(examples)
if(DEV_BUILD)
enable_testing()
add_subdirectory(test)
endif()
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
message(STATUS "Development mode: " ${DEV_BUILD})
message(STATUS "Subsystems: " ${SUBSYSTEMS})