From bcab5edc13dedc721cef85d43b009a97864bac4b Mon Sep 17 00:00:00 2001 From: VsevolodChaplanov Date: Mon, 10 Feb 2025 15:26:06 +0300 Subject: [PATCH 1/2] add dummy test case to build test project target remove tests build time lint fix project configs with required deps catch2 testing framework version up switch commit --- CMakeUserPresets.json | 19 +------------------ cmake/install-config.cmake.in | 6 +++--- conanfile.py | 5 +---- core/CMakeLists.txt | 4 ++-- core/cmake/install-config.cmake.in | 5 +++-- core/test/CMakeLists.txt | 8 -------- core/test/src/core_test.cpp | 11 +++++++++-- 7 files changed, 19 insertions(+), 39 deletions(-) diff --git a/CMakeUserPresets.json b/CMakeUserPresets.json index 84a0fbf..381522b 100644 --- a/CMakeUserPresets.json +++ b/CMakeUserPresets.json @@ -6,20 +6,6 @@ "patch": 0 }, "configurePresets": [ - { - "name": "pass-conan", - "hidden": true, - "cacheVariables": { - "CONAN_COMMAND": "${sourceDir}/.venv/bin/conan" - } - }, - { - "name": "pass-python", - "hidden": true, - "cacheVariables": { - "Python_EXECUTABLE": "C://Users//rusla//.pyenv//pyenv-win//versions//3.13.0//python.exe" - } - }, { "name": "build-plugin", "hidden": true, @@ -49,8 +35,7 @@ }, "inherits": [ "dev-common", - "ci-linux", - "pass-conan" + "ci-linux" ], "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" @@ -85,7 +70,6 @@ "cppcheck", "clang-tidy", "ci-win64", - "pass-python", "build-plugin" ], "environment": { @@ -104,7 +88,6 @@ "inherits": [ "dev-common", "ci-win64-ninja", - "pass-python", "build-plugin" ], "environment": { diff --git a/cmake/install-config.cmake.in b/cmake/install-config.cmake.in index 290840d..09e8774 100644 --- a/cmake/install-config.cmake.in +++ b/cmake/install-config.cmake.in @@ -1,8 +1,8 @@ @PACKAGE_INIT@ -find_dependency(fmt REQUIRED) -find_dependency(pasio-utility REQUIRED) -find_dependency(pasio-core REQUIRED) +find_package(Python REQUIRED) +find_dependency(pybind11 REQUIRED) +find_dependency(Boost REQUIRED) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") check_required_components(@PROJECT_NAME@) \ No newline at end of file diff --git a/conanfile.py b/conanfile.py index 57338b6..416444a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -32,9 +32,6 @@ def fmt(): return ["fmt::fmt"] project_components = [ - { - "target": "utility", - }, { "target": "core", "lib": "core", @@ -72,7 +69,7 @@ def set_version(self): def requirements(self): self.requires("boost/1.86.0") self.requires("pybind11/2.13.6") - self.test_requires("catch2/3.5.3") + self.test_requires("catch2/3.8.0") def config_options(self): if self.settings.os == "Windows": diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index ec9500b..5fdc27c 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -49,7 +49,7 @@ endif() # ---- Declare library ---- -pybind11_add_module(${PROJECT_NAME} src/core.cpp) +pybind11_add_module(${PROJECT_NAME}) add_library(${PARENT_PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) # ---- Generate export header @@ -90,7 +90,7 @@ target_configure_linker(${PROJECT_NAME}) # ---- Collect all sources for static analysis -set(ALL_SOURCE_FILES ${LIBRARY_INCLUDES}) +set(ALL_SOURCE_FILES ${LIBRARY_INCLUDES} ${LIBRARY_SOURCES}) # ---- Clang-tidy target diff --git a/core/cmake/install-config.cmake.in b/core/cmake/install-config.cmake.in index 072c6d0..d6b5824 100644 --- a/core/cmake/install-config.cmake.in +++ b/core/cmake/install-config.cmake.in @@ -2,8 +2,9 @@ include(CMakeFindDependencyMacro) -find_dependency(fmt REQUIRED) -find_dependency(pasio-utility REQUIRED) +find_package(Python REQUIRED) +find_dependency(Boost REQUIRED) +find_dependency(Pybind11 REQUIRED) include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake) check_required_components(@PROJECT_NAME@) diff --git a/core/test/CMakeLists.txt b/core/test/CMakeLists.txt index 4011920..0db615e 100644 --- a/core/test/CMakeLists.txt +++ b/core/test/CMakeLists.txt @@ -30,14 +30,6 @@ add_executable(${PROJECT_NAME}) target_link_libraries(${PROJECT_NAME} PRIVATE ${PARENT_PROJECT_NAME} Catch2::Catch2WithMain) target_sources(${PROJECT_NAME} PRIVATE ${TEST_SOURCES}) -option(LINT_TESTS "enable static analyzers for tests" OFF) - -if(LINT_TESTS) - target_cppcheck(${PROJECT_NAME} "${TEST_SOURCES}") - target_clangtidy(${PROJECT_NAME} "${TEST_SOURCES}") - target_include_what_you_use(${PROJECT_NAME} "${TEST_SOURCES}") -endif() - # ---- Discover Catch2 tests catch_discover_tests(${PROJECT_NAME}) diff --git a/core/test/src/core_test.cpp b/core/test/src/core_test.cpp index 1437b8b..5a48234 100644 --- a/core/test/src/core_test.cpp +++ b/core/test/src/core_test.cpp @@ -1,3 +1,10 @@ #include -#include -#include +#include + +namespace pasio::testing { + inline constexpr auto tags = "[pasio]"; + + TEST_CASE("Dummy test for test resolve", tags) { + CHECK(true); + } +} From fa246217752f712dbc89618b8aba395f73c53f1d Mon Sep 17 00:00:00 2001 From: VsevolodChaplanov Date: Mon, 10 Feb 2025 16:34:12 +0300 Subject: [PATCH 2/2] remove user specific presets --- CMakeUserPresets.json | 176 ------------------------------------------ 1 file changed, 176 deletions(-) delete mode 100644 CMakeUserPresets.json diff --git a/CMakeUserPresets.json b/CMakeUserPresets.json deleted file mode 100644 index 381522b..0000000 --- a/CMakeUserPresets.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "version": 6, - "cmakeMinimumRequired": { - "major": 3, - "minor": 28, - "patch": 0 - }, - "configurePresets": [ - { - "name": "build-plugin", - "hidden": true, - "cacheVariables": { - "BUILD_SHARED_LIBS": "ON" - } - }, - { - "name": "dev-common", - "hidden": true, - "inherits": [ - "dev-mode", - "conan" - ], - "cacheVariables": { - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" - } - }, - { - "name": "dev-linux", - "generator": "Ninja", - "binaryDir": "${sourceDir}/build/${presetName}", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Linux" - }, - "inherits": [ - "dev-common", - "ci-linux" - ], - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" - } - }, - { - "name": "dev-darwin", - "binaryDir": "${sourceDir}/build/${presetName}", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Darwin" - }, - "inherits": [ - "dev-common", - "ci-darwin" - ], - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" - } - }, - { - "name": "dev-win64", - "binaryDir": "${sourceDir}/build/${presetName}", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - }, - "inherits": [ - "dev-common", - "cppcheck", - "clang-tidy", - "ci-win64", - "build-plugin" - ], - "environment": { - "UseMultiToolTask": "true", - "EnforceProcessCountAcrossBuilds": "true" - } - }, - { - "name": "dev-win64-ninja", - "binaryDir": "${sourceDir}/build/${presetName}", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - }, - "inherits": [ - "dev-common", - "ci-win64-ninja", - "build-plugin" - ], - "environment": { - "UseMultiToolTask": "true", - "EnforceProcessCountAcrossBuilds": "true" - }, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_C_COMPILER": "cl.exe", - "CMAKE_CXX_COMPILER": "cl.exe" - } - }, - { - "name": "dev-coverage", - "binaryDir": "${sourceDir}/build/coverage", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Linux" - }, - "inherits": [ - "dev-mode", - "dev-linux", - "coverage-linux", - "conan" - ] - } - ], - "buildPresets": [ - { - "name": "dev-win-debug-config", - "configurePreset": "dev-win64", - "configuration": "Debug", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - } - }, - { - "name": "dev-win-release-config", - "configurePreset": "dev-win64", - "configuration": "Release", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - } - }, - { - "name": "dev-win-relwithdebinfo-config", - "configurePreset": "dev-win64", - "configuration": "RelWithDebInfo", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - } - } - ], - "testPresets": [ - { - "name": "dev-test-common", - "hidden": true, - "output": { - "outputOnFailure": true - }, - "execution": { - "noTestsAction": "error" - } - }, - { - "name": "dev-win-test-debug", - "configuration": "Debug", - "configurePreset": "dev-win64", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - }, - "inherits": [ - "dev-test-common" - ] - } - ] -} \ No newline at end of file