1
0
forked from 0ad/0ad

Enable C++14

Spidermonkey 60 can only be compiled with C++14. This conflicts with
building 0 A.D. with C++11, so upgrade to C++14 first.
This in itself should not drop compiler support on any platform.

Tested on Windows by: Stan
Tested on Linux by: Freagarach
Refs #5859
Refs #5862

Differential Revision: https://code.wildfiregames.com/D3124
This was SVN commit r24235.
This commit is contained in:
wraitii 2020-11-22 14:34:31 +00:00
parent 2288de4aa6
commit 15001ec798
2 changed files with 15 additions and 25 deletions

View File

@ -199,6 +199,13 @@ function project_set_build_flags()
-- being used as a DLL (which is currently not the case in 0ad)
defines { "LIB_STATIC_LINK" }
-- Enable C++14 standard.
filter "action:vs*"
buildoptions { "/std:c++14" }
filter "action:not vs*"
buildoptions { "-std=c++14" }
filter {}
-- various platform-specific build flags
if os.istarget("windows") then
@ -291,11 +298,6 @@ function project_set_build_flags()
end
end
buildoptions {
-- Enable C++11 standard.
"-std=c++0x"
}
if arch == "arm" then
-- disable warnings about va_list ABI change and use
-- compile-time flags for futher configuration.
@ -311,10 +313,10 @@ function project_set_build_flags()
links { "gcov" }
end
-- We don't want to require SSE2 everywhere yet, but OS X headers do
-- require it (and Intel Macs always have it) so enable it here
-- MacOS always provides SSE3 so enable that.
-- TODO: after <10.12 support is dropped, we can assume SSE4.1 is present.
if os.istarget("macosx") then
buildoptions { "-msse2" }
buildoptions { "-msse3" }
end
-- Check if SDK path should be used
@ -336,8 +338,7 @@ function project_set_build_flags()
defines { "BUNDLE_IDENTIFIER=" .. _OPTIONS["macosx-bundle"] }
end
-- On OS X, force using libc++ since it has better C++11 support,
-- now required by the game
-- Only libc++ is supported on MacOS
if os.istarget("macosx") then
buildoptions { "-stdlib=libc++" }
linkoptions { "-stdlib=libc++" }

View File

@ -61,13 +61,6 @@ FCOLLADA_VERSION="fcollada-3.05+wildfiregames.1"
# * OpenGL
# --------------------------------------------------------------
# Force build architecture, as sometimes environment is broken.
# For a universal fat binary, the approach would be to build every
# dependency with both archs and combine them with lipo, then do the
# same thing with the game itself.
# Choices are "x86_64" or "i386" (ppc and ppc64 not supported)
ARCH=${ARCH:="x86_64"}
# Define compiler as "clang", this is all Mavericks supports.
# gcc symlinks may still exist, but they are simply clang with
# slightly different config, which confuses build scripts.
@ -94,17 +87,14 @@ if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then
# and CRT version, and use it to set the macosx_version_min linker flag
LDFLAGS="$LDFLAGS -mmacosx-version-min=$MIN_OSX_VERSION"
fi
# Force using libc++ since it has better C++11 support required by the game
# but pre-Mavericks still use libstdc++ by default
# Also enable c++0x for consistency with the game build
C_FLAGS="$C_FLAGS -arch $ARCH -fvisibility=hidden"
LDFLAGS="$LDFLAGS -arch $ARCH -stdlib=libc++"
CFLAGS="$CFLAGS $C_FLAGS"
CXXFLAGS="$CXXFLAGS $C_FLAGS -stdlib=libc++ -std=c++0x"
CFLAGS="$CFLAGS $C_FLAGS -fvisibility=hidden"
CXXFLAGS="$CXXFLAGS $C_FLAGS -stdlib=libc++ -std=c++14 -msse3"
OBJCFLAGS="$OBJCFLAGS $C_FLAGS"
OBJCXXFLAGS="$OBJCXXFLAGS $C_FLAGS"
LDFLAGS="$LDFLAGS -stdlib=libc++"
JOBS=${JOBS:="-j2"}
set -e
@ -431,7 +421,6 @@ then
CONF_OPTS="--prefix=$INSTALL_DIR
--disable-shared
--enable-macosx_arch=$ARCH
--enable-unicode
--with-cocoa
--with-opengl