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

Feature c++20 #56

Merged
merged 14 commits into from
Aug 28, 2024
3 changes: 1 addition & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: BS_Custom
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
Expand All @@ -42,7 +42,6 @@ BraceWrapping:
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Linux
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeComma
BreakBeforeTernaryOperators: true
Expand Down
34 changes: 19 additions & 15 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 @@ -16,14 +17,15 @@ env:

jobs:
build-linux:
name: ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.cxx }}
name: ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.cxx }} CXX-${{matrix.cxx_version}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
build_type: [Debug, Release]
cxx: [g++, clang++-15]
cxx: [g++-11, 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 All @@ -62,7 +64,7 @@ jobs:
cat coverage.info | c++filt >coverage_filtered.info
genhtml coverage_filtered.info --output-directory html
- name: Archive code coverage results
if: ${{ env.COVERAGE == 'ON' }}
if: ${{ env.COVERAGE == 'ON' && matrix.cxx_version == 17 }}
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
Expand All @@ -81,29 +83,30 @@ jobs:
- name: Get package name
if: ${{ matrix.build_type == 'Release' && matrix.cxx == 'g++' }}
run: |
version=$(grep "project(" CMakeLists.txt | cut -d ' ' -f3)
version=$(grep "project(" CMakeLists.txt | cut -d ' ' -f3)
echo "VERSION=$version" >> "$GITHUB_ENV"
- name: Upload rexsapi package
if: ${{ matrix.build_type == 'Release' && matrix.cxx == 'g++' }}
if: ${{ matrix.build_type == 'Release' && matrix.cxx == 'g++' && matrix.cxx_version == 17 }}
uses: actions/upload-artifact@v4
with:
name: rexsapi-linux-${{env.VERSION}}
path: build/rexsapi-linux-*.zip

build-macos:
name: ${{ matrix.os }} ${{ matrix.build_type }}
name: ${{ matrix.os }} ${{ matrix.build_type }} CXX-${{matrix.cxx_version}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-12]
build_type: [Debug, Release]
cxx_version: [17, 20]
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install doxygen
run: brew install --cask 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 All @@ -116,29 +119,30 @@ jobs:
- name: Get package name
if: ${{ matrix.build_type == 'Release' }}
run: |
version=$(grep "project(" CMakeLists.txt | cut -d ' ' -f3)
version=$(grep "project(" CMakeLists.txt | cut -d ' ' -f3)
echo "VERSION=$version" >> "$GITHUB_ENV"
- name: Upload rexsapi package
if: ${{ matrix.build_type == 'Release' }}
if: ${{ matrix.build_type == 'Release' && matrix.cxx_version == 17 }}
uses: actions/upload-artifact@v4
with:
name: rexsapi-darwin-${{env.VERSION}}
path: build/rexsapi-darwin-*.zip

build-windows:
name: ${{ matrix.os }} ${{ matrix.build_type }}
name: ${{ matrix.os }} ${{ matrix.build_type }} CXX-${{matrix.cxx_version}}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
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 Expand Up @@ -167,7 +171,7 @@ jobs:
env.write(entry.format(m.group(1)))
shell: python
- name: Upload rexsapi package
if: ${{ matrix.build_type == 'Release' }}
if: ${{ matrix.build_type == 'Release' && matrix.cxx_version == 17 }}
uses: actions/upload-artifact@v4
with:
name: rexsapi-windows-${{env.VERSION}}
Expand All @@ -188,7 +192,7 @@ jobs:
changelog_file: CHANGELOG.md
- name: Get release name
run: |
version=$(grep "project(" CMakeLists.txt | cut -d ' ' -f3)
version=$(grep "project(" CMakeLists.txt | cut -d ' ' -f3)
echo "VERSION=$version" >> "$GITHUB_ENV"
- uses: actions/download-artifact@v4
with:
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.1.0]

### Fixed

- Code now builds with C++20 and C++23 (#53)
- Clang format style file fixed (#54)

## [2.0.0]

### Fixed
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.22)
project(rexsapi VERSION 2.0.0 LANGUAGES CXX)
project(rexsapi VERSION 2.1.0 LANGUAGES CXX)

include(FetchContent)

Expand Down 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 All @@ -45,7 +45,7 @@ message(STATUS "Building for ${PLATFORM_NAME}")

if(NOT APPLE AND UNIX)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(REXSAPI_COMPILE_OPTIONS -Wall -Wheader-hygiene -Wcast-align -Wconversion -Wfloat-equal -Wformat=2 -Wmissing-declarations -Woverlength-strings -Wshadow -Wunreachable-code -Wextra -Wpedantic -Wnon-virtual-dtor -Werror -Wno-nested-anon-types -Wdelete-non-virtual-dtor -Wdeprecated -Wfloat-conversion -Wfloat-overflow-conversion -Wmove -Wredundant-move -Wshadow-all -Wsign-compare -Wsign-conversion -Wunreachable-code -Wunused-value -Wignored-qualifiers -Wno-unused-private-field)
set(REXSAPI_COMPILE_OPTIONS -Wall -Wheader-hygiene -Wcast-align -Wconversion -Wfloat-equal -Wformat=2 -Wmissing-declarations -Woverlength-strings -Wshadow -Wextra -Wpedantic -Wnon-virtual-dtor -Werror -Wno-nested-anon-types -Wdelete-non-virtual-dtor -Wdeprecated -Wfloat-conversion -Wfloat-overflow-conversion -Wmove -Wredundant-move -Wshadow-all -Wsign-compare -Wsign-conversion -Wunreachable-code -Wunused-value -Wignored-qualifiers -Wno-unused-private-field)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(REXSAPI_COMPILE_OPTIONS -Wall -Wcast-align -Wconversion -Wfloat-equal -Wformat=2 -Wmissing-declarations -Woverlength-strings -Wshadow -Wunreachable-code -Wextra -Wnon-virtual-dtor -Werror -Wno-psabi -Wignored-qualifiers -Wpedantic)
else()
Expand All @@ -54,7 +54,7 @@ if(NOT APPLE AND UNIX)
elseif(WIN32)
set(REXSAPI_COMPILE_OPTIONS /W4 /WX)
elseif(APPLE)
set(REXSAPI_COMPILE_OPTIONS -g -Wall -Wheader-hygiene -Wcast-align -Wconversion -Wfloat-equal -Wformat=2 -Wmissing-declarations -Woverlength-strings -Wshadow -Wunreachable-code -Wextra -Wpedantic -Wnon-virtual-dtor -Werror -Wno-nested-anon-types -Wdelete-non-virtual-dtor -Wdeprecated -Wfloat-conversion -Wfloat-overflow-conversion -Wmove -Wredundant-move -Wshadow-all -Wsign-compare -Wsign-conversion -Wunreachable-code -Wunused-value -Wignored-qualifiers -Wno-unused-private-field)
set(REXSAPI_COMPILE_OPTIONS -g -Wall -Wheader-hygiene -Wcast-align -Wconversion -Wfloat-equal -Wformat=2 -Wmissing-declarations -Woverlength-strings -Wshadow -Wextra -Wpedantic -Wnon-virtual-dtor -Werror -Wno-nested-anon-types -Wdelete-non-virtual-dtor -Wdeprecated -Wfloat-conversion -Wfloat-overflow-conversion -Wmove -Wredundant-move -Wshadow-all -Wsign-compare -Wsign-conversion -Wunreachable-code -Wunused-value -Wignored-qualifiers -Wno-unused-private-field)
else()
message(FATAL_ERROR "unsupported platform")
endif()
Expand Down
Loading
Loading