From 91ad35896e4741801e754b70fc27acb92341e01c Mon Sep 17 00:00:00 2001 From: Philip Trettner <Philip.Trettner@rwth-aachen.de> Date: Mon, 15 Apr 2019 10:18:02 +0200 Subject: [PATCH] c++14 support --- .gitlab-ci.yml | 4 ++-- CI/ci-linux.sh | 11 ++--------- CMakeLists.txt | 6 ++++++ extern/typed-geometry | 2 +- tests/objects/cube-test.cc | 4 ++++ 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a9bd5b9..758ca3a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,7 +38,7 @@ clang-buster: gcc-stretch: stage: Build - script: "CI/ci-linux.sh gcc" + script: "CI/ci-linux.sh gcc C++14" variables: GIT_SUBMODULE_STRATEGY: recursive tags: @@ -47,7 +47,7 @@ gcc-stretch: clang-stretch: stage: Build - script: "CI/ci-linux.sh clang" + script: "CI/ci-linux.sh clang C++14" variables: GIT_SUBMODULE_STRATEGY: recursive tags: diff --git a/CI/ci-linux.sh b/CI/ci-linux.sh index ed52509..71d81bc 100755 --- a/CI/ci-linux.sh +++ b/CI/ci-linux.sh @@ -26,16 +26,9 @@ elif [ "$COMPILER" == "clang" ]; then BUILDPATH="clang" fi -if [ "$LANGUAGE" == "C++98" ]; then - echo "Building with C++98"; - BUILDPATH="$BUILDPATH-cpp98" -elif [ "$LANGUAGE" == "C++11" ]; then - echo "Building with C++11"; - OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++11' " - BUILDPATH="$BUILDPATH-cpp11" -elif [ "$LANGUAGE" == "C++14" ]; then +if [ "$LANGUAGE" == "C++14" ]; then echo "Building with C++14"; - OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++14' " + OPTIONS="$OPTIONS -DPM_FORCE_CPP14=ON " BUILDPATH="$BUILDPATH-cpp14" fi diff --git a/CMakeLists.txt b/CMakeLists.txt index 70affe4..fc6cabb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,12 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) option(PM_BUILD_TESTS "Build polymesh tests" OFF) +option(PM_FORCE_CPP14 "Build samples and tests with C++14" OFF) + +if (PM_FORCE_CPP14) + set(CMAKE_CXX_STANDARD 14) +endif() + # ============================================================================== # Set bin dir if(MSVC) diff --git a/extern/typed-geometry b/extern/typed-geometry index 43a2602..5fa82f7 160000 --- a/extern/typed-geometry +++ b/extern/typed-geometry @@ -1 +1 @@ -Subproject commit 43a260233fafd9c92d49b27242311989dc1a78c1 +Subproject commit 5fa82f7024ea8f590893cccbb00ed3243eb26926 diff --git a/tests/objects/cube-test.cc b/tests/objects/cube-test.cc index 701d36f..06c54c8 100644 --- a/tests/objects/cube-test.cc +++ b/tests/objects/cube-test.cc @@ -1,3 +1,5 @@ +#ifdef TG_SUPPORT_CXX17 + #include <doctest.hh> #include <glm/glm.hpp> @@ -178,3 +180,5 @@ TEST_CASE("Objects.CubePropertiesGlm") m2.assert_consistency(); } } + +#endif -- GitLab