From 15001ec7984e65c38e04ce3090311513295f2cfc Mon Sep 17 00:00:00 2001 From: wraitii Date: Sun, 22 Nov 2020 14:34:31 +0000 Subject: [PATCH] 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. --- build/premake/premake5.lua | 21 +++++++++++---------- libraries/osx/build-osx-libs.sh | 19 ++++--------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/build/premake/premake5.lua b/build/premake/premake5.lua index fa9be2f7ea..2ded7e7e6c 100644 --- a/build/premake/premake5.lua +++ b/build/premake/premake5.lua @@ -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++" } diff --git a/libraries/osx/build-osx-libs.sh b/libraries/osx/build-osx-libs.sh index 3a3a064102..7dff9afbcc 100755 --- a/libraries/osx/build-osx-libs.sh +++ b/libraries/osx/build-osx-libs.sh @@ -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