-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
executable file
·148 lines (134 loc) · 4.62 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
cmake_minimum_required(VERSION 3.7)
project(SeriousEngine)
# Set @rpath for Mac OS X shared library install names.
# Use system SDL2 is on by default
option(USE_SYSTEM_SDL2 "Use systems sdl2 development files" On)
option(USE_SYSTEM_ZLIB "Use systems zlib development files" On)
option(USE_CCACHE "Set to ON to use ccache if present in the system" ${USE_CCACHE})
option(USE_SYSTEM_INSTALL "Install to systems directories" Off)
# fallback for cmake versions without add_compile_options # RAKE! Borrowed from dhewm3 project
if(NOT COMMAND add_compile_options)
function(add_compile_options)
foreach(arg ${ARGN})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${arg}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${arg}" PARENT_SCOPE)
endforeach()
endfunction()
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
include(CheckCXXCompilerFlag)
# SeriousSam expects the libs to be in Debug/
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/Debug)
if(USE_CCACHE)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif()
endif()
# Use systemwide SDL2 or custom build
# RAKE!: Find a way to use their custom built library if
# they want to use that instead or if their system only
# allows for a setup like this. Maybe use a SDL2_DIR var or
# some thing set in the system enviroment.
if(NOT USE_SYSTEM_SDL2)
include_directories(${CMAKE_SOURCE_DIR}/External/SDL2)
else()
find_package(SDL2 REQUIRED)
if(SDL2_FOUND)
include_directories(${SDL2_INCLUDE_DIR})
else()
message(FATAL_ERROR "Error USE_SYSTEM_SDL2 is set but neccessary developer files are missing")
endif()
endif()
if(USE_SYSTEM_ZLIB)
find_package(ZLIB REQUIRED)
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
else()
message(FATAL_ERROR "Error! USE_SYSTEM_ZLIB is set but neccessary developer files are missing")
endif()
endif()
# Set up some sanity stuff...
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME MATCHES "GNU")
set(LINUX TRUE)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" OR CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
set(FREEBSD TRUE)
endif()
if(APPLE)
set(MACOSX TRUE)
endif()
if(MSVC)
set(WINDOWS TRUE)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "None Debug Release RelWithDebInfo MinSizeRel" FORCE)
endif()
set(DEBUG FALSE)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(DEBUG TRUE)
endif()
if(LINUX)
set(CMAKE_OS_NAME "GNU/Linux" CACHE STRING "Operating system name" FORCE)
## Check for Debian GNU/Linux
find_file(DEBIAN_FOUND debian_version debconf.conf
PATHS /etc
)
if(DEBIAN_FOUND)
set(CMAKE_OS_NAME "Debian" CACHE STRING "Operating system name" FORCE)
endif(DEBIAN_FOUND)
## Check for Fedora
find_file(FEDORA_FOUND fedora-release
PATHS /etc
)
if(FEDORA_FOUND)
set(CMAKE_OS_NAME "Fedora" CACHE STRING "Operating system name" FORCE)
endif(FEDORA_FOUND)
## Check for RedHat
find_file(REDHAT_FOUND redhat-release inittab.RH
PATHS /etc
)
if(REDHAT_FOUND)
set(CMAKE_OS_NAME "RedHat" CACHE STRING "Operating system name" FORCE)
endif(REDHAT_FOUND)
## Check for Gentoo
find_file(OS_Release_FOUND os-release
PATHS /usr/lib
)
if (OS_Release_FOUND)
## Scan contents of file
file(STRINGS ${OS_Release_FOUND} Gentoo_FOUND
REGEX Gentoo
)
## Check result of string search
if(Gentoo_FOUND)
set(CMAKE_OS_NAME "Gentoo" CACHE STRING "Operating system name" FORCE)
set(DEBIAN_FOUND FALSE)
endif(Gentoo_FOUND)
endif(OS_Release_FOUND)
## Extra check for Ubuntu
if(DEBIAN_FOUND)
## At its core Ubuntu is a Debian system, with
## a slightly altered configuration; hence from
## a first superficial inspection a system will
## be considered as Debian, which signifies an
## extra check is required.
find_file(UBUNTU_EXTRA legal issue
PATHS /etc
)
if(UBUNTU_EXTRA)
## Scan contents of file
file(STRINGS ${UBUNTU_EXTRA} UBUNTU_FOUND
REGEX Ubuntu
)
## Check result of string search
if(UBUNTU_FOUND)
set(CMAKE_OS_NAME "Ubuntu" CACHE STRING "Operating system name" FORCE)
set(DEBIAN_FOUND FALSE)
endif(UBUNTU_FOUND)
endif(UBUNTU_EXTRA)
endif(DEBIAN_FOUND)
endif(LINUX)
add_subdirectory(SamTFE/Sources)
add_subdirectory(SamTSE/Sources)