-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
76 lines (57 loc) · 2.8 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
70
71
72
73
74
75
#########################################
# 2D OpenGL2 Viewer #
#---------------------------------------#
# @author Nikolaus Rauch #
# @date 17.3.2021 #
#---------------------------------------#
#########################################
cmake_minimum_required( VERSION 3.9 )
project( 2D-Viewer )
message("\n * 2D OpenGL2 Viewer ")
message(STATUS "${PROJECT_NAME} build environment --")
message(STATUS "Build system: ${CMAKE_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR}")
#########################################
# CMake-Stuff #
#########################################
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
#########################################
# Global Compiler Options #
#########################################
set(GCC_COMPILE_OPTIONS "-Wall")
set(GCC_COMPILE_DEBUG_OPTIONS "${GCC_COMPILE_OPTIONS};-ggdb;-O0")
set(GCC_COMPILE_RELEASE_OPTIONS "${GCC_COMPILE_OPTIONS};-O3")
set(MSVC_COMPILE_OPTIONS "/Wall")
set(MSVC_COMPILE_DEBUG_OPTIONS "${MSVC_COMPILE_OPTIONS};/Zi")
set(MSVC_COMPILE_RELEASE_OPTIONS "${MSVC_COMPILE_OPTIONS};/O2")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:GNU>,$<CONFIG:DEBUG>>:${GCC_COMPILE_DEBUG_OPTIONS}>")
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:GNU>,$<CONFIG:RELEASE>>:${GCC_COMPILE_RELEASE_OPTIONS}>")
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<CONFIG:DEBUG>>:${MSVC_COMPILE_DEBUG_OPTIONS}>")
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<CONFIG:RELEASE>>:${MSVC_COMPILE_RELEASE_OPTIONS}>")
#########################################
# Build External-Libraries #
#########################################
add_subdirectory(external/glm)
set_property(TARGET glm_static APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
target_include_directories( glm_static PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/external>
)
add_subdirectory(external/glfw)
set_property(TARGET glfw APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
target_include_directories( glfw PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/external/glfw/include>
)
add_subdirectory(external/imgui)
set_property(TARGET imgui_static APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
add_subdirectory(external/stb_image)
set_property(TARGET stb_image APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
#########################################
# Build Viewer #
#########################################
add_subdirectory(viewer)
#########################################
# Build Demos #
#########################################
add_subdirectory(demo)