Merge pull request #17 from BlackMATov/dev

Dev
This commit is contained in:
2025-04-11 02:36:56 +07:00
committed by GitHub
22 changed files with 235 additions and 298 deletions

View File

@@ -9,23 +9,29 @@ jobs:
fail-fast: false
matrix:
config:
# https://github.com/actions/virtual-environments/tree/main/images/macos
- { os: "macos-10.15", xcode: "10.3", arch: "x64" }
- { os: "macos-12", xcode: "14.2", arch: "x64" }
name: "xcode-${{matrix.config.xcode}}"
# https://github.com/actions/virtual-environments/tree/main/images/macos
- { os: "macos-13", xcode: "14.3.1", arch: "x64" }
- { os: "macos-13", xcode: "14.3.1", arch: "arm64" }
- { os: "macos-14", xcode: "15.4", arch: "x64" }
- { os: "macos-14", xcode: "15.4", arch: "arm64" }
- { os: "macos-15", xcode: "16.2", arch: "x64" }
- { os: "macos-15", xcode: "16.2", arch: "arm64" }
name: "xcode-${{matrix.config.xcode}}-${{matrix.config.arch}}"
steps:
- 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
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
- name: Setup
run: |
brew update
brew install cmake ninja
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Select Xcode
run: sudo xcode-select --switch "/Applications/Xcode_${{matrix.config.xcode}}.app"
- 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}}

View File

@@ -9,23 +9,25 @@ jobs:
fail-fast: false
matrix:
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: "clang-7", cxx: "clang++-7" }
- { os: "ubuntu-22.04", cc: "gcc-12", cxx: "g++-12" }
- { os: "ubuntu-22.04", cc: "clang-14", cxx: "clang++-14" }
# https://github.com/actions/runner-images/tree/main/images/ubuntu
- { os: "ubuntu-20.04", cc: "gcc-10", cxx: "g++-10" }
- { os: "ubuntu-20.04", cc: "clang-10", cxx: "clang++-10" }
- { os: "ubuntu-24.04", cc: "gcc-14", cxx: "g++-14" }
- { os: "ubuntu-24.04", cc: "clang-18", cxx: "clang++-18" }
name: "${{matrix.config.cxx}}"
steps:
- name: Setup
run: sudo apt-get -y install cmake ninja-build ${{matrix.config.cc}} ${{matrix.config.cxx}}
- name: Checkout
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
- name: Setup
run: |
sudo apt-get update -o Acquire::Retries=10
sudo apt-get install -o Acquire::Retries=10 -y cmake ninja-build ${{matrix.config.cc}} ${{matrix.config.cxx}}
- name: Checkout
uses: actions/checkout@v4
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}}

View File

@@ -9,25 +9,25 @@ jobs:
fail-fast: false
matrix:
config:
# https://github.com/actions/virtual-environments/tree/main/images/win
- { 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}}"
# https://github.com/actions/runner-images/tree/main/images/windows
- { 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:
- 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
- name: Setup
run: choco install cmake ninja
- name: Checkout
uses: actions/checkout@v4
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}}

5
.vscode/launch.json vendored
View File

@@ -6,6 +6,9 @@
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"cwd": "${workspaceFolder}"
"cwd": "${workspaceFolder}",
"initCommands": [
"settings set target.process.thread.step-avoid-regexp \"\""
]
}]
}

22
.vscode/settings.json vendored
View File

