Merge branch 'master' into jgrpp

# Conflicts:
#	CMakeLists.txt
#	cmake/CompileFlags.cmake
#	src/bridge_gui.cpp
#	src/saveload/afterload.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/town_sl.cpp
#	src/screenshot.cpp
#	src/screenshot.h
#	src/toolbar_gui.cpp
#	src/town.h
#	src/town_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2020-06-30 21:43:04 +01:00
45 changed files with 222 additions and 371 deletions

View File

@@ -31,8 +31,13 @@ macro(compile_flags)
# it does not appear to support the $<> tags.
add_compile_options(
"$<$<CONFIG:Debug>:-D_DEBUG>"
"$<$<CONFIG:Debug>:-D_FORTIFY_SOURCE=2>"
"$<$<NOT:$<CONFIG:Debug>>:-D_FORTIFY_SOURCE=2>" # FORTIFY_SOURCE should only be used in non-debug builds (requires -O1+)
)
if (MINGW)
add_link_options(
"$<$<NOT:$<CONFIG:Debug>>:-fstack-protector>" # Prevent undefined references when _FORTIFY_SOURCE > 0
)
endif (MINGW)
# Prepare a generator that checks if we are not a debug, and don't have asserts
# on. We need this later on to set some compile options for stable releases.
@@ -73,14 +78,34 @@ macro(compile_flags)
add_compile_options(-O2 -DNDEBUG)
endif(NOT CMAKE_BUILD_TYPE)
#add_compile_options(
# When we are a stable release (Release build + USE_ASSERTS not set),
# assertations are off, which trigger a lot of warnings. We disable
# these warnings for these releases.
#"$<${IS_STABLE_RELEASE}:-Wno-unused-variable>"
#"$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-parameter>"
#"$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-variable>"
#)
# When we are a stable release (Release build + USE_ASSERTS not set),
# assertations are off, which trigger a lot of warnings. We disable
# these warnings for these releases.
#if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# add_compile_options(
# "$<${IS_STABLE_RELEASE}:-Wno-unused-variable>"
# "$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-parameter>"
# "$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-variable>"
# )
#else (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# add_compile_options(
# "$<${IS_STABLE_RELEASE}:-Wno-unused-variable>"
# "$<${IS_STABLE_RELEASE}:-Wno-unused-parameter>"
# )
#endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Ninja processes the output so the output from the compiler
# isn't directly to a terminal; hence, the default is
# non-coloured output. We can override this to get nicely
# coloured output, but since that might yield odd results with
# IDEs, we extract it to an option.
if (OPTION_FORCE_COLORED_OUTPUT)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options (-fdiagnostics-color=always)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
add_compile_options (-fcolor-diagnostics)
endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
endif (OPTION_FORCE_COLORED_OUTPUT)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
include(CheckCXXCompilerFlag)

View File

@@ -58,7 +58,7 @@ elseif(CMAKE_CXX_COMPILER_LOADED)
include(CheckCXXSourceCompiles)
else()
# If neither C nor CXX are loaded, implicit iconv makes no sense.
set(Iconv_IS_BUILT_IN FALSE)
set(Iconv_IS_BUILT_IN NO)
endif()
# iconv can only be provided in libc on a POSIX system.
@@ -94,7 +94,7 @@ if(NOT DEFINED Iconv_IS_BUILT_IN)
endif()
cmake_pop_check_state()
else()
set(Iconv_IS_BUILT_IN FALSE)
set(Iconv_IS_BUILT_IN NO)
endif()
endif()

View File

@@ -48,6 +48,8 @@ function(set_options)
set(DEFAULT_OPTION_INSTALL_FHS OFF)
endif (UNIX AND NOT APPLE)
option(OPTION_FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." OFF)
option(OPTION_DEDICATED "Build dedicated server only (no GUI)" OFF)
option(OPTION_INSTALL_FHS "Install with Filesstem Hierarchy Standard folders" ${DEFAULT_OPTION_INSTALL_FHS})
option(OPTION_USE_ASSERTS "Use assertions; leave enabled for nightlies, betas, and RCs" ON)

View File

@@ -82,7 +82,7 @@ if (GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(REV_VERSION "${TAG}")
set(REV_ISTAG 1)
string(REGEX REPLACE "^[0-9.]*$" "" STABLETAG "${TAG}")
string(REGEX REPLACE "^[0-9.]+$" "" STABLETAG "${TAG}")
if (NOT STABLETAG STREQUAL "")
set(REV_ISSTABLETAG 1)
else ()