10797
by The Widelands Bunnybot
Fix revision detection, bump cmake version (CB #4550 / GH #6207) |
1 |
cmake_minimum_required (VERSION 3.12) |
2 |
cmake_policy(VERSION 3.12) |
|
8866.1.8
by Toni Förster
properly set CMP0054 and set message for GLVND linker flags |
3 |
|
10608
by The Widelands Bunnybot
Fix Compilation with GCC 13.1 and AppleClang (#5903) |
4 |
project (widelands) |
5 |
||
9478
by The Widelands Bunnybot
Update CMakeLists.txt (#4161) |
6 |
message(STATUS "Using CMake version ${CMAKE_VERSION}") |
7 |
||
10650
by The Widelands Bunnybot
Remove superfluous `SDL_GetModState()` calls (#5945) |
8 |
# Detailed help is in README.md
|
9 |
# Please update it if you change anything here
|
|
7688.1.2
by Tino
unix line endings |
10 |
option(OPTION_USE_GLBINDING "Use glbinding instead of GLEW" OFF) |
11 |
option(OPTION_GLEW_STATIC "Use static GLEW Library" OFF) |
|
7851.1.29
by GunChleoc
Added CMake option to omit building website-related stuff and rescued the English language. |
12 |
option(OPTION_BUILD_WEBSITE_TOOLS "Build website-related tools" ON) |
9148.2.1
by Notabilis
Adding compile.sh switch -s to skip building the tests. |
13 |
option(OPTION_BUILD_TESTS "Build tests" ON) |
9204
by The Widelands Bunnybot
Noordfrees: Launchpad mirror (#3766)\n\nMirrors all changes at widelands:master to lp:widelands (1d6b62c7619a182081e1c942ae533a95d6112044) |
14 |
option(OPTION_BUILD_CODECHECK "Build codecheck" ON) |
9468
by The Widelands Bunnybot
Build a static linked executable with msys2 (Appveyor&Github Workflow) (#3982) |
15 |
option(OPTION_BUILD_WINSTATIC "Build a static linked .exe on windows" OFF) |
10070
by The Widelands Bunnybot
Resolve thread sanitizer issues (#5114) |
16 |
option(OPTION_TSAN "Build with ThreadSanitizer" OFF) |
10253
by The Widelands Bunnybot
Only use embedded minizip if not installed (#5360) |
17 |
option(OPTION_FORCE_EMBEDDED_MINIZIP "Use embedded minizip sources" OFF) |
9468
by The Widelands Bunnybot
Build a static linked executable with msys2 (Appveyor&Github Workflow) (#3982) |
18 |
option(USE_XDG "Follow XDG-Basedir specification" ON) # Enabled by default |
19 |
||
10411
by The Widelands Bunnybot
Delete selected text on text input (#5633) |
20 |
set(CMAKE_FIND_FRAMEWORK LAST) |
21 |
||
9900
by The Widelands Bunnybot
Fix codecheck path magic (#4895) |
22 |
# Absolute path reference for submodules
|
23 |
set(WL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") |
|
10125
by The Widelands Bunnybot
Dependencies: Asio include handling & Solus support (#5182) |
24 |
|
25 |
# Add custom includes to override system libs
|
|
26 |
FILE(GLOB custom_include_directories auto_dependencies/*) |
|
27 |
foreach(custom_include_dir ${custom_include_directories}) |
|
28 |
if(IS_DIRECTORY "${custom_include_dir}") |
|
29 |
message(STATUS "Using custom include directory '${custom_include_dir}'.") |
|
30 |
list(INSERT CMAKE_INCLUDE_PATH 0 "${custom_include_dir}") |
|
31 |
include_directories(BEFORE SYSTEM "${custom_include_dir}") |
|
32 |
else() |
|
33 |
message(WARNING "Not a directory: '${custom_include_dir}' - Ignored.") |
|
34 |
endif() |
|
35 |
endforeach() |
|
36 |
||
9468
by The Widelands Bunnybot
Build a static linked executable with msys2 (Appveyor&Github Workflow) (#3982) |
37 |
include("${CMAKE_SOURCE_DIR}/cmake/UseSystemInfo.cmake") |
38 |
include("${CMAKE_SOURCE_DIR}/cmake/WlFunctions.cmake") |
|
39 |
||
10797
by The Widelands Bunnybot
Fix revision detection, bump cmake version (CB #4550 / GH #6207) |
40 |
# This policy is not known to versions prior 3.27 and would result in errors,
|
41 |
# if set on such systems. This can be removed when cmake_minimum_required is set
|
|
42 |
# to 3.27 or newer by using:
|
|
43 |
# cmake_policy(VERSION 3.27)
|
|
44 |
if(POLICY CMP0148) |
|
45 |
cmake_policy(SET CMP0148 NEW) |
|
46 |
endif(POLICY CMP0148) |
|
9464
by The Widelands Bunnybot
CMake Cleanups (#4100) |
47 |
|
8729.1.1
by Lucki
Add basic XDG support. |
48 |
IF(USE_XDG AND NOT APPLE AND NOT WIN32) |
49 |
ADD_DEFINITIONS(-DUSE_XDG) |
|
8729.1.16
by GunChleoc
Code review |
50 |
message(STATUS "Building with XDG support") |
8729.1.1
by Lucki
Add basic XDG support. |
51 |
ENDIF(USE_XDG AND NOT APPLE AND NOT WIN32) |
52 |
||
7688.1.2
by Tino
unix line endings |
53 |
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) |
54 |
message(FATAL_ERROR "Build directory and source directory must not be the same.") |
|
55 |
endif (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) |
|
56 |
||
57 |
# Define the directory structure for installation - will be hardcoded in WL bin
|
|
58 |
# (through config.h). If not specified, we are going to use the directory where
|
|
59 |
# the executable is in. Also on Linux.
|
|
60 |
# Packagers (or people using make install) have to set this variable to an absolute path.
|
|
7293.1.44
by fios at foramnagaidhlig
Scrapped the ImageCatalog. The datadir is now "./data" on a global level (CMake, g_fs). |
61 |
wl_set_if_unset(WL_INSTALL_BASEDIR ".") |
62 |
||
63 |
# Define the directory structure for installation of the data files - will be hardcoded
|
|
64 |
# in WL bin (through config.h). If not specified, we are going to use the "data" directory
|
|
65 |
# below the directory where the executable is in. Also on Linux.
|
|
66 |
# Packagers (or people using make install) have to set this variable to an absolute path.
|
|
7293.1.72
by Tino
- define datadir relative to widelands executable |
67 |
wl_set_if_unset(WL_INSTALL_DATADIR "./data") |
7688.1.2
by Tino
unix line endings |
68 |
|
10259
by The Widelands Bunnybot
Move definition of `WL_INSTALL_BINDIR` (#5383) |
69 |
# To override this, use '-DWL_INSTALL_BINDIR=<absolute path>' when configuring or change
|
70 |
# 'CMAKE_INSTALL_PREFIX'.
|
|
71 |
# Example: to have the bin installed to "/usr/games", just use '-DCMAKE_INSTALL_PREFIX=/usr'
|
|
72 |
# and don't specify '-DWL_INSTALL_BINDIR' when configuring.
|
|
73 |
# Note: 'CMAKE_INSTALL_PREFIX' defaults to /usr/local on UNIX and c:/Program Files/${PROJECT_NAME} on Windows
|
|
10306
by The Widelands Bunnybot
Integrate AppImage building into CI (#5377) |
74 |
wl_set_if_unset(WL_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/games") |
10259
by The Widelands Bunnybot
Move definition of `WL_INSTALL_BINDIR` (#5383) |
75 |
|
7688.1.2
by Tino
unix line endings |
76 |
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |
10979
by The Widelands Bunnybot
Replace gettext with tinygettext (CB #4772 / GH #6411) |
77 |
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8) |
78 |
message(FATAL_ERROR "Widelands needs GCC >= 8 to compile.") |
|
7688.1.2
by Tino
unix line endings |
79 |
endif() |
10797
by The Widelands Bunnybot
Fix revision detection, bump cmake version (CB #4550 / GH #6207) |
80 |
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") |
10979
by The Widelands Bunnybot
Replace gettext with tinygettext (CB #4772 / GH #6411) |
81 |
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7) |
82 |
message(FATAL_ERROR "Clang version must be at least 7!") |
|
7688.1.2
by Tino
unix line endings |
83 |
endif() |
9660
by The Widelands Bunnybot
Fix formatting action for branches on origin (#4500) |
84 |
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") |
10120
by The Widelands Bunnybot
Resolve MSVC warnings (#5157) |
85 |
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) |
86 |
message(FATAL_ERROR "MSVC version must be at least 19!") |
|
87 |
endif() |
|
7688.1.2
by Tino
unix line endings |
88 |
else() |
89 |
message(WARNING "You are using an unsupported compiler! Supported are Clang and GCC.") |
|
90 |
endif() |
|
10120
by The Widelands Bunnybot
Resolve MSVC warnings (#5157) |
91 |
message(STATUS "Picking up default CXX flags: |
92 |
- CMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'
|
|
93 |
- CMAKE_CXX_FLAGS_RELEASE='${CMAKE_CXX_FLAGS_RELEASE}'
|
|
94 |
- CMAKE_CXX_FLAGS_DEBUG='${CMAKE_CXX_FLAGS_DEBUG}'") |
|
7688.1.2
by Tino
unix line endings |
95 |
|
96 |
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) |
|
97 |
||
98 |
if (WIN32) |
|
8919.1.1
by tino79
adapt to changes in appveyor 11/09/18 platform updates |
99 |
link_libraries(wsock32 ws2_32 bcrypt) |
7688.1.2
by Tino
unix line endings |
100 |
endif() |
9468
by The Widelands Bunnybot
Build a static linked executable with msys2 (Appveyor&Github Workflow) (#3982) |
101 |
if (OPTION_BUILD_WINSTATIC) |
9975
by The Widelands Bunnybot
Add-Ons Webserver (#4934) |
102 |
add_definitions(-DGLBINDING_STATIC_DEFINE -DNGHTTP2_STATICLIB) |
9468
by The Widelands Bunnybot
Build a static linked executable with msys2 (Appveyor&Github Workflow) (#3982) |
103 |
set (OPTION_GLEW_STATIC ON) |
10628
by The Widelands Bunnybot
Remove hard-coded library paths for MinGW builds (#5921) |
104 |
if(MSVC) |
105 |
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib") |
|
106 |
else() |
|
107 |
set(CMAKE_FIND_LIBRARY_PREFIXES "lib") |
|
108 |
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") |
|
109 |
endif() |
|
9468
by The Widelands Bunnybot
Build a static linked executable with msys2 (Appveyor&Github Workflow) (#3982) |
110 |
endif() |
7688.1.2
by Tino
unix line endings |
111 |
|
10797
by The Widelands Bunnybot
Fix revision detection, bump cmake version (CB #4550 / GH #6207) |
112 |
find_package (Python3 REQUIRED) |
7688.1.2
by Tino
unix line endings |
113 |
|
114 |
find_package(OpenGL REQUIRED) |
|
10411
by The Widelands Bunnybot
Delete selected text on text input (#5633) |
115 |
find_package(PNG 1.6 REQUIRED) |
9278
by The Widelands Bunnybot
Improve SDL2 detection on modern systems (#3872) |
116 |
|
9464
by The Widelands Bunnybot
CMake Cleanups (#4100) |
117 |
find_package(SDL2 REQUIRED) |
7688.1.2
by Tino
unix line endings |
118 |
find_package(SDL2_image REQUIRED) |
119 |
find_package(SDL2_mixer REQUIRED) |
|
120 |
find_package(SDL2_ttf REQUIRED) |
|
121 |
find_package(ZLIB REQUIRED) |
|
9491
by The Widelands Bunnybot
Fix CMake packages on Xenial (#4181) |
122 |
if(${CMAKE_VERSION} VERSION_LESS 3.9.0) |
9478
by The Widelands Bunnybot
Update CMakeLists.txt (#4161) |
123 |
find_package(ICU_old REQUIRED) |
124 |
else() |
|
125 |
find_package(ICU REQUIRED COMPONENTS uc dt) |
|
126 |
endif() |
|
7688.1.2
by Tino
unix line endings |
127 |
if(OPTION_USE_GLBINDING) |
128 |
find_package(glbinding REQUIRED) |
|
129 |
else() |
|
130 |
find_package(GLEW REQUIRED) |
|
131 |
endif() |
|
132 |
||
10125
by The Widelands Bunnybot
Dependencies: Asio include handling & Solus support (#5182) |
133 |
# Check that Asio is installed. Asio does not have (or need) a Find… CMake Module, so we "only" need to check if the header exists.
|
134 |
if(NOT asio_location OR asio_location STREQUAL "") |
|
135 |
unset(asio_location CACHE) |
|
136 |
find_path(asio_location "asio.hpp") |
|
137 |
if(asio_location) |
|
138 |
message(STATUS "Found Asio in '${asio_location}'.") |
|
139 |
else() |
|
140 |
message(FATAL_ERROR "Could NOT find Asio (missing: asio.hpp). Please run:\n./install-dependencies.sh\nwhich will attempt to install all missing dependencies automatically, or provide further instructions if this not supported on your system.") |
|
141 |
endif() |
|
142 |
endif() |
|
143 |
add_definitions(-DASIO_STANDALONE) |
|
144 |
||
8075.1.3
by GunChleoc
Added commandline switch for translations. |
145 |
if (APPLE OR WIN32 OR |
146 |
CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR |
|
11036
by The Widelands Bunnybot
Patches to support netbsd-pkgsrc (CB #4851 / GH #6489) |
147 |
CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR |
8024
by Holger Rapp
OpenBSD build patch by David Carlier. |
148 |
CMAKE_SYSTEM_NAME MATCHES "OpenBSD") |
7688.1.2
by Tino
unix line endings |
149 |
endif() |
150 |
||
8790.1.1
by Holger Rapp
Attempt to fix the Mac OS X nightlies. |
151 |
# Disable no symbols warning on macOS, but only on versions where this is
|
152 |
# supported. It is not supported on OS X 10.7 (DARWIN_MAJOR_VERSION == 11).
|
|
8790.1.2
by GunChleoc
Fix CMake for Linux. |
153 |
if (APPLE) |
154 |
if (${DARWIN_MAJOR_VERSION} GREATER 11) |
|
155 |
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>") |
|
156 |
SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>") |
|
157 |
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>") |
|
158 |
SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>") |
|
159 |
endif() |
|
8778.2.8
by Toni Förster
Disable no symbols warning on macOS |
160 |
endif() |
161 |
||
7688.1.2
by Tino
unix line endings |
162 |
# TODO(sirver): One day, this should be enabled. Then we have no more cycles in our dependencies....
|
163 |
# set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_NO_CYCLES ON)
|
|
164 |
||
165 |
if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") |
|
166 |
find_path(FILE_WL_RELEASE "WL_RELEASE" ${CMAKE_CURRENT_SOURCE_DIR}) |
|
167 |
if(${FILE_WL_RELEASE} STREQUAL "FILE_WL_RELEASE-NOTFOUND") |
|
168 |
set(CMAKE_BUILD_TYPE Debug) |
|
169 |
else() |
|
170 |
set(CMAKE_BUILD_TYPE Release) |
|
171 |
endif() |
|
172 |
endif (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") |
|
173 |
||
174 |
if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
|
10120
by The Widelands Bunnybot
Resolve MSVC warnings (#5157) |
175 |
set(WL_DEBUG_FLAGS "-DDEBUG") |
176 |
if(NOT MSVC) |
|
177 |
wl_add_flag(WL_DEBUG_FLAGS "-g") |
|
178 |
if(NOT OPTION_TSAN) |
|
179 |
option(OPTION_ASAN "Build with AddressSanitizer" ON) |
|
180 |
endif() |
|
10070
by The Widelands Bunnybot
Resolve thread sanitizer issues (#5114) |
181 |
endif() |
10650
by The Widelands Bunnybot
Remove superfluous `SDL_GetModState()` calls (#5945) |
182 |
elseif((CMAKE_BUILD_TYPE STREQUAL "Release") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) |
10402
by The Widelands Bunnybot
Drop support for g++-5 and g++-6 (#5541) |
183 |
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.5)) |
184 |
message(STATUS "GCC >7.5.0 breaks -O3, setting -O2") |
|
8307.1.1
by Tino
when using GCC 6.3 only do -O2 |
185 |
set(WL_OPTIMIZE_FLAGS "-O2") |
10120
by The Widelands Bunnybot
Resolve MSVC warnings (#5157) |
186 |
elseif(MSVC) |
187 |
set(WL_OPTIMIZE_FLAGS "/O2") |
|
8307.1.1
by Tino
when using GCC 6.3 only do -O2 |
188 |
else() |
189 |
set(WL_OPTIMIZE_FLAGS "-O3") |
|
10650
by The Widelands Bunnybot
Remove superfluous `SDL_GetModState()` calls (#5945) |
190 |
endif() |
10402
by The Widelands Bunnybot
Drop support for g++-5 and g++-6 (#5541) |
191 |
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.6)) |
192 |
message(WARNING "GCC <7.6.0 is known to cause segfaults in release builds. Please consider upgrading to GCC version 7.6 or newer or using Clang. Adding selected overrides to suppress reporting of known bugs.") |
|
10124
by The Widelands Bunnybot
Fix older g++ optimization segfaults (#5176) |
193 |
wl_add_flag(WL_OPTIMIZE_FLAGS "--param asan-stack=0") |
194 |
endif() |
|
7688.1.2
by Tino
unix line endings |
195 |
set(WL_DEBUG_FLAGS "-DNDEBUG -DNOPARACHUTE") |
8508.1.1
by Holger Rapp
Only include ASAN in debug builds by default. |
196 |
option(OPTION_ASAN "Build with AddressSanitizer" OFF) |
9974
by The Widelands Bunnybot
cmake: add support for None build type (#5010) |
197 |
elseif(CMAKE_BUILD_TYPE STREQUAL "None") |
198 |
message(STATUS "Not setting any default flags.") |
|
7688.1.2
by Tino
unix line endings |
199 |
else() |
200 |
message(FATAL_ERROR "Unknown CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") |
|
201 |
endif() |
|
202 |
||
10070
by The Widelands Bunnybot
Resolve thread sanitizer issues (#5114) |
203 |
if(OPTION_TSAN) |
204 |
message(STATUS "Using ThreadSanitizer https://clang.llvm.org/docs/ThreadSanitizer.html") |
|
205 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-fsanitize=thread") |
|
206 |
set (CMAKE_EXE_LINKER_FLAGS "-fsanitize=thread" CACHE STRING "Set by widelands CMakeLists.txt" FORCE) |
|
207 |
option(OPTION_ASAN "Build with AddressSanitizer" OFF) |
|
208 |
else() |
|
209 |
message(STATUS "Not using ThreadSanitizer.") |
|
210 |
endif(OPTION_TSAN) |
|
7688.1.2
by Tino
unix line endings |
211 |
|
8496.1.1
by GunChleoc
Added compile options for AddressSanitizer and for choosing the compiler. 2 new warning flags for the clang compiler. |
212 |
if(OPTION_ASAN) |
9204
by The Widelands Bunnybot
Noordfrees: Launchpad mirror (#3766)\n\nMirrors all changes at widelands:master to lp:widelands (1d6b62c7619a182081e1c942ae533a95d6112044) |
213 |
message(STATUS "Using AddressSanitizer https://clang.llvm.org/docs/AddressSanitizer.html") |
214 |
# See https://clang.llvm.org/docs/AddressSanitizer.html
|
|
8496.1.1
by GunChleoc
Added compile options for AddressSanitizer and for choosing the compiler. 2 new warning flags for the clang compiler. |
215 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-fsanitize=address") |
216 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-fno-omit-frame-pointer") |
|
217 |
set (CMAKE_EXE_LINKER_FLAGS "-fsanitize=address" CACHE STRING "Set by widelands CMakeLists.txt" FORCE) |
|
10738
by The Widelands Bunnybot
Self-diagnose crashes (#6100) |
218 |
add_definitions(-DUSE_ASAN) |
8508.1.1
by Holger Rapp
Only include ASAN in debug builds by default. |
219 |
else() |
220 |
message(STATUS "Not using AddressSanitizer.") |
|
8496.1.1
by GunChleoc
Added compile options for AddressSanitizer and for choosing the compiler. 2 new warning flags for the clang compiler. |
221 |
endif(OPTION_ASAN) |
222 |
||
10070
by The Widelands Bunnybot
Resolve thread sanitizer issues (#5114) |
223 |
if(OPTION_ASAN AND OPTION_TSAN) |
224 |
message(FATAL_ERROR "OPTION_ASAN and OPTION_TSAN cannot be used together") |
|
225 |
endif() |
|
226 |
||
8866.1.6
by Toni Förster
add description remove unneeded line |
227 |
# This is set to avoid linker errors when using GLVND-libs on Linux
|
8866.1.4
by Toni Förster
set additional linker flags |
228 |
if("${OpenGL_GL_PREFERENCE}" STREQUAL "GLVND") |
10205
by The Widelands Bunnybot
Fetched translations and updated catalogs. |
229 |
link_libraries(OpenGL::GL) |
8866.1.14
by Toni Förster
add compile definition for GLVND |
230 |
add_compile_definitions(WL_USE_GLVND) |
8866.1.8
by Toni Förster
properly set CMP0054 and set message for GLVND linker flags |
231 |
message(STATUS "Adding linker flags for GLVND.") |
8866.1.4
by Toni Förster
set additional linker flags |
232 |
endif() |
233 |
||
7688.1.2
by Tino
unix line endings |
234 |
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") |
10221
by The Widelands Bunnybot
CMakeLists.txt: Use a list for many build flags (#5328) |
235 |
set(warn_disable_flags |
236 |
"-Weverything"
|
|
237 |
||
238 |
# Disabled warnings that are overly verbose right now or just do not make sense.
|
|
239 |
"-Wno-c++98-compat"
|
|
240 |
"-Wno-c++98-compat-pedantic"
|
|
241 |
"-Wno-conversion"
|
|
242 |
"-Wno-exit-time-destructors"
|
|
243 |
"-Wno-global-constructors"
|
|
244 |
"-Wno-padded"
|
|
245 |
"-Wno-sign-conversion"
|
|
246 |
"-Wno-missing-noreturn"
|
|
247 |
||
248 |
# It is impossible to write code that both GCC and Clang will like,
|
|
249 |
# so we have to switch off the warning for one of them.
|
|
250 |
# http://clang-developers.42468.n3.nabble.com/Question-on-Wswitch-enum-td4025927.html
|
|
251 |
"-Wno-switch-enum"
|
|
11008
by The Widelands Bunnybot
Fix new compiler warning on clang-18 (CB #4827 / GH #6465) |
252 |
"-Wno-covered-switch-default"
|
10221
by The Widelands Bunnybot
CMakeLists.txt: Use a list for many build flags (#5328) |
253 |
|
254 |
# TODO(sirver: weak-vtables should be enabled, but leads to lot of errors right now.
|
|
255 |
"-Wno-weak-vtables"
|
|
256 |
"-Wno-unreachable-code"
|
|
257 |
"-Wno-documentation"
|
|
258 |
"-Qunused-arguments"
|
|
259 |
"-Wint-to-void-pointer-cast"
|
|
260 |
)
|
|
261 |
foreach(flag IN LISTS warn_disable_flags) |
|
262 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS ${flag}) |
|
263 |
endforeach() |
|
264 |
||
8496.1.2
by GunChleoc
Older Clang versions to not recognize Winconsistent-missing-override. |
265 |
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.8) |
10221
by The Widelands Bunnybot
CMakeLists.txt: Use a list for many build flags (#5328) |
266 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Winconsistent-missing-override") |
8496.1.2
by GunChleoc
Older Clang versions to not recognize Winconsistent-missing-override. |
267 |
endif() |
10929
by The Widelands Bunnybot
Suppress unsafe buffer usage warning on Clang (CB #4770 / GH #6408) |
268 |
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 16) |
269 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-unsafe-buffer-usage") |
|
270 |
endif() |
|
9660
by The Widelands Bunnybot
Fix formatting action for branches on origin (#4500) |
271 |
elseif(MSVC) |
10448
by The Widelands Bunnybot
Fix clang-tidy C++17 checks (#5679) |
272 |
wl_add_flag(WL_GENERIC_CXX_FLAGS "/std:c++17") |
10120
by The Widelands Bunnybot
Resolve MSVC warnings (#5157) |
273 |
# https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/
|
274 |
# Disabled warnings that are overly verbose right now or just do not make sense.
|
|
275 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "/wd4244") |
|
276 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "/wd4267") |
|
277 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "/wd4018") |
|
278 |
# Use correct code page
|
|
279 |
wl_add_flag(WL_GENERIC_CXX_FLAGS "/utf-8") |
|
7688.1.2
by Tino
unix line endings |
280 |
else() |
8270.4.7
by Hans Joachim Desserud
Increase minimum required GCC version to 4.8. Additionally remove some workarounds required by 4.7 |
281 |
# Assuming GCC 4.8 or higher.
|
7688.1.2
by Tino
unix line endings |
282 |
if(WIN32) |
283 |
# This is needed for getenv().
|
|
10444
by The Widelands Bunnybot
Switch to C++17 (#5672) |
284 |
wl_add_flag(WL_GENERIC_CXX_FLAGS "-std=gnu++17") |
9468
by The Widelands Bunnybot
Build a static linked executable with msys2 (Appveyor&Github Workflow) (#3982) |
285 |
if (OPTION_BUILD_WINSTATIC) |
286 |
set(CMAKE_CXX_STANDARD_LIBRARIES "-static-libgcc -static-libstdc++ ${CMAKE_CXX_STANDARD_LIBRARIES}") |
|
287 |
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bstatic") |
|
288 |
endif() |
|
8349.4.20
by GunChleoc
Fixed the reduntant decls flag for windows. |
289 |
else() |
290 |
# SDL and MinGW both declare 'unsigned int __builtin_ia32_crc32qi(unsigned int, unsigned char)', resulting in lots of warnings. So, we can't have this flag in Windows.
|
|
291 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wredundant-decls") |
|
7688.1.2
by Tino
unix line endings |
292 |
endif() |
293 |
||
10221
by The Widelands Bunnybot
CMakeLists.txt: Use a list for many build flags (#5328) |
294 |
set(warn_flags |
295 |
"-Wall"
|
|
296 |
"-Wpedantic"
|
|
297 |
"-Wdeprecated-declarations"
|
|
298 |
"-Wextra"
|
|
299 |
"-Wformat"
|
|
300 |
"-Wformat-nonliteral"
|
|
301 |
"-Wformat-security"
|
|
302 |
"-Wformat-y2k"
|
|
303 |
"-Winit-self"
|
|
304 |
"-Winvalid-pch"
|
|
305 |
"-Wmissing-include-dirs"
|
|
306 |
"-Wno-undef"
|
|
307 |
"-Wold-style-cast"
|
|
308 |
"-Woverlength-strings"
|
|
309 |
"-Wpacked"
|
|
310 |
"-Wpointer-arith"
|
|
311 |
"-Wsign-promo"
|
|
312 |
"-Wundef"
|
|
313 |
"-Wunused"
|
|
314 |
"-Wunused-macros"
|
|
315 |
"-fno-elide-constructors" # Detect invalid constexpr initialization |
|
316 |
)
|
|
317 |
foreach(flag IN LISTS warn_flags) |
|
318 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS ${flag}) |
|
319 |
endforeach() |
|
10608
by The Widelands Bunnybot
Fix Compilation with GCC 13.1 and AppleClang (#5903) |
320 |
if (NOT APPLE) |
321 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wlogical-op") |
|
322 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wsync-nand") |
|
323 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wtrampolines") |
|
324 |
endif() |
|
7688.1.2
by Tino
unix line endings |
325 |
endif() |
326 |
||
10979
by The Widelands Bunnybot
Replace gettext with tinygettext (CB #4772 / GH #6411) |
327 |
# Some compilers need an extra library for filesystem support, while others don't know about it.
|
328 |
# If the detection is incorrect, you can override it by setting `-DNEEDS_EXTERNAL_FILESYSTEM=ON|OFF` explicitly.
|
|
329 |
if (NOT DEFINED NEEDS_EXTERNAL_FILESYSTEM) |
|
330 |
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1)) |
|
331 |
set(NEEDS_EXTERNAL_FILESYSTEM ON CACHE BOOL "Use linker flag for stdc++fs") |
|
332 |
else() |
|
333 |
set(NEEDS_EXTERNAL_FILESYSTEM OFF CACHE BOOL "Don't use linker flag for stdc++fs") |
|
334 |
endif() |
|
335 |
endif() |
|
336 |
if (NEEDS_EXTERNAL_FILESYSTEM) |
|
337 |
message(STATUS "Linking with external stdc++fs") |
|
338 |
endif() |
|
339 |
||
9660
by The Widelands Bunnybot
Fix formatting action for branches on origin (#4500) |
340 |
if(NOT MSVC) |
11050
by The Widelands Bunnybot
Fix RelWithDebInfo build type (CB #4854 / GH #6492) |
341 |
if((CMAKE_BUILD_TYPE STREQUAL "Release") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) |
10363
by The Widelands Bunnybot
Fix Spelling Errors in Comments (#5512) |
342 |
message(STATUS "Compiler warnings will be ignored.") |
10608
by The Widelands Bunnybot
Fix Compilation with GCC 13.1 and AppleClang (#5903) |
343 |
elseif(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND ( |
344 |
((NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.0)) AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.2)) |
|
10688
by The Widelands Bunnybot
Resolve compiler warnings (#6021) |
345 |
OR (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)) AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.1))) |
346 |
# Skip this on g++ versions 12.0, 12.1, and 13.0 because of false-positives from system headers.
|
|
10281
by The Widelands Bunnybot
Update testsuite compilers and OSs for Jammy (#5415) |
347 |
message(WARNING "This compiler is known to cause false-positive warnings.") |
348 |
else() |
|
10363
by The Widelands Bunnybot
Fix Spelling Errors in Comments (#5512) |
349 |
# Turn some warnings into errors.
|
350 |
message(STATUS "Warnings will be treated as errors.") |
|
10281
by The Widelands Bunnybot
Update testsuite compilers and OSs for Jammy (#5415) |
351 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Werror") |
10363
by The Widelands Bunnybot
Fix Spelling Errors in Comments (#5512) |
352 |
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)) |
353 |
# Silence some false positives on older g++
|
|
354 |
message(STATUS "Disabling known false-positive warnings for this compiler.") |
|
355 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-error=unused-variable") |
|
356 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-error=unused-but-set-parameter") |
|
357 |
endif() |
|
358 |
if (APPLE) # Our Mac CI needs these |
|
359 |
message(STATUS "Disabling known false-positive warnings for this environment.") |
|
360 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-error=poison-system-directories") |
|
361 |
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-error=disabled-macro-expansion") |
|
362 |
endif() |
|
10036
by The Widelands Bunnybot
Build System Update (#5085) |
363 |
endif() |
8182.2.23
by GunChleoc
All those #ifdef _WIN32 blocks are annoying, let's just try to get rid of -Wswitch-default in Windows. |
364 |
|
10444
by The Widelands Bunnybot
Switch to C++17 (#5672) |
365 |
wl_add_flag(WL_GENERIC_CXX_FLAGS "-std=c++17") |
9660
by The Widelands Bunnybot
Fix formatting action for branches on origin (#4500) |
366 |
endif() |
7688.1.2
by Tino
unix line endings |
367 |
|
9392
by The Widelands Bunnybot
Add cross-compile-unit optimization with Linux GCC. (#3879) |
368 |
# Cross-compile-unit optimization slows linking significantly.
|
369 |
# Therefore, impatient user may want to prevent that.
|
|
370 |
if(USE_FLTO_IF_AVAILABLE STREQUAL "yes") |
|
371 |
# Cross-compile-unit optimization not supported by gcc with debug on!
|
|
372 |
# Therefore, this may only be done with Release builds.
|
|
11050
by The Widelands Bunnybot
Fix RelWithDebInfo build type (CB #4854 / GH #6492) |
373 |
if((CMAKE_BUILD_TYPE STREQUAL "Release") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) |
9392
by The Widelands Bunnybot
Add cross-compile-unit optimization with Linux GCC. (#3879) |
374 |
# Only tested on Linux. Might work also on other platforms.
|
375 |
# If tested and found good, remove this check
|
|
376 |
if (CMAKE_SYSTEM MATCHES "Linux") |
|
377 |
# Usage of -flto tested only with gcc 8.3 and 9.3 (2020-04); when in doubt, leaving it out..
|
|
378 |
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)) |
|
379 |
#
|
|
380 |
# The execution jumps between compile units rather often. -flot allows optimization across
|
|
381 |
# comple units. Binary size reduced by >15% on tested environments. This does not directly
|
|
382 |
# translate to execution speed, but might still be noticeable.
|
|
383 |
#
|
|
384 |
# This is not related to -O2 or -O3 discussion, and not enable by either.
|
|
385 |
#
|
|
386 |
# If using lto, it needs to happen both during compile and link, else no benefits.
|
|
387 |
wl_add_flag(WL_GENERIC_CXX_FLAGS "-flto") |
|
388 |
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto") |
|
389 |
message(STATUS "Enabling link-time optimizations") |
|
390 |
endif() |
|
391 |
endif(CMAKE_SYSTEM MATCHES "Linux") |
|
11050
by The Widelands Bunnybot
Fix RelWithDebInfo build type (CB #4854 / GH #6492) |
392 |
endif((CMAKE_BUILD_TYPE STREQUAL "Release") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) |
9392
by The Widelands Bunnybot
Add cross-compile-unit optimization with Linux GCC. (#3879) |
393 |
endif(USE_FLTO_IF_AVAILABLE STREQUAL "yes") |
394 |
||
7688.1.2
by Tino
unix line endings |
395 |
IF (WIN32) |
10115
by The Widelands Bunnybot
Replace Boost::Asio → Asio (#5164) |
396 |
add_definitions(-D_WIN32_WINNT=0x0601) |
9660
by The Widelands Bunnybot
Fix formatting action for branches on origin (#4500) |
397 |
if(MSVC) |
10115
by The Widelands Bunnybot
Replace Boost::Asio → Asio (#5164) |
398 |
add_definitions(-DWIN32_LEAN_AND_MEAN -D__STDC_FORMAT_MACROS -DNOMINMAX) |
9660
by The Widelands Bunnybot
Fix formatting action for branches on origin (#4500) |
399 |
# Needed for minizip
|
400 |
add_definitions(-Dor=|| -Dand=&& -Dnot=!) |
|
401 |
else() |
|
402 |
add_definitions(-DMINGW_HAS_SECURE_API -DWIN32_LEAN_AND_MEAN -D__STDC_FORMAT_MACROS -D__USE_MINGW_ANSI_STDIO) |
|
403 |
if (CMAKE_SIZEOF_VOID_P EQUAL 4) |
|
404 |
set (CMAKE_EXE_LINKER_FLAGS "-Wl,--large-address-aware" CACHE STRING "Set by widelands CMakeLists.txt" FORCE) |
|
405 |
message (STATUS "Enabled large address awareness on mingw32") |
|
10853
by The Widelands Bunnybot
mingw dependency system (CB #4653 / GH #6290) |
406 |
message (WARNING "mingw compiler for 32 bit is deprecated, consider switching to 64-bit!") |
10846
by The Widelands Bunnybot
New Msys dependencies (GH #6281 / CB #4645) |
407 |
set(MINGW_SDL_IMG_DEPS webp webpdemux webpdecoder jbig deflate Lerc jxl hwy avif aom rav1e yuv dav1d sharpyuv ntdll) |
9660
by The Widelands Bunnybot
Fix formatting action for branches on origin (#4500) |
408 |
else (CMAKE_SIZEOF_VOID_P EQUAL 4) |
409 |
message (STATUS "Detected mingw32-w64") |
|
11014
by The Widelands Bunnybot
Remove AV1 decoder dependency in mingw-64 (CB #4837 / GH #6474) |
410 |
set(MINGW_SDL_IMG_DEPS webp webpdemux webpdecoder jbig deflate Lerc jxl hwy avif aom rav1e yuv dav1d SvtAv1Enc sharpyuv ntdll) |
9660
by The Widelands Bunnybot
Fix formatting action for branches on origin (#4500) |
411 |
endif (CMAKE_SIZEOF_VOID_P EQUAL 4) |
412 |
endif() |
|
10688
by The Widelands Bunnybot
Resolve compiler warnings (#6021) |
413 |
else() |
414 |
add_definitions(-DLUA_USE_POSIX) |
|
10628
by The Widelands Bunnybot
Remove hard-coded library paths for MinGW builds (#5921) |
415 |
endif() |
416 |
||
417 |
if(OPTION_BUILD_WINSTATIC) |
|
418 |
# Add required libraries for statical linking
|
|
10740
by The Widelands Bunnybot
Fix MinGW library linking order (#6111) |
419 |
wl_add_static_libs(SDL_IMG_STATIC_LIBS tiff jpeg lzma) |
10618
by The Widelands Bunnybot
Resolve static libraries during configuration (#5914) |
420 |
wl_add_static_libs(SDL_MIXER_STATIC_LIBS opusfile opus FLAC vorbisfile vorbis ogg mpg123 shlwapi) |
10628
by The Widelands Bunnybot
Remove hard-coded library paths for MinGW builds (#5921) |
421 |
wl_add_static_libs(SDL_TTF_STATIC_LIBS freetype bz2 graphite2 usp10 dwrite harfbuzz freetype rpcrt4) |
10979
by The Widelands Bunnybot
Replace gettext with tinygettext (CB #4772 / GH #6411) |
422 |
wl_add_static_libs(SDL_STATIC_LIBS dinput8 shell32 setupapi advapi32 uuid version oleaut32 ole32 imm32 winmm gdi32 user32) |
10783
by The Widelands Bunnybot
Rename brotli static dependency (GH #6177 / CB #4519) |
423 |
set(BROTLI brotlidec brotlicommon brotlienc) |
10628
by The Widelands Bunnybot
Remove hard-coded library paths for MinGW builds (#5921) |
424 |
if(MSVC) |
425 |
wl_add_static_libs(SDL_IMG_STATIC_LIBS libwebp) |
|
426 |
wl_add_static_libs(SDL_STATIC_LIBS charset ${BROTLI}) |
|
427 |
if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
|
428 |
string(REPLACE "/MDd" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}) |
|
429 |
wl_add_flag(TARGET_COMPILE_FLAGS "/MTd /EHsc") |
|
430 |
else() |
|
431 |
string(REPLACE "/MD" "" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) |
|
432 |
wl_add_flag(TARGET_COMPILE_FLAGS "/MT /EHsc") |
|
433 |
endif() |
|
434 |
else() |
|
10846
by The Widelands Bunnybot
New Msys dependencies (GH #6281 / CB #4645) |
435 |
wl_add_static_libs(SDL_IMG_STATIC_LIBS ${MINGW_SDL_IMG_DEPS}) |
10628
by The Widelands Bunnybot
Remove hard-coded library paths for MinGW builds (#5921) |
436 |
wl_add_static_libs(SDL_MIXER_STATIC_LIBS ssp) |
437 |
wl_add_static_libs(SDL_STATIC_LIBS mingw32 dxerr8 zstd ${BROTLI}) |
|
438 |
endif(MSVC) |
|
439 |
endif(OPTION_BUILD_WINSTATIC) |
|
7688.1.2
by Tino
unix line endings |
440 |
|
10738
by The Widelands Bunnybot
Self-diagnose crashes (#6100) |
441 |
if(NOT OPTION_ASAN) |
442 |
# Allow self-diagnosis for crashes if the system supports it (uses a GNU extension)
|
|
443 |
find_path(has_execinfo "execinfo.h") |
|
444 |
if(has_execinfo) |
|
445 |
message(STATUS "Adding crash self-diagnosis handler.") |
|
446 |
add_definitions(-DPRINT_SEGFAULT_BACKTRACE) |
|
447 |
if(NOT WIN32) |
|
448 |
# Needed for human-readable-ish symbolizing; doesn't hurt performance, see https://stackoverflow.com/q/12634114
|
|
449 |
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic") |
|
450 |
endif() |
|
451 |
endif() |
|
452 |
endif() |
|
453 |
||
7688.1.2
by Tino
unix line endings |
454 |
# on BSD this must be explicitly linked
|
11036
by The Widelands Bunnybot
Patches to support netbsd-pkgsrc (CB #4851 / GH #6489) |
455 |
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR |
456 |
CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR |
|
457 |
CMAKE_SYSTEM_NAME MATCHES "OpenBSD") |
|
7688.1.2
by Tino
unix line endings |
458 |
# Not needed on Debian GNU/kFreeBSD..
|
459 |
if (NOT CMAKE_SYSTEM_NAME MATCHES "kFreeBSD") |
|
460 |
find_library(EXECINFO_LIBRARY NAMES execinfo) |
|
461 |
endif (NOT CMAKE_SYSTEM_NAME MATCHES "kFreeBSD") |
|
8035.1.1
by Hans Joachim Desserud
When building on OpenBSD, compilation fails to find and include GL/glu.h unless the X11 include dir is added |
462 |
|
8035.1.2
by Hans Joachim Desserud
Comment style |
463 |
# OpenBSD needs the X11 include directory in order to find GL/glu.h
|
8035.1.1
by Hans Joachim Desserud
When building on OpenBSD, compilation fails to find and include GL/glu.h unless the X11 include dir is added |
464 |
if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD") |
465 |
find_package(X11 REQUIRED) |
|
466 |
include_directories(${X11_INCLUDE_DIR}) |
|
467 |
endif () |
|
11036
by The Widelands Bunnybot
Patches to support netbsd-pkgsrc (CB #4851 / GH #6489) |
468 |
endif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR |
469 |
CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR |
|
470 |
CMAKE_SYSTEM_NAME MATCHES "OpenBSD") |
|
7688.1.2
by Tino
unix line endings |
471 |
|
472 |
if (NOT DEFINED WL_VERSION) |
|
8853
by tino79
quick fix revision detection |
473 |
include (${CMAKE_SOURCE_DIR}/cmake/BzrRevision.cmake) |
7688.1.2
by Tino
unix line endings |
474 |
else (NOT DEFINED WL_VERSION) |
475 |
add_custom_target ( |
|
476 |
InputRevision ALL |
|
9098
by Dmitry Marakasov
Fix typo in CMakeLists.txt |
477 |
COMMAND ${CMAKE_COMMAND} -DWL_INSTALL_BASEDIR=${WL_INSTALL_BASEDIR} -DWL_VERSION=${WL_VERSION} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/InputRevision.cmake |
7688.1.2
by Tino
unix line endings |
478 |
)
|
479 |
endif (NOT DEFINED WL_VERSION) |
|
480 |
||
481 |
# Enable testing.
|
|
9148.2.1
by Notabilis
Adding compile.sh switch -s to skip building the tests. |
482 |
if (OPTION_BUILD_TESTS) |
483 |
include(CTest) |
|
484 |
enable_testing() |
|
7688.1.2
by Tino
unix line endings |
485 |
|
9148.2.1
by Notabilis
Adding compile.sh switch -s to skip building the tests. |
486 |
# Run a test after a normal compile. This magic is needed as 'make test' will
|
487 |
# not rebuild tests:
|
|
9204
by The Widelands Bunnybot
Noordfrees: Launchpad mirror (#3766)\n\nMirrors all changes at widelands:master to lp:widelands (1d6b62c7619a182081e1c942ae533a95d6112044) |
488 |
# https://stackoverflow.com/questions/733475/cmake-ctest-make-test-doesnt-build-tests
|
9148.2.1
by Notabilis
Adding compile.sh switch -s to skip building the tests. |
489 |
add_custom_target(_run_all_tests ALL |
490 |
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure |
|
491 |
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
|
492 |
DEPENDS wl_tests |
|
493 |
)
|
|
494 |
endif (OPTION_BUILD_TESTS) |
|
7688.1.2
by Tino
unix line endings |
495 |
|
496 |
install ( |
|
497 |
FILES ${CMAKE_CURRENT_BINARY_DIR}/VERSION |
|
7293.1.44
by fios at foramnagaidhlig
Scrapped the ImageCatalog. The datadir is now "./data" on a global level (CMake, g_fs). |
498 |
DESTINATION ${WL_INSTALL_BASEDIR} |
11050
by The Widelands Bunnybot
Fix RelWithDebInfo build type (CB #4854 / GH #6492) |
499 |
CONFIGURATIONS Debug;Release;RelWithDebInfo;None |
7688.1.2
by Tino
unix line endings |
500 |
COMPONENT CoreVersionFile |
501 |
)
|
|
502 |
||
11103
by The Widelands Bunnybot
Replace MD5 checksumming code with `libmd` (CB #4831 / GH #6469) |
503 |
# TODO(Nordfriese): Use this consistently in places in code that use various other tests for endianness
|
504 |
include(TestBigEndian) |
|
505 |
TEST_BIG_ENDIAN(IS_BIG_ENDIAN) |
|
506 |
if(IS_BIG_ENDIAN) |
|
507 |
message(STATUS "Byte order is big-endian") |
|
508 |
ADD_DEFINITIONS(-DWORDS_BIGENDIAN) |
|
509 |
else() |
|
510 |
message(STATUS "Byte order is little-endian") |
|
511 |
endif() |
|
512 |
||
7688.1.2
by Tino
unix line endings |
513 |
# Installation.
|
514 |
add_subdirectory(doc) |
|
515 |
add_subdirectory(src) |
|
516 |
||
517 |
# install files to the correct locations here
|
|
518 |
install( |
|
9942
by The Widelands Bunnybot
Autogenerate and compare datadir version file (#4853) |
519 |
FILES
|
520 |
data/datadirversion
|
|
521 |
DESTINATION ${WL_INSTALL_DATADIR} |
|
11050
by The Widelands Bunnybot
Fix RelWithDebInfo build type (CB #4854 / GH #6492) |
522 |
CONFIGURATIONS Debug;Release;RelWithDebInfo;None |
9942
by The Widelands Bunnybot
Autogenerate and compare datadir version file (#4853) |
523 |
COMPONENT VersionFile |
524 |
)
|
|
525 |
||
526 |
install( |
|
7688.1.2
by Tino
unix line endings |
527 |
DIRECTORY
|
8412.1.1
by tiborb95 at gmail
inserted missing ai entry in CMakeList.txt |
528 |
data/ai
|
7293.1.6
by fios at foramnagaidhlig
Moved scripting to data/scripting. |
529 |
data/campaigns
|
7293.1.11
by fios at foramnagaidhlig
Some cleanup. |
530 |
data/i18n
|
7293.1.43
by fios at foramnagaidhlig
Merged trunk. |
531 |
data/images
|
532 |
data/scripting
|
|
7802
by Holger Rapp
Unbreak installations: install shaders directory. |
533 |
data/shaders
|
8711
by GunChleoc
Added templates dir to CMake install. |
534 |
data/templates
|
7293.1.8
by fios at foramnagaidhlig
Moved tribes to data/tribes. |
535 |
data/tribes
|
7293.1.9
by fios at foramnagaidhlig
Moved txts to data/txts and txts/languages to data/i18n/languages. |
536 |
data/txts
|
7293.1.10
by fios at foramnagaidhlig
Moved world to data/world. |
537 |
data/world
|
7293.1.44
by fios at foramnagaidhlig
Scrapped the ImageCatalog. The datadir is now "./data" on a global level (CMake, g_fs). |
538 |
DESTINATION ${WL_INSTALL_DATADIR} |
11050
by The Widelands Bunnybot
Fix RelWithDebInfo build type (CB #4854 / GH #6492) |
539 |
CONFIGURATIONS Debug;Release;RelWithDebInfo;None |
7688.1.2
by Tino
unix line endings |
540 |
COMPONENT CoreDataFiles |
541 |
)
|
|
542 |
||
543 |
install( |
|
544 |
DIRECTORY
|
|
7293.1.4
by fios at foramnagaidhlig
Moved maps to data/maps. |
545 |
data/maps
|
7293.1.44
by fios at foramnagaidhlig
Scrapped the ImageCatalog. The datadir is now "./data" on a global level (CMake, g_fs). |
546 |
DESTINATION ${WL_INSTALL_DATADIR} |
11050
by The Widelands Bunnybot
Fix RelWithDebInfo build type (CB #4854 / GH #6492) |
547 |
CONFIGURATIONS Debug;Release;RelWithDebInfo;None |
7688.1.2
by Tino
unix line endings |
548 |
COMPONENT MapFiles |
549 |
)
|
|
550 |
||
551 |
install( |
|
552 |
DIRECTORY
|
|
7293.1.5
by fios at foramnagaidhlig
Moved music to data/music and sound to data/sound. All paths are now relative to these 2 directories. Moved the duck's sounds to data/sound/animals. |
553 |
data/music
|
554 |
data/sound
|
|
7293.1.44
by fios at foramnagaidhlig
Scrapped the ImageCatalog. The datadir is now "./data" on a global level (CMake, g_fs). |
555 |
DESTINATION ${WL_INSTALL_DATADIR} |
11050
by The Widelands Bunnybot
Fix RelWithDebInfo build type (CB #4854 / GH #6492) |
556 |
CONFIGURATIONS Debug;Release;RelWithDebInfo;None |
7688.1.2
by Tino
unix line endings |
557 |
COMPONENT MusicFiles |
558 |
)
|
|
559 |
||
560 |
install( |
|
561 |
FILES
|
|
562 |
COPYING
|
|
563 |
CREDITS
|
|
564 |
ChangeLog
|
|
7293.1.44
by fios at foramnagaidhlig
Scrapped the ImageCatalog. The datadir is now "./data" on a global level (CMake, g_fs). |
565 |
DESTINATION ${WL_INSTALL_BASEDIR} |
11050
by The Widelands Bunnybot
Fix RelWithDebInfo build type (CB #4854 / GH #6492) |
566 |
CONFIGURATIONS Debug;Release;RelWithDebInfo;None |
7688.1.2
by Tino
unix line endings |
567 |
COMPONENT CoreLicenseFiles |
568 |
)
|
|
569 |
||
570 |
install( |
|
571 |
DIRECTORY
|
|
572 |
doc
|
|
7293.1.44
by fios at foramnagaidhlig
Scrapped the ImageCatalog. The datadir is now "./data" on a global level (CMake, g_fs). |
573 |
DESTINATION ${WL_INSTALL_BASEDIR} |
7688.1.2
by Tino
unix line endings |
574 |
CONFIGURATIONS Debug |
575 |
COMPONENT DocFiles |
|
576 |
PATTERN "CMakeLists.txt" EXCLUDE |
|
577 |
)
|
|
578 |
||
9204
by The Widelands Bunnybot
Noordfrees: Launchpad mirror (#3766)\n\nMirrors all changes at widelands:master to lp:widelands (1d6b62c7619a182081e1c942ae533a95d6112044) |
579 |
if (UNIX AND NOT APPLE) |
580 |
add_subdirectory(xdg) |
|
581 |
endif (UNIX AND NOT APPLE) |
|
10268
by The Widelands Bunnybot
CMakeLists.txt: add custom uninstall target (#5358) |
582 |
|
583 |
# uninstall target
|
|
584 |
# see https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake
|
|
585 |
if(NOT TARGET uninstall) |
|
586 |
configure_file( |
|
587 |
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
|
588 |
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
|
|
589 |
IMMEDIATE @ONLY) |
|
590 |
||
591 |
add_custom_target(uninstall |
|
592 |
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake) |
|
593 |
endif() |
|
594 |