-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
98 lines (76 loc) · 2.54 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
cmake_minimum_required(VERSION 3.12.4)
project(OGSNext)
#####################################################################
# Version
set(MGT_VERSION_MAJOR 0)
set(MGT_VERSION_MINOR 7)
set(MGT_VERSION_PATCH 5)
# Build number
set(MGT_VERSION_BUILD 90)
#####################################################################
#configure_file(
# ${CMAKE_CURRENT_SOURCE_DIR}/VersionInfo.hpp.in
# ${CMAKE_CURRENT_SOURCE_DIR}/src/core/VersionInfo.hpp
#)
# Set CMake binaries output path
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/../bin)
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/../bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/../bin)
# Set path to OGS SDK
set(OGS_SDK_PATH ${CMAKE_SOURCE_DIR}/../ogs-sdk/goldsrc
CACHE PATH
"Path to OGS engine SDK"
)
#####################################################################
# Define available options
option(OGS_DEV "Developer Mode" OFF)
option(OGS_DEDICATED "Build only dedicated server" OFF)
option(OGS_BUILD_EXAMPLES "Build engine examples" OFF)
#####################################################################
# Set C++ language standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_STANDARD_EXTENSIONS ON)
#####################################################################
# Compilation flags
#-Wall -Wextra -Wpedantic
#-Werror -Wshadow
#-Wstrict-overflow -fno-strict-aliasing
#-Wno-missing-field-initializers
#-march=native
#-msse2 -msse4.2
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") # -O3 -Os
#set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
#set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
#####################################################################
# Add include directories
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/mgt/common
)
# Detect the build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
FORCE
)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
None
Debug
Release
RelWithDebInfo
MinSizeRel
)
endif()
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_definitions(-DOGS_DEBUG)
endif()
# Add subdirectories
# Add OGS SDK directory
add_subdirectory(${OGS_SDK_PATH} ${CMAKE_BINARY_DIR}/sdk)
#add_subdirectory(mgt)
add_subdirectory(src)
add_subdirectory(tests)
if(MGT_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()