Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add travis task : compile and test under C++17 #2241

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,17 @@ matrix:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-9', 'ninja-build']

- os: linux
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a test case above that sets CXXFLAGS=-std=c++2a. Maybe this can be reused.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, It seems that CXXFLAGS=-std=c++1z didn't work under c++17.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CXXFLAGS=-std... is overriden by compile feature cxx_std_11 in top-level CMakeLists.txt (and by CMAKE_CXX_STANDARD, if it is present; see comment in #2117)

compiler: gcc
env:
- COMPILER=g++-9
dota17 marked this conversation as resolved.
Show resolved Hide resolved
- CXXFLAGS=-std=c++17
- CMAKE_CXX_STANDARD=17
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-9', 'ninja-build']

# Linux / Clang

- os: linux
Expand Down Expand Up @@ -297,6 +308,7 @@ matrix:
env:
- COMPILER=clang++-7
- CXXFLAGS=-std=c++1z
- CMAKE_CXX_STANDARD=17
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-7']
Expand All @@ -320,10 +332,12 @@ script:
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
# by default, use the single-header version
- if [[ "${MULTIPLE_HEADERS}" == "" ]]; then export MULTIPLE_HEADERS=OFF; fi
# by default, use the cxx11 standard
- if [[ "${CMAKE_CXX_STANDARD}" == "" ]]; then export CMAKE_CXX_STANDARD=11; fi

# compile and execute unit tests
- mkdir -p build && cd build
- cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -DJSON_BuildTests=On -GNinja && cmake --build . --config Release
- cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} -DJSON_BuildTests=On -GNinja && cmake --build . --config Release ;
- ctest -C Release --timeout 2700 -V -j
- cd ..

Expand Down