mirror of
https://github.com/BlackMATov/enum.hpp.git
synced 2025-12-12 13:40:19 +07:00
new ci scripts and presets
This commit is contained in:
@@ -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"
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
@@ -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%
|
||||
@@ -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%
|
||||
14
.github/workflows/coverage.yml
vendored
14
.github/workflows/coverage.yml
vendored
@@ -1,14 +0,0 @@
|
||||
name: coverage
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-10.15
|
||||
name: "coverage"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install lcov by Homebrew
|
||||
run: brew install lcov
|
||||
- name: Build && Test && Upload
|
||||
run: .ci/build_coverage.sh
|
||||
21
.github/workflows/darwin.yml
vendored
21
.github/workflows/darwin.yml
vendored
@@ -10,13 +10,22 @@ jobs:
|
||||
matrix:
|
||||
config:
|
||||
# https://github.com/actions/virtual-environments/tree/main/images/macos
|
||||
- { os: "macos-10.15", xcode: "10.3" }
|
||||
- { os: "macos-10.15", xcode: "11.7" }
|
||||
- { os: "macos-10.15", xcode: "12.4" }
|
||||
- { os: "macos-10.15", xcode: "10.3", arch: "x64" }
|
||||
- { os: "macos-12", xcode: "14.2", arch: "x64" }
|
||||
name: "xcode-${{matrix.config.xcode}}"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup
|
||||
run: brew install cmake ninja
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Select Xcode
|
||||
run: sudo xcode-select --switch "/Applications/Xcode_${{matrix.config.xcode}}.app"
|
||||
- name: Build && Test
|
||||
run: .ci/build_darwin.sh
|
||||
- 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
|
||||
24
.github/workflows/linux.yml
vendored
24
.github/workflows/linux.yml
vendored
@@ -11,19 +11,21 @@ jobs:
|
||||
config:
|
||||
# https://github.com/actions/virtual-environments/tree/main/images/linux
|
||||
- { os: "ubuntu-20.04", cc: "gcc-7", cxx: "g++-7" }
|
||||
- { os: "ubuntu-20.04", cc: "gcc-8", cxx: "g++-8" }
|
||||
- { os: "ubuntu-20.04", cc: "gcc-9", cxx: "g++-9" }
|
||||
- { os: "ubuntu-20.04", cc: "gcc-10", cxx: "g++-10" }
|
||||
- { os: "ubuntu-20.04", cc: "clang-7", cxx: "clang++-7" }
|
||||
- { os: "ubuntu-20.04", cc: "clang-8", cxx: "clang++-8" }
|
||||
- { os: "ubuntu-20.04", cc: "clang-9", cxx: "clang++-9" }
|
||||
- { os: "ubuntu-20.04", cc: "clang-10", cxx: "clang++-10" }
|
||||
- { os: "ubuntu-22.04", cc: "gcc-12", cxx: "g++-12" }
|
||||
- { os: "ubuntu-22.04", cc: "clang-14", cxx: "clang++-14" }
|
||||
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
|
||||
- name: Build && Test
|
||||
run: .ci/build_linux.sh
|
||||
env: { CC: "${{matrix.config.cc}}", CXX: "${{matrix.config.cxx}}" }
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- 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
|
||||
|
||||
26
.github/workflows/windows.yml
vendored
26
.github/workflows/windows.yml
vendored
@@ -10,10 +10,24 @@ 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" }
|
||||
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
|
||||
- name: Build && Test
|
||||
run: .ci\build_windows_${{matrix.config.arch}}.bat
|
||||
- name: Setup
|
||||
run: choco install cmake ninja
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- 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
|
||||
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "vendors/doctest"]
|
||||
path = vendors/doctest
|
||||
url = https://github.com/doctest/doctest/
|
||||
@@ -1,5 +1,4 @@
|
||||
# 3.8 version is required for `cxx_std_17`
|
||||
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
|
||||
|
||||
if(NOT DEFINED PROJECT_NAME)
|
||||
set(BUILD_AS_STANDALONE ON)
|
||||
@@ -13,20 +12,25 @@ add_library(${PROJECT_NAME} INTERFACE)
|
||||
target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
|
||||
target_include_directories(${PROJECT_NAME} INTERFACE headers)
|
||||
|
||||
target_compile_options(${PROJECT_NAME}
|
||||
INTERFACE
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:
|
||||
-Wno-c++98-compat-pedantic
|
||||
-Wno-covered-switch-default
|
||||
-Wno-ctad-maybe-unsupported
|
||||
-Wno-old-style-cast
|
||||
-Wno-shadow
|
||||
-Wno-unknown-warning-option
|
||||
-Wno-unused-macros
|
||||
-Wno-weak-vtables
|
||||
>)
|
||||
#
|
||||
# BUILD_AS_STANDALONE
|
||||
#
|
||||
|
||||
if(BUILD_AS_STANDALONE)
|
||||
enable_testing()
|
||||
add_subdirectory(untests)
|
||||
if(NOT ${BUILD_AS_STANDALONE})
|
||||
return()
|
||||
endif()
|
||||
|
||||
option(BUILD_WITH_COVERAGE "Build with coverage" OFF)
|
||||
option(BUILD_WITH_SANITIZERS "Build with sanitizers" OFF)
|
||||
|
||||
enable_testing()
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
include(EnableASan)
|
||||
include(EnableGCov)
|
||||
include(EnableUBSan)
|
||||
|
||||
add_subdirectory(vendors)
|
||||
add_subdirectory(untests)
|
||||
|
||||
342
CMakePresets.json
Normal file
342
CMakePresets.json
Normal file
@@ -0,0 +1,342 @@
|
||||
{
|
||||
"version": 3,
|
||||
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 20,
|
||||
"patch": 0
|
||||
},
|
||||
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "ninja-base",
|
||||
"hidden": true,
|
||||
"generator": "Ninja Multi-Config",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"installDir": "${sourceDir}/install/${presetName}",
|
||||
"cacheVariables": {
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-base",
|
||||
"hidden": true,
|
||||
"inherits": "ninja-base",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Linux"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-7",
|
||||
"inherits": "linux-base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "clang-7",
|
||||
"CMAKE_CXX_COMPILER": "clang++-7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-14",
|
||||
"inherits": "linux-base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "clang-14",
|
||||
"CMAKE_CXX_COMPILER": "clang++-14"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-7",
|
||||
"inherits": "linux-base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "gcc-7",
|
||||
"CMAKE_CXX_COMPILER": "g++-7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-12",
|
||||
"inherits": "linux-base",
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "gcc-12",
|
||||
"CMAKE_CXX_COMPILER": "g++-12"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-base",
|
||||
"hidden": true,
|
||||
"inherits": "ninja-base",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Darwin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64",
|
||||
"inherits": "macos-base",
|
||||
"architecture": {
|
||||
"value": "arm64",
|
||||
"strategy": "external"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-san",
|
||||
"inherits": "macos-arm64",
|
||||
"cacheVariables": {
|
||||
"BUILD_WITH_SANITIZERS": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-x64",
|
||||
"inherits": "macos-base",
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-san",
|
||||
"inherits": "macos-x64",
|
||||
"cacheVariables": {
|
||||
"BUILD_WITH_SANITIZERS": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-base",
|
||||
"hidden": true,
|
||||
"inherits": "ninja-base",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2019",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x86",
|
||||
"strategy": "external"
|
||||
},
|
||||
"toolset": {
|
||||
"value": "v142,host=x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2019",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"toolset": {
|
||||
"value": "v142,host=x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2022",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x86",
|
||||
"strategy": "external"
|
||||
},
|
||||
"toolset": {
|
||||
"value": "v143,host=x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2022",
|
||||
"inherits": "windows-base",
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"toolset": {
|
||||
"value": "v143,host=x64",
|
||||
"strategy": "external"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "cl",
|
||||
"CMAKE_CXX_COMPILER": "cl"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "linux-clang-7-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "linux-clang-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-7-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "linux-clang-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-14-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "linux-clang-14"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-14-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "linux-clang-14"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-7-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "linux-gcc-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-7-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "linux-gcc-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-12-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "linux-gcc-12"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-12-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "linux-gcc-12"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "macos-arm64-san"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "macos-arm64"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "macos-x64-san"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "macos-x64"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2019-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "windows-x86-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2019-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "windows-x86-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2019-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "windows-x64-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2019-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "windows-x64-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2022-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "windows-x86-msvc2022"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2022-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "windows-x86-msvc2022"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2022-debug",
|
||||
"configuration": "Debug",
|
||||
"configurePreset": "windows-x64-msvc2022"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2022-release",
|
||||
"configuration": "Release",
|
||||
"configurePreset": "windows-x64-msvc2022"
|
||||
}
|
||||
],
|
||||
|
||||
"testPresets": [
|
||||
{
|
||||
"name": "test-base",
|
||||
"hidden": true,
|
||||
"output": {
|
||||
"verbosity": "verbose"
|
||||
},
|
||||
"configuration": "Release"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-7-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-clang-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-clang-14-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-clang-14"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-7-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-gcc-7"
|
||||
},
|
||||
{
|
||||
"name": "linux-gcc-12-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "linux-gcc-12"
|
||||
},
|
||||
{
|
||||
"name": "macos-arm64-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-arm64"
|
||||
},
|
||||
{
|
||||
"name": "macos-x64-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "macos-x64"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2019-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x86-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2019-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x64-msvc2019"
|
||||
},
|
||||
{
|
||||
"name": "windows-x86-msvc2022-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x86-msvc2022"
|
||||
},
|
||||
{
|
||||
"name": "windows-x64-msvc2022-release",
|
||||
"inherits": "test-base",
|
||||
"configurePreset": "windows-x64-msvc2022"
|
||||
}
|
||||
]
|
||||
}
|
||||
14
README.md
14
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/enum.hpp/darwin/main?label=Xcode&logo=xcode
|
||||
[badge.linux]: https://img.shields.io/github/workflow/status/BlackMATov/enum.hpp/linux/main?label=GCC%2FClang&logo=linux
|
||||
[badge.windows]: https://img.shields.io/github/workflow/status/BlackMATov/enum.hpp/windows/main?label=Visual%20Studio&logo=visual-studio
|
||||
[badge.codecov]: https://img.shields.io/codecov/c/github/BlackMATov/enum.hpp/main?logo=codecov
|
||||
[badge.darwin]: https://img.shields.io/github/actions/workflow/status/BlackMATov/enum.hpp/.github/workflows/darwin.yml?label=Xcode&logo=xcode
|
||||
[badge.linux]: https://img.shields.io/github/actions/workflow/status/BlackMATov/enum.hpp/.github/workflows/linux.yml?label=GCC%2FClang&logo=linux
|
||||
[badge.windows]: https://img.shields.io/github/actions/workflow/status/BlackMATov/enum.hpp/.github/workflows/windows.yml?label=Visual%20Studio&logo=visual-studio
|
||||
[badge.language]: https://img.shields.io/badge/language-C%2B%2B17-yellow
|
||||
[badge.license]: https://img.shields.io/badge/license-MIT-blue
|
||||
|
||||
[darwin]: https://github.com/BlackMATov/enum.hpp/actions?query=workflow%3Adarwin
|
||||
[linux]: https://github.com/BlackMATov/enum.hpp/actions?query=workflow%3Alinux
|
||||
[windows]: https://github.com/BlackMATov/enum.hpp/actions?query=workflow%3Awindows
|
||||
[codecov]: https://codecov.io/gh/BlackMATov/enum.hpp
|
||||
[language]: https://en.wikipedia.org/wiki/C%2B%2B17
|
||||
[license]: https://en.wikipedia.org/wiki/MIT_License
|
||||
|
||||
@@ -40,9 +37,10 @@
|
||||
|
||||
## Requirements
|
||||
|
||||
- [gcc](https://www.gnu.org/software/gcc/) **>= 7**
|
||||
- [clang](https://clang.llvm.org/) **>= 7**
|
||||
- [msvc](https://visualstudio.microsoft.com/) **>= 2017**
|
||||
- [gcc](https://www.gnu.org/software/gcc/) **>= 7**
|
||||
- [msvc](https://visualstudio.microsoft.com/) **>= 2019**
|
||||
- [xcode](https://developer.apple.com/xcode/) **>= 10.3**
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
15
cmake/EnableASan.cmake
Normal file
15
cmake/EnableASan.cmake
Normal file
@@ -0,0 +1,15 @@
|
||||
# https://clang.llvm.org/docs/AddressSanitizer.html
|
||||
|
||||
add_library(enable_asan INTERFACE)
|
||||
|
||||
target_compile_options(enable_asan INTERFACE
|
||||
-fsanitize=address
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize-address-use-after-scope
|
||||
-fsanitize-address-use-after-return=always)
|
||||
|
||||
target_link_options(enable_asan INTERFACE
|
||||
-fsanitize=address
|
||||
-fno-omit-frame-pointer
|
||||
-fsanitize-address-use-after-scope
|
||||
-fsanitize-address-use-after-return=always)
|
||||
9
cmake/EnableGCov.cmake
Normal file
9
cmake/EnableGCov.cmake
Normal file
@@ -0,0 +1,9 @@
|
||||
# https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
|
||||
|
||||
add_library(enable_gcov INTERFACE)
|
||||
|
||||
target_compile_options(enable_gcov INTERFACE
|
||||
--coverage)
|
||||
|
||||
target_link_options(enable_gcov INTERFACE
|
||||
--coverage)
|
||||
11
cmake/EnableUBSan.cmake
Normal file
11
cmake/EnableUBSan.cmake
Normal file
@@ -0,0 +1,11 @@
|
||||
# https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
|
||||
|
||||
add_library(enable_ubsan INTERFACE)
|
||||
|
||||
target_compile_options(enable_ubsan INTERFACE
|
||||
-fsanitize=undefined
|
||||
-fno-omit-frame-pointer)
|
||||
|
||||
target_link_options(enable_ubsan INTERFACE
|
||||
-fsanitize=undefined
|
||||
-fno-omit-frame-pointer)
|
||||
@@ -1,34 +1,72 @@
|
||||
project(enum.hpp.untests)
|
||||
|
||||
#
|
||||
# coverage
|
||||
#
|
||||
|
||||
option(BUILD_WITH_COVERAGE "Build with coverage" OFF)
|
||||
if(BUILD_WITH_COVERAGE AND (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang"))
|
||||
set(COVERAGE_FLAGS "--coverage")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COVERAGE_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COVERAGE_FLAGS}")
|
||||
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} ${COVERAGE_FLAGS}")
|
||||
endif()
|
||||
|
||||
#
|
||||
# executable
|
||||
#
|
||||
|
||||
file(GLOB_RECURSE UNTESTS_SOURCES "*.cpp" "*.hpp")
|
||||
add_executable(${PROJECT_NAME} ${UNTESTS_SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC enum.hpp)
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${UNTESTS_SOURCES})
|
||||
|
||||
target_compile_options(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:
|
||||
/WX /W4>
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:GNU>:
|
||||
-Werror -Wall -Wextra -Wpedantic>
|
||||
PRIVATE
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:
|
||||
-Werror -Weverything -Wconversion>)
|
||||
add_executable(${PROJECT_NAME} ${UNTESTS_SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE enum.hpp)
|
||||
|
||||
#
|
||||
# setup defines
|
||||
#
|
||||
|
||||
function(setup_defines_for_target TARGET)
|
||||
target_compile_definitions(${TARGET} PRIVATE
|
||||
DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
|
||||
DOCTEST_CONFIG_USE_STD_HEADERS)
|
||||
endfunction()
|
||||
|
||||
setup_defines_for_target(${PROJECT_NAME})
|
||||
|
||||
#
|
||||
# setup libraries
|
||||
#
|
||||
|
||||
function(setup_libraries_for_target TARGET)
|
||||
target_link_libraries(${TARGET} PRIVATE doctest_with_main)
|
||||
|
||||
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 warnings
|
||||
#
|
||||
|
||||
function(setup_warnings_for_target TARGET)
|
||||
target_compile_options(${TARGET}
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:
|
||||
/WX /W4>
|
||||
PRIVATE
|
||||
$<$<CXX_COMPILER_ID:GNU>:
|
||||
-Werror -Wall -Wextra -Wpedantic>
|
||||
PRIVATE
|
||||
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:
|
||||
-Werror -Weverything -Wconversion
|
||||
-Wno-c++98-compat
|
||||
-Wno-c++98-compat-pedantic
|
||||
-Wno-covered-switch-default
|
||||
-Wno-ctad-maybe-unsupported
|
||||
-Wno-old-style-cast
|
||||
-Wno-shadow
|
||||
-Wno-unknown-warning-option
|
||||
-Wno-unused-macros
|
||||
-Wno-weak-vtables
|
||||
>)
|
||||
endfunction()
|
||||
|
||||
setup_warnings_for_target(${PROJECT_NAME})
|
||||
|
||||
#
|
||||
# add tests
|
||||
#
|
||||
|
||||
add_test(${PROJECT_NAME} ${PROJECT_NAME})
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
#include "doctest.h"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "doctest.h"
|
||||
|
||||
// https://github.com/onqtam/doctest/issues/126
|
||||
#include <iostream>
|
||||
|
||||
#define STATIC_CHECK(...)\
|
||||
static_assert(__VA_ARGS__, #__VA_ARGS__);\
|
||||
CHECK(__VA_ARGS__)
|
||||
|
||||
#define STATIC_CHECK_FALSE(...)\
|
||||
static_assert(!(__VA_ARGS__), "!(" #__VA_ARGS__ ")");\
|
||||
CHECK(!(__VA_ARGS__))
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <enum.hpp/enum_bitflags.hpp>
|
||||
|
||||
#include "doctest/doctest.hpp"
|
||||
#include "enum_tests.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <enum.hpp/enum_bitflags.hpp>
|
||||
|
||||
#include "doctest/doctest.hpp"
|
||||
#include "enum_tests.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <enum.hpp/enum.hpp>
|
||||
|
||||
#include "doctest/doctest.hpp"
|
||||
#include "enum_tests.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <enum.hpp/enum.hpp>
|
||||
|
||||
#include "doctest/doctest.hpp"
|
||||
#include "enum_tests.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
15
untests/enum_tests.hpp
Normal file
15
untests/enum_tests.hpp
Normal file
@@ -0,0 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/enum.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2020-2022, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
#define STATIC_CHECK(...)\
|
||||
static_assert(__VA_ARGS__, #__VA_ARGS__);\
|
||||
CHECK(__VA_ARGS__)
|
||||
|
||||
#define STATIC_CHECK_FALSE(...)\
|
||||
static_assert(!(__VA_ARGS__), "!(" #__VA_ARGS__ ")");\
|
||||
CHECK(!(__VA_ARGS__))
|
||||
5
vendors/CMakeLists.txt
vendored
Normal file
5
vendors/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
project(vmath.hpp.vendors)
|
||||
|
||||
set(DOCTEST_NO_INSTALL ON CACHE INTERNAL "")
|
||||
add_subdirectory(doctest)
|
||||
set_target_properties(doctest_with_main PROPERTIES FOLDER vmath.hpp.vendors)
|
||||
1
vendors/doctest
vendored
Submodule
1
vendors/doctest
vendored
Submodule
Submodule vendors/doctest added at b7c21ec5ce
Reference in New Issue
Block a user