From 96d452adbfc6786c848fb14d0dd8b2c915383970 Mon Sep 17 00:00:00 2001 From: pantor Date: Thu, 25 Jul 2024 16:02:16 +0200 Subject: [PATCH] reorder CMakeLists, update ci/cd versions --- .github/workflows/cd.yml | 2 +- .github/workflows/ci.yml | 8 ++--- CMakeLists.txt | 69 +++++++++++++++++++--------------------- 3 files changed, 38 insertions(+), 41 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index abf4fc4a..2c57c682 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -19,7 +19,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.17.0 env: - CIBW_BEFORE_ALL: git clone --depth 1 --branch v2.12.0 https://github.com/pybind/pybind11.git + CIBW_BEFORE_ALL: git clone --depth 1 --branch v2.13.1 https://github.com/pybind/pybind11.git CIBW_SKIP: pp* # Skip PyPy MACOSX_DEPLOYMENT_TARGET: "10.14" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7627a06..8f84706d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,13 +13,13 @@ jobs: cmake_flags: ["", " -DBUILD_CLOUD_CLIENT=OFF "] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Get cross-platform /dev/null for hidden output run: echo "HIDDEN=$(python3 -c "import os; print(os.devnull)")" >> $GITHUB_ENV - name: Install pybind11 - run: git clone --depth 1 --branch v2.12.0 https://github.com/pybind/pybind11.git + run: git clone --depth 1 --branch v2.13.1 https://github.com/pybind/pybind11.git - name: Install valgrind if: matrix.os == 'ubuntu-latest' @@ -67,9 +67,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Lint Python run: | python3 -m pip install ruff - ruff examples test + ruff check examples test --preview diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b8e2f98..e62013a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,6 @@ add_library(ruckig src/ruckig/velocity_third_step1.cpp src/ruckig/velocity_third_step2.cpp ) -add_library(ruckig::ruckig ALIAS ruckig) target_compile_features(ruckig PUBLIC cxx_std_17) target_include_directories(ruckig PUBLIC @@ -45,7 +44,6 @@ if(MSVC) target_compile_definitions(ruckig PUBLIC _USE_MATH_DEFINES) endif() - if(BUILD_CLOUD_CLIENT) target_sources(ruckig PRIVATE src/ruckig/cloud_client.cpp) target_include_directories(ruckig PUBLIC @@ -55,6 +53,39 @@ if(BUILD_CLOUD_CLIENT) target_compile_definitions(ruckig PUBLIC WITH_CLOUD_CLIENT) endif() +add_library(ruckig::ruckig ALIAS ruckig) + + +if(BUILD_TESTS) + enable_testing() + + add_library(test-dependencies INTERFACE) + target_link_libraries(test-dependencies INTERFACE ruckig) + target_include_directories(test-dependencies INTERFACE third_party) + if(MSVC) + target_compile_options(test-dependencies INTERFACE /W4) + else() + target_compile_options(test-dependencies INTERFACE -Wall -Wextra) + endif() + + add_executable(test-target test/test_target.cpp) + target_link_libraries(test-target PRIVATE test-dependencies) + add_test(NAME test-target COMMAND test-target) + if(NOT MSVC) + include(CTest) + find_program(MEMORYCHECK_COMMAND valgrind) + set(MEMORYCHECK_COMMAND_OPTIONS "--tool=memcheck --leak-check=full --trace-children=yes \ + --track-origins=yes --keep-debuginfo=yes --error-exitcode=100") + endif() +endif() + + +if(BUILD_BENCHMARK) + add_executable(benchmark-target test/benchmark_target.cpp) + + target_link_libraries(benchmark-target PRIVATE ruckig) +endif() + if(BUILD_EXAMPLES) set(EXAMPLES_LIST 01_position 02_position_offline 05_velocity 06_stop 07_minimum_duration 09_dynamic_dofs 12_custom_vector_type 13_custom_vector_type_dynamic_dofs) @@ -138,40 +169,6 @@ install(FILES ) -if(BUILD_TESTS) - enable_testing() - - add_library(test-dependencies INTERFACE) - target_link_libraries(test-dependencies INTERFACE ruckig) - target_include_directories(test-dependencies INTERFACE third_party) - if(MSVC) - target_compile_options(test-dependencies INTERFACE /W4) - else() - target_compile_options(test-dependencies INTERFACE -Wall -Wextra) - endif() - - add_executable(test-target - test/test_target.cpp - ) - target_link_libraries(test-target PRIVATE test-dependencies) - add_test(NAME test-target COMMAND test-target) - if(NOT MSVC) - include(CTest) - find_program(MEMORYCHECK_COMMAND valgrind) - set(MEMORYCHECK_COMMAND_OPTIONS "--tool=memcheck --leak-check=full --trace-children=yes \ - --track-origins=yes --keep-debuginfo=yes --error-exitcode=100") - endif() - -endif() - - -if(BUILD_BENCHMARK) - add_executable(benchmark-target test/benchmark_target.cpp) - - target_link_libraries(benchmark-target PRIVATE ruckig) -endif() - - # Enable Packaging set(CPACK_PACKAGE_VENDOR "Lars Berscheid") set(CPACK_GENERATOR "DEB")