diff --git a/.travis.yml b/.travis.yml index ef6c24b5..bf749c1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -145,6 +145,11 @@ matrix: - os: osx osx_image: xcode12 + - os: osx + osx_image: xcode12 + env: + - IMPLICIT_CONVERSIONS=OFF + # Linux / GCC - os: linux @@ -203,6 +208,16 @@ matrix: sources: ['ubuntu-toolchain-r-test'] packages: ['g++-9', 'ninja-build'] + - os: linux + compiler: gcc + env: + - COMPILER=g++-9 + - IMPLICIT_CONVERSIONS=OFF + addons: + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: ['g++-9', 'ninja-build'] + - os: linux compiler: gcc env: @@ -315,10 +330,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 implicit conversions + - if [[ "${IMPLICIT_CONVERSIONS}" == "" ]]; then export IMPLICIT_CONVERSIONS=ON; 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} -DJSON_ImplicitConversions=${IMPLICIT_CONVERSIONS} -DJSON_BuildTests=On -GNinja && cmake --build . --config Release - ctest -C Release --timeout 2700 -V -j - cd .. diff --git a/appveyor.yml b/appveyor.yml index 73788956..5836f88d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,6 +7,7 @@ environment: platform: x86 CXX_FLAGS: "" LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Visual Studio 14 2015 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 @@ -14,6 +15,7 @@ environment: platform: x86 CXX_FLAGS: "" LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Visual Studio 15 2017 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 @@ -21,6 +23,7 @@ environment: platform: x86 CXX_FLAGS: "" LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Visual Studio 16 2019 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 @@ -28,6 +31,7 @@ environment: platform: x64 CXX_FLAGS: "" LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Visual Studio 16 2019 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 @@ -36,6 +40,7 @@ environment: platform: x86 CXX_FLAGS: "" LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Ninja - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 @@ -44,6 +49,7 @@ environment: platform: x86 CXX_FLAGS: "" LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Ninja - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 @@ -51,6 +57,7 @@ environment: platform: x86 CXX_FLAGS: "" LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Visual Studio 14 2015 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 @@ -59,6 +66,7 @@ environment: name: with_win_header CXX_FLAGS: "" LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Visual Studio 14 2015 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 @@ -66,6 +74,7 @@ environment: platform: x86 CXX_FLAGS: "/permissive- /std:c++latest /utf-8" LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Visual Studio 15 2017 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 @@ -73,6 +82,15 @@ environment: platform: x86 CXX_FLAGS: "" LINKER_FLAGS: "" + CMAKE_OPTIONS: "-DJSON_ImplicitConversions=OFF" + GENERATOR: Visual Studio 16 2019 + + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + configuration: Release + platform: x64 + CXX_FLAGS: "" + LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Visual Studio 16 2019 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 @@ -80,6 +98,7 @@ environment: platform: x64 CXX_FLAGS: "" LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Visual Studio 14 2015 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 @@ -87,6 +106,7 @@ environment: platform: x64 CXX_FLAGS: "/permissive- /std:c++latest /Zc:__cplusplus /utf-8 /F4000000" LINKER_FLAGS: "/STACK:4000000" + CMAKE_OPTIONS: "" GENERATOR: Visual Studio 15 2017 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 @@ -94,6 +114,7 @@ environment: platform: x64 CXX_FLAGS: "" LINKER_FLAGS: "" + CMAKE_OPTIONS: "" GENERATOR: Visual Studio 16 2019 init: @@ -112,7 +133,7 @@ before_build: # for with_win_header build, inject the inclusion of Windows.h to the single-header library - ps: if ($env:name -Eq "with_win_header") { $header_path = "single_include\nlohmann\json.hpp" } - ps: if ($env:name -Eq "with_win_header") { "#include `n" + (Get-Content $header_path | Out-String) | Set-Content $header_path } - - if "%GENERATOR%"=="Ninja" (cmake . -G "%GENERATOR%" -DCMAKE_BUILD_TYPE="%configuration%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On) else (cmake . -G "%GENERATOR%" -A "%GENERATOR_PLATFORM%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On) + - if "%GENERATOR%"=="Ninja" (cmake . -G "%GENERATOR%" -DCMAKE_BUILD_TYPE="%configuration%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On "%CMAKE_OPTIONS%") else (cmake . -G "%GENERATOR%" -A "%GENERATOR_PLATFORM%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On "%CMAKE_OPTIONS%") build_script: - cmake --build . --config "%configuration%"