@@ -1,29 +1,13 @@
{
"[cpp]": {
"files.encoding": "utf8",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true
},
"[cmake]": {
"files.encoding": "utf8",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true
},
"[python]": {
"[c][cmake][cpp][json][jsonc][markdown][python][yaml]": {
"files.encoding": "utf8",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true
},
"clangd.arguments": [
"--all-scopes-completion",
"--background-index",
"--clang-tidy",
"--compile-commands-dir=${workspaceFolder}/.clangd",
"--completion-style=detailed",
"--header-insertion=never"
"--header-insertion=never",
"--compile-commands-dir=${workspaceFolder}/.clangd"
],
"cmake.copyCompileCommands": "${workspaceFolder}/.clangd/compile_commands.json"
}

View File

@@ -3,11 +3,11 @@ cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(kari.hpp
VERSION "0.0.1"
DESCRIPTION "Experimental library for currying in C++17"
HOMEPAGE_URL "https://github.com/blackmatov/kari.hpp")
HOMEPAGE_URL "https://github.com/blackmatov/kari.hpp"
LANGUAGES CXX)
#
# LIBRARY
#
option(KARI_HPP_DEVELOP "Generate develop targets" OFF)
option(KARI_HPP_INSTALL "Generate install targets" ${PROJECT_IS_TOP_LEVEL})
add_library(${PROJECT_NAME} INTERFACE)
add_library(kari.hpp::kari.hpp ALIAS ${PROJECT_NAME})
@@ -19,11 +19,17 @@ target_include_directories(${PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/headers>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
#
# INSTALL
#
if(KARI_HPP_DEVELOP)
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")
if(PROJECT_IS_TOP_LEVEL)
add_subdirectory(vendors)
add_subdirectory(untests)
endif()
if(KARI_HPP_INSTALL)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
@@ -31,31 +37,29 @@ if(PROJECT_IS_TOP_LEVEL)
"${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(KARI_HPP_INSTALL_CONFIG_INPUT
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in")
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/config.cmake.in")
set(KARI_HPP_INSTALL_GENERATED_CONFIG_CMAKE
"${CMAKE_CURRENT_BINARY_DIR}/generated/${PROJECT_NAME}-config.cmake")
set(KARI_HPP_INSTALL_CONFIG_CMAKE
"${CMAKE_CURRENT_BINARY_DIR}/configs/${PROJECT_NAME}-config.cmake")
set(KARI_HPP_INSTALL_GENERATED_CONFIG_VERSION_CMAKE
"${CMAKE_CURRENT_BINARY_DIR}/generated/${PROJECT_NAME}-config-version.cmake")
set(KARI_HPP_INSTALL_CONFIG_VERSION_CMAKE
"${CMAKE_CURRENT_BINARY_DIR}/configs/${PROJECT_NAME}-config-version.cmake")
configure_package_config_file(
"${KARI_HPP_INSTALL_CONFIG_INPUT}"
"${KARI_HPP_INSTALL_GENERATED_CONFIG_CMAKE}"
"${KARI_HPP_INSTALL_CONFIG_CMAKE}"
INSTALL_DESTINATION "${KARI_HPP_INSTALL_CONFIG_DIR}"
NO_SET_AND_CHECK_MACRO
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
NO_SET_AND_CHECK_MACRO)
write_basic_package_version_file(
"${KARI_HPP_INSTALL_GENERATED_CONFIG_VERSION_CMAKE}"
"${KARI_HPP_INSTALL_CONFIG_VERSION_CMAKE}"
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion
ARCH_INDEPENDENT)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}-targets
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
EXPORT ${PROJECT_NAME}-targets)
install(
DIRECTORY headers/${PROJECT_NAME}
@@ -68,28 +72,7 @@ if(PROJECT_IS_TOP_LEVEL)
DESTINATION "${KARI_HPP_INSTALL_CONFIG_DIR}")
install(
FILES "${KARI_HPP_INSTALL_GENERATED_CONFIG_CMAKE}"
"${KARI_HPP_INSTALL_GENERATED_CONFIG_VERSION_CMAKE}"
FILES "${KARI_HPP_INSTALL_CONFIG_CMAKE}"
"${KARI_HPP_INSTALL_CONFIG_VERSION_CMAKE}"
DESTINATION "${KARI_HPP_INSTALL_CONFIG_DIR}")
endif()
#
# DEVELOPER
#
if(PROJECT_IS_TOP_LEVEL)
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)
endif()

View File

