diff --git a/.github/workflows/darwin.yml b/.github/workflows/darwin.yml index 2ccdac0..1c7690f 100644 --- a/.github/workflows/darwin.yml +++ b/.github/workflows/darwin.yml @@ -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 \ No newline at end of file + - 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}} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 0908f50..68f3f1b 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -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}} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 47bafa9..22a897a 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -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}} diff --git a/.vscode/launch.json b/.vscode/launch.json index f432300..0ad23c7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,6 +6,9 @@ "request": "launch", "program": "${command:cmake.launchTargetPath}", "args": [], - "cwd": "${workspaceFolder}" + "cwd": "${workspaceFolder}", + "initCommands": [ + "settings set target.process.thread.step-avoid-regexp \"\"" + ] }] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 966d80c..7fb0c94 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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" } diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a9b83c..1436367 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 $ $) -# -# 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() diff --git a/CMakePresets.json b/CMakePresets.json index 0602c52..3b0cca2 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -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" } diff --git a/LICENSE.md b/LICENSE.md index 32c5f5f..c217718 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -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 diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in deleted file mode 100644 index 0059a91..0000000 --- a/cmake/Config.cmake.in +++ /dev/null @@ -1,3 +0,0 @@ -@PACKAGE_INIT@ - -include("${CMAKE_CURRENT_LIST_DIR}/kari.hpp-targets.cmake") diff --git a/cmake/EnableASan.cmake b/cmake/EnableASan.cmake deleted file mode 100644 index 1af49c9..0000000 --- a/cmake/EnableASan.cmake +++ /dev/null @@ -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) diff --git a/cmake/EnableGCov.cmake b/cmake/EnableGCov.cmake deleted file mode 100644 index e98ea88..0000000 --- a/cmake/EnableGCov.cmake +++ /dev/null @@ -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) diff --git a/cmake/EnableUBSan.cmake b/cmake/EnableUBSan.cmake deleted file mode 100644 index 358b14d..0000000 --- a/cmake/EnableUBSan.cmake +++ /dev/null @@ -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) diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in new file mode 100644 index 0000000..5c77423 --- /dev/null +++ b/cmake/config.cmake.in @@ -0,0 +1,4 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake") +check_required_components(@PROJECT_NAME@) \ No newline at end of file diff --git a/headers/.clangd b/headers/.clangd new file mode 100644 index 0000000..401e529 --- /dev/null +++ b/headers/.clangd @@ -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 diff --git a/headers/kari.hpp/kari.hpp b/headers/kari.hpp/kari.hpp index bcc59db..d858695 100644 --- a/headers/kari.hpp/kari.hpp +++ b/headers/kari.hpp/kari.hpp @@ -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 diff --git a/untests/CMakeLists.txt b/untests/CMakeLists.txt index d7dd0e0..08c2cbc 100644 --- a/untests/CMakeLists.txt +++ b/untests/CMakeLists.txt @@ -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 - $<$: - /WX /W4> - PRIVATE - $<$: - -Werror -Wall -Wextra -Wpedantic> - PRIVATE - $<$,$>: - -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 + $<$: + /WX /W4 /bigobj> + $<$: + -Werror -Wall -Wextra -Wpedantic + -Wno-dangling-reference + -Wno-inaccessible-base> + $<$,$>: + -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}) diff --git a/untests/kari_examples.cpp b/untests/kari_examples.cpp index 7e31bb1..f66ac27 100644 --- a/untests/kari_examples.cpp +++ b/untests/kari_examples.cpp @@ -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" diff --git a/untests/kari_ext_tests.cpp b/untests/kari_ext_tests.cpp index 545664b..ce0af60 100644 --- a/untests/kari_ext_tests.cpp +++ b/untests/kari_ext_tests.cpp @@ -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" diff --git a/untests/kari_tests.cpp b/untests/kari_tests.cpp index 3349eb3..143fdc3 100644 --- a/untests/kari_tests.cpp +++ b/untests/kari_tests.cpp @@ -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" diff --git a/untests/kari_tests.hpp b/untests/kari_tests.hpp index 196652a..e84b0a4 100644 --- a/untests/kari_tests.hpp +++ b/untests/kari_tests.hpp @@ -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 diff --git a/vendors/CMakeLists.txt b/vendors/CMakeLists.txt index 5ac3e54..31fbf32 100644 --- a/vendors/CMakeLists.txt +++ b/vendors/CMakeLists.txt @@ -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 + $<$: + DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS>) diff --git a/vendors/doctest b/vendors/doctest index 86892fc..ae7a135 160000 --- a/vendors/doctest +++ b/vendors/doctest @@ -1 +1 @@ -Subproject commit 86892fc480f80fb57d9a3926cb506c0e974489d8 +Subproject commit ae7a13539fb71f270b87eb2e874fbac80bc8dda2