Skip to content

Commit

Permalink
Switch to C++17 for GUI.
Browse files Browse the repository at this point in the history
Adjust compiler flags to use `-std=gnu++17` for gcc/clang instead of
`-std=gnu++11` and `/std:c++17` for msvc.

Remove Ubuntu trusty job from travis (it's too old.)

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
  • Loading branch information
rkitover committed Sep 28, 2020
1 parent cb0933b commit 890f560
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Expand Up @@ -14,8 +14,6 @@ matrix:
# dist: bionic
# - env: BUILD_ENV=nostl XVFB_RUN=1
# dist: bionic
- env: BUILD_ENV=ubuntu-trusty XVFB_RUN=1
dist: trusty
- env: BUILD_ENV=ubuntu-xenial XVFB_RUN=1
- env: BUILD_ENV=ubuntu-xenial-minimal INSTALLDEPS_ARGS="--no-openal --no-ffmpeg" XVFB_RUN=1
- env: BUILD_ENV=ubuntu-xenial XVFB_RUN=1 CC=clang CXX=clang++
Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Expand Up @@ -678,7 +678,13 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)

include(CheckCXXCompilerFlag)

set(MY_CXX_FLAGS -std=gnu++11 -fexceptions)
check_cxx_compiler_flag(-std=gnu++17 GNUPP17_FLAG)

if(NOT GNUPP17_FLAG)
message(FATAL_ERROR "Your compiler does not support -std=gnu++17.")
endif()

set(MY_CXX_FLAGS -std=gnu++17 -fexceptions)

foreach(ARG ${MY_CXX_FLAGS})
set(MY_CXX_FLAGS_STR "${MY_CXX_FLAGS_STR} ${ARG}")
Expand Down Expand Up @@ -724,6 +730,8 @@ elseif(MSVC)
string(REGEX REPLACE "/[Ww][^ ]+" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
string(REGEX REPLACE "/[Ww][^ ]+" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

add_compile_options(/std:c++17)

if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_compile_options(/W4)
else()
Expand Down
4 changes: 2 additions & 2 deletions tools/builder/core.sh
Expand Up @@ -42,8 +42,8 @@ esac
export CPPFLAGS="$CPPFLAGS${CPPFLAGS:+ }-I\$BUILD_ROOT/root/include -DCURL_STATICLIB -DGRAPHITE2_STATIC"
export CFLAGS="$CFLAGS${CFLAGS:+ }-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -pthread -lm -DCURL_STATICLIB -DGRAPHITE2_STATIC"
export CXXFLAGS="$CXXFLAGS${CXXFLAGS:+ }-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -pthread -lm -DCURL_STATICLIB -DGRAPHITE2_STATIC"
export OBJCXXFLAGS="$OBJCXXFLAGS${OBJCXXFLAGS:+ }-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -pthread -lm -DCURL_STATICLIB -DGRAPHITE2_STATIC"
export CXXFLAGS="$CXXFLAGS${CXXFLAGS:+ }-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++17 -fpermissive -pthread -lm -DCURL_STATICLIB -DGRAPHITE2_STATIC"
export OBJCXXFLAGS="$OBJCXXFLAGS${OBJCXXFLAGS:+ }-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++17 -fpermissive -pthread -lm -DCURL_STATICLIB -DGRAPHITE2_STATIC"
export LDFLAGS="$LDFLAGS${LDFLAGS:+ }-fPIC -L\$BUILD_ROOT/root/lib -pthread -lm"
export STRIP="\${STRIP:-strip}"
Expand Down
4 changes: 2 additions & 2 deletions tools/builder/mingw.sh
Expand Up @@ -28,8 +28,8 @@ export BUILD_ENV
: ${HOST_CXX:=ccache g++}
: ${HOST_CPPFLAGS:="-I\$BUILD_ROOT/root/include"}
: ${HOST_CFLAGS:="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -pthread -lm"}
: ${HOST_CXXFLAGS:="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -pthread -lm"}
: ${HOST_OBJCXXFLAGS:="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -pthread -lm"}
: ${HOST_CXXFLAGS:="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++17 -fpermissive -pthread -lm"}
: ${HOST_OBJCXXFLAGS:="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++17 -fpermissive -pthread -lm"}
: ${HOST_LDFLAGS:="-fPIC -L\$BUILD_ROOT/root/lib -pthread -lm"}
: ${HOST_LIBS:=-lm}
: ${HOST_UUID_LIBS:=}
Expand Down
4 changes: 2 additions & 2 deletions tools/win/mac-cross-builder
Expand Up @@ -16,8 +16,8 @@ export CC='ccache clang'
export CXX='ccache clang++'
export CPPFLAGS="-I\$BUILD_ROOT/root/include -DICONV_CONST="
export CFLAGS="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind"
export CXXFLAGS="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -stdlib=libc++ -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind"
export OBJCXXFLAGS="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++11 -fpermissive -stdlib=libc++ -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind"
export CXXFLAGS="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++17 -fpermissive -stdlib=libc++ -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind"
export OBJCXXFLAGS="-fPIC -I\$BUILD_ROOT/root/include -L\$BUILD_ROOT/root/lib -std=gnu++17 -fpermissive -stdlib=libc++ -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -DICONV_CONST= -Wl,-no_compact_unwind"
export LDFLAGS="-fPIC -L\$BUILD_ROOT/root/lib -framework Carbon -framework Foundation -framework CoreServices -Wno-unused-command-line-argument -Wl,-no_compact_unwind"
EOF
}
Expand Down

0 comments on commit 890f560

Please sign in to comment.