forked from adventuregamestudio/ags
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
151 lines (121 loc) · 4.85 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
149
150
151
# https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/Life-Cycle-Considerations
cmake_minimum_required(VERSION 3.13..3.14)
set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/CMake/c_flag_overrides.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/CMake/cxx_flag_overrides.cmake)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
project(AGS
VERSION 3.5.0.19
LANGUAGES CXX C)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMake")
option(AGS_NO_MP3_PLAYER "Disable MP3" OFF)
option(AGS_NO_VIDEO_PLAYER "Disable Video" OFF)
option(AGS_BUILTIN_PLUGINS "Built in plugins" OFF)
set(AGS_BUILD_STR "" CACHE STRING "Engine Build Information")
# Tools like ninja don't have a pseudo-terminal so compilers assume no coloured output
option (AGS_FORCE_COLOURED_OUTPUT "Always produce ANSI-coloured output (GNU/Clang only)." OFF)
if (${AGS_FORCE_COLOURED_OUTPUT})
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options (-fdiagnostics-color=always)
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_compile_options (-fcolor-diagnostics)
endif ()
endif ()
include(FetchContent)
set(FETCHCONTENT_UPDATES_DISCONNECTED on)
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
# WIN32 is set by CMake for any Windows platform
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(LINUX TRUE)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOS TRUE)
else()
message(FATAL_ERROR "Unsupported system: ${CMAKE_SYSTEM_NAME}")
endif ()
if (WIN32 AND NOT CMAKE_SIZEOF_VOID_P EQUAL 4)
message(FATAL_ERROR "Windows builds only support 32bit for now")
endif()
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_not_supported_reason)
if(ipo_supported)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
else()
message(STATUS "Interprocedural optimisation (IPO/LTO) not supported: <${ipo_not_supported_reason}>")
endif()
add_compile_definitions("_FILE_OFFSET_BITS=64")
add_compile_definitions("$<$<CONFIG:DEBUG>:_DEBUG>")
add_compile_definitions("$<$<CONFIG:RELEASE>:NDEBUG>")
if(MSVC)
add_compile_options(/MP) # Build with Multiple Processes
add_compile_definitions(_CRT_SECURE_NO_DEPRECATE)
add_compile_definitions(_CRT_NONSTDC_NO_DEPRECATE)
else()
add_compile_options(
-fsigned-char
-fno-strict-aliasing
-fwrapv
-Wall
-Wextra
-Wendif-labels
-Wfloat-equal
-Wformat
-Wformat-security
-Winit-self
-Winline
-Wmissing-noreturn
-Wpointer-arith
-Wshadow
-Wundef
-Wwrite-strings
-Wunused-result
# probably need fixing but disable until we have time
-Wno-unknown-pragmas
-Wno-deprecated-declarations
-Wno-unused-parameter
-Wno-sign-compare
-Wno-cast-align
-Wno-cast-qual
-Wno-missing-declarations
-Wno-switch-enum
# -Wlarger-than-4096
-Wno-redundant-decls
-Werror=write-strings
#-Werror=implicit-function-declaration
#-Werror=unused-result
)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-old-style-cast>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Werror=delete-non-virtual-dtor>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wbad-function-cast>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wdeclaration-after-statement>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wno-missing-prototypes>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wold-style-definition>)
add_compile_options($<$<COMPILE_LANGUAGE:C>:-Wstrict-prototypes>)
endif()
find_package(PkgConfig)
find_package(Threads)
if (WIN32)
find_package(DirectX)
elseif (LINUX)
find_package(X11)
endif()
include(FindLocalSDL2)
include(FindLocalPhysicsFS)
include(FindLocalSdlSound)
include(FindLocalOpenAL)
include(FindLocalAllegro)
include(FetchOgg)
include(FetchVorbis)
include(FetchTheora)
add_subdirectory(Common/libsrc/aastr-0.1.1 EXCLUDE_FROM_ALL)
add_subdirectory(Common/libsrc/alfont-2.0.9 EXCLUDE_FROM_ALL)
add_subdirectory(Common/libsrc/freetype-2.1.3 EXCLUDE_FROM_ALL)
add_subdirectory(Common EXCLUDE_FROM_ALL)
add_subdirectory(Engine/libsrc/almp3-2.0.5 EXCLUDE_FROM_ALL)
add_subdirectory(Engine/libsrc/alogg EXCLUDE_FROM_ALL)
add_subdirectory(Engine/libsrc/apeg-1.2.1 EXCLUDE_FROM_ALL)
add_subdirectory(Engine/libsrc/dumb-0.9.2 EXCLUDE_FROM_ALL)
add_subdirectory(Engine/libsrc/glad EXCLUDE_FROM_ALL)
add_subdirectory(Engine/libsrc/hq2x EXCLUDE_FROM_ALL)
add_subdirectory(Engine/libsrc/libcda-0.5 EXCLUDE_FROM_ALL)
add_subdirectory(Engine)
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ags)