Skip to content

Commit

Permalink
Added CI build for C++20
Browse files Browse the repository at this point in the history
  • Loading branch information
fuersten committed Aug 22, 2024
1 parent 4426a92 commit c57c2ae
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
paths-ignore:
- "**/README.md"
- "**/CHANGELOG.md"
pull_request:
release:
branches:
Expand All @@ -24,6 +25,7 @@ jobs:
os: [ubuntu-22.04]
build_type: [Debug, Release]
cxx: [g++, clang++-15]
cxx_version: [17, 20]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
Expand All @@ -39,7 +41,7 @@ jobs:
- name: Configure
env:
CXX: ${{ matrix.cxx }}
run: mkdir build && cd build && cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCOVERAGE=${{ env.COVERAGE }} ..
run: mkdir build && cd build && cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} -DCOVERAGE=${{ env.COVERAGE }} ..
- name: Build
run: cmake --build build
- name: Test
Expand Down Expand Up @@ -98,12 +100,13 @@ jobs:
matrix:
os: [macos-12]
build_type: [Debug, Release]
cxx_version: [17, 20]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install doxygen
- name: Configure
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} ..
- name: Build
run: cmake --build build --config ${{ matrix.build_type }}
- name: Test
Expand Down Expand Up @@ -133,12 +136,13 @@ jobs:
matrix:
os: [windows-2022]
build_type: [Debug, Release]
cxx_version: [17, 20]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: choco install doxygen.install
- name: Configure
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} ..
- name: Build
run: cmake --build build --config ${{ matrix.build_type }}
- name: Test
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ build_xcode
check_loc.sh
ignore_files.txt
CMakeSettings.json
docker
docker
.DS_Store
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ include(cmake/fetch_valijson.cmake)

if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(CMAKE_CXX_STANDARD LESS 17)
message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 17, REXSapi only works with C++17 and above.")
Expand Down
2 changes: 1 addition & 1 deletion include/rexsapi/Types.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <rexsapi/Exception.hxx>
#include <rexsapi/Format.hxx>

#if __cplusplus >= 202002L || _MSVC_LANG >= 202002L
#if (__cplusplus >= 202002L || _MSVC_LANG >= 202002L) && not __APPLE__
#include <chrono>
namespace rexs_date = std::chrono;
namespace rexs_format = std;
Expand Down
2 changes: 1 addition & 1 deletion test/TypesTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ TEST_CASE("Datetime test")
SUBCASE("Parse")
{
const rexsapi::TDatetime dt{"2023-03-28T13:49:36+02:00"};
#if __cplusplus >= 202002L || _MSVC_LANG >= 202002L
#if (__cplusplus >= 202002L || _MSVC_LANG >= 202002L) && not __APPLE__
auto rexs_march = std::chrono::March;
#else
auto rexs_march = date::mar;
Expand Down

0 comments on commit c57c2ae

Please sign in to comment.