-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
69 lines (59 loc) · 2.08 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
cmake_minimum_required(VERSION 2.8.4)
project(Demos)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_SUPPRESS_REGENERATION true)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Config types" FORCE)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if (MSVC)
add_compile_options("$<$<CONFIG:DEBUG>:/MTd>")
add_compile_options("$<$<CONFIG:RELEASE>:/MT>")
add_compile_options(/std:c++14)
add_compile_options(/MP)
endif()
function(set_default_definitions TARGET)
target_compile_definitions(${TARGET} PRIVATE
HAVE_LIBC
GLEW_STATIC
SDL_HAPTIC_DISABLED
SDL_JOYSTICK_DISABLED
"$<$<CONFIG:DEBUG>:DEMOS_DEBUG>"
)
endfunction()
function(set_default_includes TARGET)
target_include_directories(${TARGET} PRIVATE
"${CMAKE_SOURCE_DIR}/demos"
"${CMAKE_SOURCE_DIR}/vendor" # TODO needed?
"${CMAKE_SOURCE_DIR}/vendor/glew/1.13/include"
"${CMAKE_SOURCE_DIR}/vendor/SDL/2.0.12/include"
"${CMAKE_SOURCE_DIR}/vendor/stb_truetype/1.11"
"${CMAKE_SOURCE_DIR}/vendor/stb_image/2.15"
"${CMAKE_SOURCE_DIR}/vendor/glm/0.9.8.4"
"${CMAKE_SOURCE_DIR}/vendor/imgui"
)
if (WIN32)
find_package(Vulkan REQUIRED)
target_include_directories(${TARGET} PRIVATE
${Vulkan_INCLUDE_DIRS}
"${Vulkan_INCLUDE_DIRS}/vulkan"
)
endif()
endfunction()
function(add_app TARGET SOURCES)
file(GLOB SRC ${SOURCES})
source_group("" FILES ${SRC})
add_executable(${TARGET} ${SRC})
set_default_includes(${TARGET})
set_default_definitions(${TARGET})
target_link_libraries(${TARGET} Vendor Common)
if (MSVC)
target_compile_options(${TARGET} PRIVATE /wd4267 /wd4244 /wd4312)
endif()
endfunction()
add_subdirectory("vendor")
add_subdirectory("demos/common")
add_subdirectory("demos/stb-truetype")
add_subdirectory("demos/transform")
add_subdirectory("demos/skybox")
add_subdirectory("demos/imgui")