-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
75 lines (61 loc) · 2.21 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
cmake_minimum_required(VERSION 3.0)
project(flappyowl)
###########################################################
# global cxx setup
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
###########################################################
# Define platform
# - WINDOWS = Windows Desktop
# - MACOSX = MacOS X
# - LINUX = Linux
set(TARGET_WINDOWS NO)
set(TARGET_LINUX NO)
set(TARGET_MACOS NO)
set(TARGET_DEFINES)
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(TARGET_WINDOWS YES)
list(APPEND TARGET_DEFINES TARGET_WINDOWS)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(TARGET_LINUX YES)
list(APPEND TARGET_DEFINES TARGET_LINUX)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(TARGET_MACOS YES)
list(APPEND TARGET_DEFINES TARGET_MACOS)
else ()
message(FATAL_ERROR "Unsupported target platform")
endif ()
###########################################################
# Define build type
if (CMAKE_BUILD_TYPE MATCHES Debug)
list(APPEND TARGET_DEFINES WG_DEBUG)
message(STATUS "Build project in debug mode (specified)")
elseif (CMAKE_BUILD_TYPE MATCHES Release)
list(APPEND TARGET_DEFINES WG_RELEASE)
message(STATUS "Build project in release mode (specified)")
elseif (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
list(APPEND TARGET_DEFINES WG_DEBUG_RELEASE)
message(STATUS "Build project in release mode with debug info (specified)")
else ()
list(APPEND TARGET_DEFINES WG_RELEASE)
message(STATUS "Build project in release mode (default, not specified)")
endif ()
###########################################################
# Aux functions to work with targets
function(wmoge_target_defs target)
foreach (DEFINITION ${TARGET_DEFINES})
target_compile_definitions(${target} PUBLIC ${DEFINITION})
endforeach ()
endfunction()
###########################################################
# third-party dependencies of the tutorial
add_subdirectory(deps)
###########################################################
# engine sources
add_subdirectory(engine)
###########################################################
# actual flappy owl game sources
add_subdirectory(game)