@@ -1,27 +1,27 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
"patch": 0
},
"configurePresets": [
{
"name": "ninja-base",
"name": "develop-base",
"hidden": true,
"generator": "Ninja Multi-Config",
"binaryDir": "${sourceDir}/build/${presetName}",
"installDir": "${sourceDir}/install/${presetName}",
"cacheVariables": {
"KARI_HPP_DEVELOP": true,
"KARI_HPP_INSTALL": true,
"CMAKE_EXPORT_COMPILE_COMMANDS": true
}
},
{
"name": "linux-base",
"hidden": true,
"inherits": "ninja-base",
"inherits": "develop-base",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
@@ -29,41 +29,41 @@
}
},
{
"name": "linux-clang-7",
"name": "linux-clang-10",
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang-7",
"CMAKE_CXX_COMPILER": "clang++-7"
"CMAKE_C_COMPILER": "clang-10",
"CMAKE_CXX_COMPILER": "clang++-10"
}
},
{
"name": "linux-clang-14",
"name": "linux-clang-18",
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_C_COMPILER": "clang-14",
"CMAKE_CXX_COMPILER": "clang++-14"
"CMAKE_C_COMPILER": "clang-18",
"CMAKE_CXX_COMPILER": "clang++-18"
}
},
{
"name": "linux-gcc-7",
"name": "linux-gcc-10",
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc-7",
"CMAKE_CXX_COMPILER": "g++-7"
"CMAKE_C_COMPILER": "gcc-10",
"CMAKE_CXX_COMPILER": "g++-10"
}
},
{
"name": "linux-gcc-12",
"name": "linux-gcc-14",
"inherits": "linux-base",
"cacheVariables": {
"CMAKE_C_COMPILER": "gcc-12",
"CMAKE_CXX_COMPILER": "g++-12"
"CMAKE_C_COMPILER": "gcc-14",
"CMAKE_CXX_COMPILER": "g++-14"
}
},
{
"name": "macos-base",
"hidden": true,
"inherits": "ninja-base",
"inherits": "develop-base",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
@@ -78,13 +78,6 @@
"strategy": "external"
}
},
{
"name": "macos-arm64-san",
"inherits": "macos-arm64",
"cacheVariables": {
"BUILD_WITH_SANITIZERS": true
}
},
{
"name": "macos-x64",
"inherits": "macos-base",
@@ -93,17 +86,10 @@
"strategy": "external"
}
},
{
"name": "macos-x64-san",
"inherits": "macos-x64",
"cacheVariables": {
"BUILD_WITH_SANITIZERS": true
}
},
{
"name": "windows-base",
"hidden": true,
"inherits": "ninja-base",
"inherits": "develop-base",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
@@ -175,52 +161,51 @@
}
}
],
"buildPresets": [
{
"name": "linux-clang-7-debug",
"name": "linux-clang-10-debug",
"configuration": "Debug",
"configurePreset": "linux-clang-7"
"configurePreset": "linux-clang-10"
},
{
"name": "linux-clang-7-release",
"name": "linux-clang-10-release",
"configuration": "Release",
"configurePreset": "linux-clang-7"
"configurePreset": "linux-clang-10"
},
{
"name": "linux-clang-14-debug",
"name": "linux-clang-18-debug",
"configuration": "Debug",
"configurePreset": "linux-clang-14"
"configurePreset": "linux-clang-18"
},
{
"name": "linux-clang-14-release",
"name": "linux-clang-18-release",
"configuration": "Release",
"configurePreset": "linux-clang-14"
"configurePreset": "linux-clang-18"
},
{
"name": "linux-gcc-7-debug",
"name": "linux-gcc-10-debug",
"configuration": "Debug",
"configurePreset": "linux-gcc-7"
"configurePreset": "linux-gcc-10"
},
{
"name": "linux-gcc-7-release",
"name": "linux-gcc-10-release",
"configuration": "Release",
"configurePreset": "linux-gcc-7"
"configurePreset": "linux-gcc-10"
},
{
"name": "linux-gcc-12-debug",
"name": "linux-gcc-14-debug",
"configuration": "Debug",
"configurePreset": "linux-gcc-12"
"configurePreset": "linux-gcc-14"
},
{
"name": "linux-gcc-12-release",
"name": "linux-gcc-14-release",
"configuration": "Release",
"configurePreset": "linux-gcc-12"
"configurePreset": "linux-gcc-14"
},
{
"name": "macos-arm64-debug",
"configuration": "Debug",
"configurePreset": "macos-arm64-san"
"configurePreset": "macos-arm64"
},
{
"name": "macos-arm64-release",
@@ -230,7 +215,7 @@
{
"name": "macos-x64-debug",
"configuration": "Debug",
"configurePreset": "macos-x64-san"
"configurePreset": "macos-x64"
},
{
"name": "macos-x64-release",
@@ -278,63 +263,61 @@
"configurePreset": "windows-x64-msvc2022"
}
],
"testPresets": [
{
"name": "test-base",
"hidden": true,
"output": {
"verbosity": "verbose"
},
"configuration": "Release"
}
},
{
"name": "linux-clang-7-release",
"name": "linux-clang-10",
"inherits": "test-base",
"configurePreset": "linux-clang-7"
"configurePreset": "linux-clang-10"
},
{
"name": "linux-clang-14-release",
"name": "linux-clang-18",
"inherits": "test-base",
"configurePreset": "linux-clang-14"
"configurePreset": "linux-clang-18"
},
{
"name": "linux-gcc-7-release",
"name": "linux-gcc-10",
"inherits": "test-base",
"configurePreset": "linux-gcc-7"
"configurePreset": "linux-gcc-10"
},
{
"name": "linux-gcc-12-release",
"name": "linux-gcc-14",
"inherits": "test-base",
"configurePreset": "linux-gcc-12"
"configurePreset": "linux-gcc-14"
},
{
"name": "macos-arm64-release",
"name": "macos-arm64",
"inherits": "test-base",
"configurePreset": "macos-arm64"
},
{
"name": "macos-x64-release",
"name": "macos-x64",
"inherits": "test-base",
"configurePreset": "macos-x64"
},
{
"name": "windows-x86-msvc2019-release",
"name": "windows-x86-msvc2019",
"inherits": "test-base",
"configurePreset": "windows-x86-msvc2019"
},
{
"name": "windows-x64-msvc2019-release",
"name": "windows-x64-msvc2019",
"inherits": "test-base",
"configurePreset": "windows-x64-msvc2019"
},
{
"name": "windows-x86-msvc2022-release",
"name": "windows-x86-msvc2022",
"inherits": "test-base",
"configurePreset": "windows-x86-msvc2022"
},
{
"name": "windows-x64-msvc2022-release",
"name": "windows-x64-msvc2022",
"inherits": "test-base",
"configurePreset": "windows-x64-msvc2022"
}

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (C) 2017-2023, by Matvey Cherevko (blackmatov@gmail.com)
Copyright (C) 2017-2025, by Matvey Cherevko (blackmatov@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,3 +0,0 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/kari.hpp-targets.cmake")

View File

@@ -1,16 +0,0 @@
# https://clang.llvm.org/docs/AddressSanitizer.html
add_library(${PROJECT_NAME}.enable_asan INTERFACE)
add_library(${PROJECT_NAME}::enable_asan ALIAS ${PROJECT_NAME}.enable_asan)
target_compile_options(${PROJECT_NAME}.enable_asan INTERFACE
-fsanitize=address
-fno-omit-frame-pointer
-fsanitize-address-use-after-scope
-fsanitize-address-use-after-return=always)
target_link_options(${PROJECT_NAME}.enable_asan INTERFACE
-fsanitize=address
-fno-omit-frame-pointer
-fsanitize-address-use-after-scope
-fsanitize-address-use-after-return=always)

View File

@@ -1,10 +0,0 @@
# https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
add_library(${PROJECT_NAME}.enable_gcov INTERFACE)
add_library(${PROJECT_NAME}::enable_gcov ALIAS ${PROJECT_NAME}.enable_gcov)
target_compile_options(${PROJECT_NAME}.enable_gcov INTERFACE
--coverage)
target_link_options(${PROJECT_NAME}.enable_gcov INTERFACE
--coverage)

View File

@@ -1,12 +0,0 @@
# https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
add_library(${PROJECT_NAME}.enable_ubsan INTERFACE)
add_library(${PROJECT_NAME}::enable_ubsan ALIAS ${PROJECT_NAME}.enable_ubsan)
target_compile_options(${PROJECT_NAME}.enable_ubsan INTERFACE
-fsanitize=undefined
-fno-omit-frame-pointer)
target_link_options(${PROJECT_NAME}.enable_ubsan INTERFACE
-fsanitize=undefined
-fno-omit-frame-pointer)

4
cmake/config.cmake.in Normal file
View File

@@ -0,0 +1,4 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
check_required_components(@PROJECT_NAME@)

31
headers/.clangd Normal file
View File

@@ -0,0 +1,31 @@
Diagnostics:
UnusedIncludes: None
MissingIncludes: None
ClangTidy:
Add:
- bugprone-*
- clang-analyzer-*
- concurrency-*
- cppcoreguidelines-*
- misc-*
- modernize-*
- performance-*
- portability-*
- readability-*
Remove:
- bugprone-crtp-constructor-accessibility
- bugprone-easily-swappable-parameters
- bugprone-macro-parentheses
- cppcoreguidelines-macro-usage
- cppcoreguidelines-non-private-member-variables-in-classes
- misc-no-recursion
- misc-non-private-member-variables-in-classes
- misc-unused-using-decls
- modernize-use-constraints
- modernize-use-trailing-return-type
- readability-identifier-length
- readability-named-parameter
- readability-redundant-access-specifiers
- readability-redundant-member-init
- readability-simplify-boolean-expr
- readability-use-anyofallof

View File

@@ -1,7 +1,7 @@
/*******************************************************************************
* This file is part of the "https://github.com/BlackMATov/kari.hpp"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2017-2023, by Matvey Cherevko (blackmatov@gmail.com)
* Copyright (C) 2017-2025, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#pragma once

View File

@@ -1,68 +1,37 @@
project(kari.hpp.untests)
file(GLOB_RECURSE UNTESTS_SOURCES "*.cpp" "*.hpp")
file(GLOB_RECURSE UNTESTS_SOURCES CONFIGURE_DEPENDS "*.cpp" "*.hpp")
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${UNTESTS_SOURCES})
add_executable(${PROJECT_NAME} ${UNTESTS_SOURCES})
target_link_libraries(${PROJECT_NAME} PRIVATE kari.hpp::kari.hpp)
#
# setup defines
#
target_link_libraries(${PROJECT_NAME} PRIVATE
kari.hpp::kari.hpp
kari.hpp.vendors::doctest)
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::doctest_with_main)
if(${BUILD_WITH_COVERAGE})
target_link_libraries(${TARGET} PRIVATE kari.hpp::enable_gcov)
endif()
if(${BUILD_WITH_SANITIZERS})
target_link_libraries(${TARGET} PRIVATE kari.hpp::enable_asan kari.hpp::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-ctad-maybe-unsupported
-Wno-padded
-Wno-unknown-warning-option
>)
endfunction()
setup_warnings_for_target(${PROJECT_NAME})
#
# add tests
#
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:
/WX /W4 /bigobj>
$<$<CXX_COMPILER_ID:GNU>:
-Werror -Wall -Wextra -Wpedantic
-Wno-dangling-reference
-Wno-inaccessible-base>
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:
-Werror -Weverything -Wconversion
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-ctad-maybe-unsupported
-Wno-exit-time-destructors
-Wno-global-constructors
-Wno-padded
-Wno-poison-system-directories
-Wno-switch-default
-Wno-unknown-warning-option
-Wno-unneeded-internal-declaration
-Wno-unsafe-buffer-usage
-Wno-unused-macros
-Wno-unused-member-function
-Wno-weak-vtables
-Wno-zero-as-null-pointer-constant>)
add_test(${PROJECT_NAME} ${PROJECT_NAME})

View File

@@ -1,7 +1,7 @@
/*******************************************************************************
* This file is part of the "https://github.com/BlackMATov/kari.hpp"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2017-2023, by Matvey Cherevko (blackmatov@gmail.com)
* Copyright (C) 2017-2025, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#include "kari_tests.hpp"

View File

@@ -1,7 +1,7 @@
/*******************************************************************************
* This file is part of the "https://github.com/BlackMATov/kari.hpp"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2017-2023, by Matvey Cherevko (blackmatov@gmail.com)
* Copyright (C) 2017-2025, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#include "kari_tests.hpp"

View File

@@ -1,7 +1,7 @@
/*******************************************************************************
* This file is part of the "https://github.com/BlackMATov/kari.hpp"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2017-2023, by Matvey Cherevko (blackmatov@gmail.com)
* Copyright (C) 2017-2025, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#include "kari_tests.hpp"

View File

@@ -1,7 +1,7 @@
/*******************************************************************************
* This file is part of the "https://github.com/BlackMATov/kari.hpp"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2017-2023, by Matvey Cherevko (blackmatov@gmail.com)
* Copyright (C) 2017-2025, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#include <kari.hpp/kari.hpp>

View File

@@ -1,5 +1,18 @@
project(kari.hpp.vendors)
set(DOCTEST_NO_INSTALL ON CACHE INTERNAL "")
add_subdirectory(doctest)
set_target_properties(doctest_with_main PROPERTIES FOLDER kari.hpp.vendors)
add_library(${PROJECT_NAME}.doctest STATIC EXCLUDE_FROM_ALL doctest/doctest/parts/doctest.cpp)
add_library(${PROJECT_NAME}::doctest ALIAS ${PROJECT_NAME}.doctest)
target_compile_features(${PROJECT_NAME}.doctest
PUBLIC cxx_std_20)
target_include_directories(${PROJECT_NAME}.doctest SYSTEM
PUBLIC doctest)
target_compile_definitions(${PROJECT_NAME}.doctest
PRIVATE
DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
PUBLIC
DOCTEST_CONFIG_USE_STD_HEADERS
$<$<BOOL:${BUILD_WITH_NO_EXCEPTIONS}>:
DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS>)