Skip to content

Commit

Permalink
Add support of C++17 standard
Browse files Browse the repository at this point in the history
  • Loading branch information
mikir committed Feb 19, 2024
1 parent c46556f commit 467c95c
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 5 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,36 @@ jobs:
os: ["ubuntu-20.04"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
java-version: ["8"]
cxx-standard-version: ["11"]
gcc-version: ["7"]
clang-version: ["11"]
include:
# Java 11
- os: "ubuntu-20.04"
python-version: "3.8"
java-version: "11"
cxx-standard-version: "11"
gcc-version: "7"
clang-version: "11"
# Java 17
- os: "ubuntu-20.04"
python-version: "3.8"
java-version: "17"
cxx-standard-version: "11"
gcc-version: "7"
clang-version: "11"
# Ubuntu 22.04, gcc 11 with gcovr, Clang 14 (needed for clang-format and clang-tidy)
# Ubuntu 22.04, C++11, gcc 11 with gcovr, Clang 14 (needed for clang-format and clang-tidy)
- os: "ubuntu-22.04"
python-version: "3.8"
java-version: "8"
cxx-standard-version: "11"
gcc-version: "11"
clang-version: "14"
# Ubuntu 22.04, C++17, gcc 11 with gcovr, Clang 14 (needed for clang-format and clang-tidy), C++17
- os: "ubuntu-22.04"
python-version: "3.8"
java-version: "8"
cxx-standard-version: "17"
gcc-version: "11"
clang-version: "14"
name: |
Expand All @@ -47,6 +58,7 @@ jobs:
MYPY_ENABLED: 1
NU_HTML_VALIDATOR: "${{github.workspace}}/vnu-20.6.30/vnu.jar"
XMLLINT_ENABLED: 1
CMAKE_CXX_STANDARD: "${{matrix.cxx-standard-version}}"
GCC_VERSION_SUFFIX: "-${{matrix.gcc-version}}"
CLANG_VERSION_SUFFIX: "-${{matrix.clang-version}}"
CMAKE_BUILD_OPTIONS: "-j2"
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,36 @@ jobs:
os: ["windows-2022"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
java-version: ["8"]
cxx-standard-version: ["11"]
msvc-toolset-version: ["v141"]
mingw-version: ["7.5.0"]
include:
# Java 11
- os: "windows-2022"
python-version: "3.8"
java-version: "11"
cxx-standard-version: "11"
msvc-toolset-version: "v141"
mingw-version: "7.5.0"
# Java 17
- os: "windows-2022"
python-version: "3.8"
java-version: "17"
cxx-standard-version: "11"
msvc-toolset-version: "v141"
mingw-version: "7.5.0"
# MSVC toolset v142 (MSVC 2019), MinGW 9.4.0
# C++11, MSVC toolset v142 (MSVC 2019), MinGW 9.4.0
- os: "windows-2022"
python-version: "3.8"
java-version: "8"
cxx-standard-version: "11"
msvc-toolset-version: "v142"
mingw-version: "9.4.0"
# C++17, MSVC toolset v142 (MSVC 2019), MinGW 9.4.0
- os: "windows-2022"
python-version: "3.8"
java-version: "8"
cxx-standard-version: "17"
msvc-toolset-version: "v142"
mingw-version: "9.4.0"
name: |
Expand All @@ -47,6 +58,7 @@ jobs:
MYPY_ENABLED: 1
NU_HTML_VALIDATOR: "${{github.workspace}}/vnu-20.6.30/vnu.jar"
XMLLINT_ENABLED: 1
CMAKE_CXX_STANDARD: "${{matrix.cxx-standard-version}}"
MINGW64_TOOLCHAIN_ROOT: "/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64"
MSVC_CMAKE_TOOLSET: ${{matrix.msvc-toolset-version}}
steps:
Expand Down
4 changes: 4 additions & 0 deletions compiler/extensions/cpp/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ set(ZSERIO_CODE_COVERAGE_ENABLE OFF CACHE BOOL "Enable unit test code coverage c
set(ZSERIO_CODE_COVERAGE_FAIL_ON_INCOMPLETE ON CACHE BOOL
"Fail build if line coverage is not below this threshold.")

set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard to use.")
set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "Whether C++ standard is required.")
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Whether compiler specific C++ standard extensions are allowed.")

# cmake helpers
include(cmake_utils)

Expand Down
6 changes: 6 additions & 0 deletions compiler/extensions/cpp/runtime/ClangTidySuppressions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,9 @@ google-explicit-constructor:test/zserio/TrackingAllocator.h:78
# Intentional tests.
performance-move-const-arg:test/zserio/PolymorphicAllocatorTest.cpp:58
performance-move-const-arg:test/zserio/PolymorphicAllocatorTest.cpp:78

# Intentional tests.
modernize-avoid-bind:test/zserio/BitStreamTest.cpp:635
modernize-avoid-bind:test/zserio/BitStreamTest.cpp:658
modernize-avoid-bind:test/zserio/BitStreamTest.cpp:673
modernize-avoid-bind:test/zserio/ReflectableTest.cpp
1 change: 0 additions & 1 deletion compiler/extensions/cpp/runtime/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,4 @@ set(ZSERIO_CPP_RUNTIME_LIB_SRCS

add_library(${PROJECT_NAME} STATIC ${ZSERIO_CPP_RUNTIME_LIB_SRCS})

set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
1 change: 0 additions & 1 deletion compiler/extensions/cpp/runtime/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ add_executable(${PROJECT_NAME}
${ZSERIO_CPP_RUNTIME_TEST_SRCS}
${ZSERIO_CPP_RUNTIME_TEST_HEADERS})

set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO)
target_include_directories(${PROJECT_NAME} PRIVATE .)
target_include_directories(${PROJECT_NAME} PRIVATE ../src)
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${SQLITE_INCDIR})
Expand Down
5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ set(ZSERIO_RELEASE_ROOT "${ZSERIO_PROJECT_ROOT}/distr" CACHE PATH "Root director
set(ZSERIO_USE_BUNDLE ON CACHE BOOL "Generate code using zserio.jar instead of core+cpp.jar directly.")
set(ZSERIO_TEST_SUITES "**" CACHE STRING "List of test suites to run. Default is '**'.")

set(CMAKE_CXX_STANDARD 11 CACHE STRING "The C++ standard to use.")
set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "Whether C++ standard is required.")
set(CMAKE_CXX_EXTENSIONS OFF CACHE BOOL "Whether compiler specific C++ standard extensions are allowed.")

# cmake helpers
set(CMAKE_MODULE_PATH ${ZSERIO_PROJECT_ROOT}/cmake)

Expand All @@ -32,7 +36,6 @@ include(cppcheck_utils)

# setup compiler
include(compiler_utils)
set(CMAKE_CXX_STANDARD 11)
compiler_set_pthread()
compiler_set_static_clibs()

Expand Down

0 comments on commit 467c95c

Please sign in to comment.