From f92ee24fbc0a84287e42d29da59dd86809b12a02 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Sun, 6 Nov 2022 20:40:18 +0700 Subject: [PATCH 1/6] use cmake presets for CI --- .github/workflows/darwin.yml | 11 +++++---- .github/workflows/linux.yml | 5 +++- .github/workflows/windows.yml | 13 +++++++---- CMakePresets.json | 43 +++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 10 deletions(-) diff --git a/.github/workflows/darwin.yml b/.github/workflows/darwin.yml index 5d50da2..9164866 100644 --- a/.github/workflows/darwin.yml +++ b/.github/workflows/darwin.yml @@ -10,9 +10,9 @@ jobs: matrix: config: # https://github.com/actions/virtual-environments/tree/main/images/macos - - { os: "macos-11", xcode: "13.0" } - - { os: "macos-11", xcode: "13.1" } - - { os: "macos-11", xcode: "13.2" } + - { os: "macos-11", xcode: "13.0", arch: "x64" } + - { os: "macos-11", xcode: "13.1", arch: "x64" } + - { os: "macos-11", xcode: "13.2", arch: "x64" } name: "xcode-${{matrix.config.xcode}}" steps: - uses: actions/checkout@v2 @@ -21,4 +21,7 @@ jobs: - name: Select Xcode run: sudo xcode-select --switch "/Applications/Xcode_${{matrix.config.xcode}}.app" - name: Build && Test - run: .ci/build_darwin.sh + run: | + cmake --preset macos-${{matrix.config.arch}} + cmake --build --preset macos-${{matrix.config.arch}}-release + ctest --preset macos-${{matrix.config.arch}}-release \ No newline at end of file diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index b1296ea..696d813 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -21,5 +21,8 @@ jobs: with: submodules: recursive - name: Build && Test - run: .ci/build_linux.sh env: { CC: "${{matrix.config.cc}}", CXX: "${{matrix.config.cxx}}" } + run: | + cmake --preset linux-${{matrix.config.cc}} + cmake --build --preset linux-${{matrix.config.cc}}-release + ctest --preset linux-${{matrix.config.cc}}-release diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5d154bd..45d65c8 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -10,14 +10,17 @@ jobs: matrix: config: # https://github.com/actions/virtual-environments/tree/main/images/win - - { os: "windows-2019", vs: "Visual Studio 2019", arch: "x86" } - - { os: "windows-2019", vs: "Visual Studio 2019", arch: "x64" } - - { os: "windows-2022", vs: "Visual Studio 2022", arch: "x86" } - - { os: "windows-2022", vs: "Visual Studio 2022", arch: "x64" } + - { os: "windows-2019", vs: "msvc2019", arch: "x86" } + - { os: "windows-2019", vs: "msvc2019", arch: "x64" } + - { os: "windows-2022", vs: "msvc2022", arch: "x86" } + - { os: "windows-2022", vs: "msvc2022", arch: "x64" } name: "${{matrix.config.vs}} ${{matrix.config.arch}}" steps: - uses: actions/checkout@v2 with: submodules: recursive - name: Build && Test - run: .ci\build_windows_${{matrix.config.arch}}.bat + run: | + cmake --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}} + cmake --build --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release + ctest --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release diff --git a/CMakePresets.json b/CMakePresets.json index d337037..64be4f6 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -241,5 +241,48 @@ "configuration": "Release", "configurePreset": "windows-x64-msvc2022" } + ], + + "testPresets": [ + { + "name": "linux-gcc10-release", + "configuration": "Release", + "configurePreset": "linux-gcc10" + }, + { + "name": "linux-clang10-release", + "configuration": "Release", + "configurePreset": "linux-clang10" + }, + { + "name": "macos-arm64-release", + "configuration": "Release", + "configurePreset": "macos-arm64" + }, + { + "name": "macos-x64-release", + "configuration": "Release", + "configurePreset": "macos-x64" + }, + { + "name": "windows-x86-msvc2019-release", + "configuration": "Release", + "configurePreset": "windows-x86-msvc2019" + }, + { + "name": "windows-x64-msvc2019-release", + "configuration": "Release", + "configurePreset": "windows-x64-msvc2019" + }, + { + "name": "windows-x86-msvc2022-release", + "configuration": "Release", + "configurePreset": "windows-x86-msvc2022" + }, + { + "name": "windows-x64-msvc2022-release", + "configuration": "Release", + "configurePreset": "windows-x64-msvc2022" + } ] } From a0119d38b6030040dc012ce9c72a0314fe5d9054 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Sun, 6 Nov 2022 20:46:21 +0700 Subject: [PATCH 2/6] fix cmake presets --- .github/workflows/darwin.yml | 2 ++ .github/workflows/windows.yml | 10 +++++----- CMakePresets.json | 28 ++++++++++++++-------------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/darwin.yml b/.github/workflows/darwin.yml index 9164866..cf9f811 100644 --- a/.github/workflows/darwin.yml +++ b/.github/workflows/darwin.yml @@ -18,6 +18,8 @@ jobs: - uses: actions/checkout@v2 with: submodules: recursive + - name: Install ninja by Homebrew + run: brew install ninja - name: Select Xcode run: sudo xcode-select --switch "/Applications/Xcode_${{matrix.config.xcode}}.app" - name: Build && Test diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 45d65c8..f5a8569 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -10,11 +10,11 @@ jobs: matrix: config: # https://github.com/actions/virtual-environments/tree/main/images/win - - { os: "windows-2019", vs: "msvc2019", arch: "x86" } - - { os: "windows-2019", vs: "msvc2019", arch: "x64" } - - { os: "windows-2022", vs: "msvc2022", arch: "x86" } - - { os: "windows-2022", vs: "msvc2022", arch: "x64" } - name: "${{matrix.config.vs}} ${{matrix.config.arch}}" + - { os: "windows-2019", vc: "msvc2019", arch: "x86" } + - { os: "windows-2019", vc: "msvc2019", arch: "x64" } + - { os: "windows-2022", vc: "msvc2022", arch: "x86" } + - { os: "windows-2022", vc: "msvc2022", arch: "x64" } + name: "${{matrix.config.vc}} ${{matrix.config.arch}}" steps: - uses: actions/checkout@v2 with: diff --git a/CMakePresets.json b/CMakePresets.json index 64be4f6..cf01395 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -29,7 +29,7 @@ } }, { - "name": "linux-clang10", + "name": "linux-clang-10", "inherits": "linux-base", "cacheVariables": { "CMAKE_C_COMPILER": "clang-10", @@ -37,7 +37,7 @@ } }, { - "name": "linux-gcc10", + "name": "linux-gcc-10", "inherits": "linux-base", "cacheVariables": { "CMAKE_C_COMPILER": "gcc-10", @@ -162,24 +162,24 @@ "buildPresets": [ { - "name": "linux-clang10-debug", + "name": "linux-clang-10-debug", "configuration": "Debug", - "configurePreset": "linux-clang10" + "configurePreset": "linux-clang-10" }, { - "name": "linux-clang10-release", + "name": "linux-clang-10-release", "configuration": "Release", - "configurePreset": "linux-clang10" + "configurePreset": "linux-clang-10" }, { - "name": "linux-gcc10-debug", + "name": "linux-gcc-10-debug", "configuration": "Debug", - "configurePreset": "linux-gcc10" + "configurePreset": "linux-gcc-10" }, { - "name": "linux-gcc10-release", + "name": "linux-gcc-10-release", "configuration": "Release", - "configurePreset": "linux-gcc10" + "configurePreset": "linux-gcc-10" }, { "name": "macos-arm64-debug", @@ -245,14 +245,14 @@ "testPresets": [ { - "name": "linux-gcc10-release", + "name": "linux-gcc-10-release", "configuration": "Release", - "configurePreset": "linux-gcc10" + "configurePreset": "linux-gcc-10" }, { - "name": "linux-clang10-release", + "name": "linux-clang-10-release", "configuration": "Release", - "configurePreset": "linux-clang10" + "configurePreset": "linux-clang-10" }, { "name": "macos-arm64-release", From 334c4369faf27305d0d80464e9d2e95d027a40a9 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Sun, 6 Nov 2022 21:03:31 +0700 Subject: [PATCH 3/6] fix CI scripts --- .github/workflows/darwin.yml | 14 ++++++++------ .github/workflows/linux.yml | 7 ++++--- .github/workflows/windows.yml | 11 +++++++++-- singles/CMakeLists.txt | 4 ++-- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/darwin.yml b/.github/workflows/darwin.yml index cf9f811..d88b241 100644 --- a/.github/workflows/darwin.yml +++ b/.github/workflows/darwin.yml @@ -11,19 +11,21 @@ jobs: config: # https://github.com/actions/virtual-environments/tree/main/images/macos - { os: "macos-11", xcode: "13.0", arch: "x64" } - - { os: "macos-11", xcode: "13.1", arch: "x64" } - - { os: "macos-11", xcode: "13.2", arch: "x64" } + - { os: "macos-12", xcode: "14.0", arch: "x64" } name: "xcode-${{matrix.config.xcode}}" steps: - - uses: actions/checkout@v2 + - name: Setup + run: brew install cmake ninja + - name: Checkout + uses: actions/checkout@v2 with: submodules: recursive - - name: Install ninja by Homebrew - run: brew install ninja - name: Select Xcode run: sudo xcode-select --switch "/Applications/Xcode_${{matrix.config.xcode}}.app" - - name: Build && Test + - name: Build run: | cmake --preset macos-${{matrix.config.arch}} cmake --build --preset macos-${{matrix.config.arch}}-release + - name: Test + run: | ctest --preset macos-${{matrix.config.arch}}-release \ No newline at end of file diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 696d813..5a1d659 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -15,14 +15,15 @@ jobs: name: "${{matrix.config.cxx}}" steps: - name: Setup - run: sudo apt-get -y install "${{matrix.config.cc}}" "${{matrix.config.cxx}}" + run: sudo apt-get -y install cmake ninja-build ${{matrix.config.cc}} ${{matrix.config.cxx}} - name: Checkout uses: actions/checkout@v2 with: submodules: recursive - - name: Build && Test - env: { CC: "${{matrix.config.cc}}", CXX: "${{matrix.config.cxx}}" } + - name: Build run: | cmake --preset linux-${{matrix.config.cc}} cmake --build --preset linux-${{matrix.config.cc}}-release + - name: Test + run: | ctest --preset linux-${{matrix.config.cc}}-release diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f5a8569..b8f6a37 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -16,11 +16,18 @@ jobs: - { os: "windows-2022", vc: "msvc2022", arch: "x64" } name: "${{matrix.config.vc}} ${{matrix.config.arch}}" steps: - - uses: actions/checkout@v2 + - name: Setup + run: choco install cmake ninja + - name: Checkout + uses: actions/checkout@v2 with: submodules: recursive - - name: Build && Test + - name: Select MSVC + uses: ilammy/msvc-dev-cmd@v1 + - name: Build run: | cmake --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}} cmake --build --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release + - name: Test + run: | ctest --preset windows-${{matrix.config.arch}}-${{matrix.config.vc}}-release diff --git a/singles/CMakeLists.txt b/singles/CMakeLists.txt index a58d8fb..c87f91c 100644 --- a/singles/CMakeLists.txt +++ b/singles/CMakeLists.txt @@ -4,7 +4,7 @@ project(meta.hpp.singles) # generate # -find_package(PythonInterp REQUIRED) +find_package(Python3 REQUIRED COMPONENTS Interpreter) set(META_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..") set(META_SINGLES_INPUT "${META_ROOT_DIR}/headers/meta.hpp/meta_all.hpp") @@ -12,7 +12,7 @@ set(META_SINGLES_OUTPUT "${META_ROOT_DIR}/singles/headers/meta.hpp/meta_all.hpp" file(GLOB_RECURSE META_SINGLES_DEPENDS "${META_ROOT_DIR}/headers/*.hpp") add_custom_command(OUTPUT "${META_SINGLES_OUTPUT}" - COMMAND "${PYTHON_EXECUTABLE}" ".ci/build_singles.py" "${META_SINGLES_INPUT}" "${META_SINGLES_OUTPUT}" + COMMAND "${Python3_EXECUTABLE}" ".ci/build_singles.py" "${META_SINGLES_INPUT}" "${META_SINGLES_OUTPUT}" DEPENDS ${META_SINGLES_DEPENDS} WORKING_DIRECTORY "${META_ROOT_DIR}") From 408fa33ab0ce8bad748b46778ce4ed6d5ac14707 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Mon, 7 Nov 2022 02:49:39 +0700 Subject: [PATCH 4/6] remove coverage and old ci scripts --- .ci/build_coverage.sh | 19 ------------------- .ci/build_darwin.sh | 11 ----------- .ci/build_linux.sh | 11 ----------- .ci/build_windows_x64.bat | 19 ------------------- .ci/build_windows_x86.bat | 19 ------------------- .github/workflows/coverage.yml | 16 ---------------- README.md | 3 --- singles/CMakeLists.txt | 2 +- {.ci => singles/scripts}/build_singles.py | 0 9 files changed, 1 insertion(+), 99 deletions(-) delete mode 100755 .ci/build_coverage.sh delete mode 100755 .ci/build_darwin.sh delete mode 100755 .ci/build_linux.sh delete mode 100644 .ci/build_windows_x64.bat delete mode 100644 .ci/build_windows_x86.bat delete mode 100644 .github/workflows/coverage.yml rename {.ci => singles/scripts}/build_singles.py (100%) diff --git a/.ci/build_coverage.sh b/.ci/build_coverage.sh deleted file mode 100755 index 7c8a1aa..0000000 --- a/.ci/build_coverage.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -set -e -DIR="$( cd "$( dirname "${BASH_SOURCE}" )" && pwd )" - -ROOT_DIR="${DIR}/.." -BUILD_DIR="${ROOT_DIR}/build/coverage" - -mkdir -p "${BUILD_DIR}" -(cd "${BUILD_DIR}" && cmake "${ROOT_DIR}" -DCMAKE_BUILD_TYPE=Debug -DBUILD_WITH_COVERAGE=ON) -(cd "${BUILD_DIR}" && cmake --build .) - -(cd "${BUILD_DIR}" && lcov -d . -z) -(cd "${BUILD_DIR}" && ctest --verbose) - -(cd "${BUILD_DIR}" && lcov -d . -c -o "coverage.info") -(cd "${BUILD_DIR}" && lcov -r "coverage.info" "*/usr/*" "*/untests/*" -o "coverage.info") -(cd "${BUILD_DIR}" && lcov -l "coverage.info") - -bash <(curl -s https://codecov.io/bash) -f "${BUILD_DIR}/coverage.info" || echo "Codecov did not collect coverage reports" diff --git a/.ci/build_darwin.sh b/.ci/build_darwin.sh deleted file mode 100755 index 658e0c1..0000000 --- a/.ci/build_darwin.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -e -DIR="$( cd "$( dirname "${BASH_SOURCE}" )" && pwd )" - -ROOT_DIR="${DIR}/.." -BUILD_DIR="${ROOT_DIR}/build/darwin_release" - -mkdir -p "${BUILD_DIR}" -(cd "${BUILD_DIR}" && cmake "${ROOT_DIR}" -DCMAKE_BUILD_TYPE=Release) -(cd "${BUILD_DIR}" && cmake --build .) -(cd "${BUILD_DIR}" && ctest --verbose) diff --git a/.ci/build_linux.sh b/.ci/build_linux.sh deleted file mode 100755 index c622bc4..0000000 --- a/.ci/build_linux.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -set -e -DIR="$( cd "$( dirname "${BASH_SOURCE}" )" && pwd )" - -ROOT_DIR="${DIR}/.." -BUILD_DIR="${ROOT_DIR}/build/linux_release" - -mkdir -p "${BUILD_DIR}" -(cd "${BUILD_DIR}" && cmake "${ROOT_DIR}" -DCMAKE_BUILD_TYPE=Release) -(cd "${BUILD_DIR}" && cmake --build .) -(cd "${BUILD_DIR}" && ctest --verbose) diff --git a/.ci/build_windows_x64.bat b/.ci/build_windows_x64.bat deleted file mode 100644 index 3bfe6cd..0000000 --- a/.ci/build_windows_x64.bat +++ /dev/null @@ -1,19 +0,0 @@ -@echo off -set DIR=%~dp0 - -set ROOT_DIR=%DIR%..\ -set BUILD_DIR=%ROOT_DIR%build\windows_release_x64\ - -if not exist %BUILD_DIR% mkdir %BUILD_DIR% || goto :error - -pushd %BUILD_DIR% || goto :error -cmake %ROOT_DIR% -A x64 || goto :error -cmake --build . --config Release || goto :error -ctest --verbose || goto :error -popd || goto :error - -goto :EOF - -:error -echo Failed with error #%errorlevel%. -exit /b %errorlevel% diff --git a/.ci/build_windows_x86.bat b/.ci/build_windows_x86.bat deleted file mode 100644 index 6627224..0000000 --- a/.ci/build_windows_x86.bat +++ /dev/null @@ -1,19 +0,0 @@ -@echo off -set DIR=%~dp0 - -set ROOT_DIR=%DIR%..\ -set BUILD_DIR=%ROOT_DIR%build\windows_release_x86\ - -if not exist %BUILD_DIR% mkdir %BUILD_DIR% || goto :error - -pushd %BUILD_DIR% || goto :error -cmake %ROOT_DIR% -A Win32 || goto :error -cmake --build . --config Release || goto :error -ctest --verbose || goto :error -popd || goto :error - -goto :EOF - -:error -echo Failed with error #%errorlevel%. -exit /b %errorlevel% diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 515f366..0000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: coverage - -on: [push, pull_request] - -jobs: - build: - runs-on: macos-11 - name: "coverage" - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Install lcov by Homebrew - run: brew install lcov - - name: Build && Test && Upload - run: .ci/build_coverage.sh diff --git a/README.md b/README.md index 682912b..aaeaa07 100644 --- a/README.md +++ b/README.md @@ -5,21 +5,18 @@ [![linux][badge.linux]][linux] [![darwin][badge.darwin]][darwin] [![windows][badge.windows]][windows] -[![codecov][badge.codecov]][codecov] [![language][badge.language]][language] [![license][badge.license]][license] [badge.darwin]: https://img.shields.io/github/workflow/status/BlackMATov/meta.hpp/darwin/main?label=Xcode&logo=xcode [badge.linux]: https://img.shields.io/github/workflow/status/BlackMATov/meta.hpp/linux/main?label=GCC%2FClang&logo=linux [badge.windows]: https://img.shields.io/github/workflow/status/BlackMATov/meta.hpp/windows/main?label=Visual%20Studio&logo=visual-studio -[badge.codecov]: https://img.shields.io/codecov/c/github/BlackMATov/meta.hpp/main?logo=codecov [badge.language]: https://img.shields.io/badge/language-C%2B%2B20-orange [badge.license]: https://img.shields.io/badge/license-MIT-blue [darwin]: https://github.com/BlackMATov/meta.hpp/actions?query=workflow%3Adarwin [linux]: https://github.com/BlackMATov/meta.hpp/actions?query=workflow%3Alinux [windows]: https://github.com/BlackMATov/meta.hpp/actions?query=workflow%3Awindows -[codecov]: https://codecov.io/gh/BlackMATov/meta.hpp [language]: https://en.wikipedia.org/wiki/C%2B%2B20 [license]: https://en.wikipedia.org/wiki/MIT_License diff --git a/singles/CMakeLists.txt b/singles/CMakeLists.txt index c87f91c..993a5d1 100644 --- a/singles/CMakeLists.txt +++ b/singles/CMakeLists.txt @@ -12,7 +12,7 @@ set(META_SINGLES_OUTPUT "${META_ROOT_DIR}/singles/headers/meta.hpp/meta_all.hpp" file(GLOB_RECURSE META_SINGLES_DEPENDS "${META_ROOT_DIR}/headers/*.hpp") add_custom_command(OUTPUT "${META_SINGLES_OUTPUT}" - COMMAND "${Python3_EXECUTABLE}" ".ci/build_singles.py" "${META_SINGLES_INPUT}" "${META_SINGLES_OUTPUT}" + COMMAND "${Python3_EXECUTABLE}" "singles/scripts/build_singles.py" "${META_SINGLES_INPUT}" "${META_SINGLES_OUTPUT}" DEPENDS ${META_SINGLES_DEPENDS} WORKING_DIRECTORY "${META_ROOT_DIR}") diff --git a/.ci/build_singles.py b/singles/scripts/build_singles.py similarity index 100% rename from .ci/build_singles.py rename to singles/scripts/build_singles.py From 552c6ac9ec8ac0b6448e7ccf17531bbe03c5b83a Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Mon, 7 Nov 2022 02:51:08 +0700 Subject: [PATCH 5/6] update actions/checkout@v3 version --- .github/workflows/darwin.yml | 4 ++-- .github/workflows/linux.yml | 4 ++-- .github/workflows/windows.yml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/darwin.yml b/.github/workflows/darwin.yml index d88b241..b821ff4 100644 --- a/.github/workflows/darwin.yml +++ b/.github/workflows/darwin.yml @@ -17,9 +17,9 @@ jobs: - name: Setup run: brew install cmake ninja - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: - submodules: recursive + submodules: true - name: Select Xcode run: sudo xcode-select --switch "/Applications/Xcode_${{matrix.config.xcode}}.app" - name: Build diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 5a1d659..e35009d 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -17,9 +17,9 @@ jobs: - name: Setup run: sudo apt-get -y install cmake ninja-build ${{matrix.config.cc}} ${{matrix.config.cxx}} - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: - submodules: recursive + submodules: true - name: Build run: | cmake --preset linux-${{matrix.config.cc}} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index b8f6a37..47bafa9 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -19,9 +19,9 @@ jobs: - name: Setup run: choco install cmake ninja - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: - submodules: recursive + submodules: true - name: Select MSVC uses: ilammy/msvc-dev-cmd@v1 - name: Build From 615a78a4ac196c79c182000c88bafddb82e01573 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Mon, 7 Nov 2022 03:00:19 +0700 Subject: [PATCH 6/6] build manuals with single-header meta.hpp too --- manuals/CMakeLists.txt | 98 +++++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 30 deletions(-) diff --git a/manuals/CMakeLists.txt b/manuals/CMakeLists.txt index 28a3ba3..2e0d3b1 100644 --- a/manuals/CMakeLists.txt +++ b/manuals/CMakeLists.txt @@ -4,39 +4,77 @@ file(GLOB_RECURSE MANUALS_SOURCES "*.cpp" "*.hpp") source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${MANUALS_SOURCES}) add_executable(${PROJECT_NAME} ${MANUALS_SOURCES}) -target_link_libraries(${PROJECT_NAME} PRIVATE meta.hpp doctest_with_main fmt) +target_link_libraries(${PROJECT_NAME} PRIVATE meta.hpp) -if(${BUILD_WITH_COVERAGE}) - target_link_libraries(${PROJECT_NAME} PRIVATE enable_gcov) -endif() +add_executable(${PROJECT_NAME}.singles ${MANUALS_SOURCES}) +target_link_libraries(${PROJECT_NAME}.singles PRIVATE meta.hpp.singles) -if(${BUILD_WITH_SANITIZERS}) - target_link_libraries(${PROJECT_NAME} PRIVATE enable_asan enable_ubsan) -endif() +# +# setup defines +# -target_compile_options(${PROJECT_NAME} - PRIVATE - $<$: - /WX /W4> - PRIVATE - $<$: - -Werror -Wall -Wextra -Wpedantic> - PRIVATE - $<$,$>: - -Werror -Weverything -Wconversion - -Wno-c++98-compat - -Wno-c++98-compat-pedantic - -Wno-exit-time-destructors - -Wno-padded - -Wno-unknown-warning-option - -Wno-unneeded-internal-declaration - -Wno-unneeded-member-function - -Wno-unused-macros - -Wno-weak-vtables - >) +function(setup_defines_for_target TARGET) + target_compile_definitions(${TARGET} PRIVATE + DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS + DOCTEST_CONFIG_USE_STD_HEADERS) +endfunction() -target_compile_definitions(${PROJECT_NAME} PRIVATE - DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS - DOCTEST_CONFIG_USE_STD_HEADERS) +setup_defines_for_target(${PROJECT_NAME}) +setup_defines_for_target(${PROJECT_NAME}.singles) + +# +# setup libraries +# + +function(setup_libraries_for_target TARGET) + target_link_libraries(${TARGET} PRIVATE doctest_with_main fmt) + + if(${BUILD_WITH_COVERAGE}) + target_link_libraries(${TARGET} PRIVATE enable_gcov) + endif() + + if(${BUILD_WITH_SANITIZERS}) + target_link_libraries(${TARGET} PRIVATE enable_asan enable_ubsan) + endif() +endfunction() + +setup_libraries_for_target(${PROJECT_NAME}) +setup_libraries_for_target(${PROJECT_NAME}.singles) + +# +# setup warnings +# + +function(setup_warnings_for_target TARGET) + target_compile_options(${TARGET} + PRIVATE + $<$: + /WX /W4> + PRIVATE + $<$: + -Werror -Wall -Wextra -Wpedantic> + PRIVATE + $<$,$>: + -Werror -Weverything -Wconversion + -Wno-c++98-compat + -Wno-c++98-compat-pedantic + -Wno-exit-time-destructors + -Wno-global-constructors + -Wno-padded + -Wno-unknown-warning-option + -Wno-unneeded-internal-declaration + -Wno-unneeded-member-function + -Wno-unused-macros + -Wno-weak-vtables + >) +endfunction() + +setup_warnings_for_target(${PROJECT_NAME}) +setup_warnings_for_target(${PROJECT_NAME}.singles) + +# +# add tests +# add_test(${PROJECT_NAME} ${PROJECT_NAME}) +add_test(${PROJECT_NAME} ${PROJECT_NAME}.singles)