From 4ed3d9c87085380847bb85970e03f867ea2c2e63 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Wed, 13 Mar 2024 11:52:22 +0100 Subject: [PATCH 1/3] [MISC] Use CPM for ccache --- CMakeLists.txt | 7 +++---- cmake/ccache.cmake | 28 ---------------------------- cmake/package-lock.cmake | 10 ++++++++++ 3 files changed, 13 insertions(+), 32 deletions(-) delete mode 100644 cmake/ccache.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 54849e2..3c8ecf5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,18 +14,17 @@ project (app-template # This allows including `*.cmake` files from the `cmake` directory without specifying the full path. list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") -# Use ccache if available. This speeds up the build process by caching files that have been compiled before. -include (ccache) - # Specify the directories where to store the built archives, libraries and executables. include (output_directories) # Add packages. # We use CPM for package management: https://github.com/cpm-cmake/CPM.cmake -# The added packages (hibf, sharg, seqan3) are defined in the `cmake/package-locj.cmake` file. +# The added packages (hibf, sharg, seqan3) are defined in the `cmake/package-lock.cmake` file. include (CPM) CPMUsePackageLock (${CMAKE_CURRENT_LIST_DIR}/cmake/package-lock.cmake) +# Use ccache if available. This speeds up the build process by caching files that have been compiled before. +CPMGetPackage (use_ccache) CPMGetPackage (hibf) CPMGetPackage (sharg) CPMGetPackage (seqan3) diff --git a/cmake/ccache.cmake b/cmake/ccache.cmake deleted file mode 100644 index 4254b2b..0000000 --- a/cmake/ccache.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin -# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik -# SPDX-License-Identifier: CC0-1.0 - -include (FindPackageMessage) - -# Uses `ccache` to cache build results. -# -# See also -# * https://ccache.dev/ -# * https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_LAUNCHER.html -option (USE_CCACHE "Use ccache if available." ON) - -if (USE_CCACHE) - find_program (CCACHE_PROGRAM ccache) - - if (NOT CCACHE_PROGRAM) - find_package_message (CCACHE_PROGRAM "Ccache program: not available" "[${CCACHE_PROGRAM}]") - else () - find_package_message (CCACHE_PROGRAM "Ccache program: available" "[${CCACHE_PROGRAM}]") - - list (PREPEND CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") - list (PREPEND CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") - - list (PREPEND CMAKE_CXX_LINKER_LAUNCHER "${CCACHE_PROGRAM}") - list (PREPEND CMAKE_C_LINKER_LAUNCHER "${CCACHE_PROGRAM}") - endif () -endif () diff --git a/cmake/package-lock.cmake b/cmake/package-lock.cmake index 7cbc9ff..10bfea6 100644 --- a/cmake/package-lock.cmake +++ b/cmake/package-lock.cmake @@ -45,3 +45,13 @@ CPMDeclarePackage (googletest EXCLUDE_FROM_ALL TRUE OPTIONS "BUILD_GMOCK OFF" "INSTALL_GTEST OFF" "CMAKE_MESSAGE_LOG_LEVEL WARNING" ) +# use_ccache +set (USE_CCACHE_VERSION d2a54ef555b6fc2d496a4c9506dbeb7cf899ce37) +CPMDeclarePackage (use_ccache + NAME use_ccache + GIT_TAG ${USE_CCACHE_VERSION} + GITHUB_REPOSITORY seqan/cmake-scripts + SOURCE_SUBDIR ccache + SYSTEM TRUE + EXCLUDE_FROM_ALL TRUE +) From 2bca06a43f905f289c4a5fc442ec108ea153350a Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Wed, 13 Mar 2024 13:05:50 +0100 Subject: [PATCH 2/3] [INFRA] Add fmindex --- CMakeLists.txt | 3 ++- cmake/package-lock.cmake | 15 +++++++++++++++ src/CMakeLists.txt | 4 +++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c8ecf5..fc78aa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ include (output_directories) # Add packages. # We use CPM for package management: https://github.com/cpm-cmake/CPM.cmake -# The added packages (hibf, sharg, seqan3) are defined in the `cmake/package-lock.cmake` file. +# The added packages (e.g., hibf, sharg, seqan3) are defined in the `cmake/package-lock.cmake` file. include (CPM) CPMUsePackageLock (${CMAKE_CURRENT_LIST_DIR}/cmake/package-lock.cmake) @@ -28,6 +28,7 @@ CPMGetPackage (use_ccache) CPMGetPackage (hibf) CPMGetPackage (sharg) CPMGetPackage (seqan3) +CPMGetPackage (fmindex) # Add the application. This will include `src/CMakeLists.txt`. add_subdirectory (src) diff --git a/cmake/package-lock.cmake b/cmake/package-lock.cmake index 10bfea6..594acee 100644 --- a/cmake/package-lock.cmake +++ b/cmake/package-lock.cmake @@ -15,6 +15,7 @@ CPMDeclarePackage (hibf EXCLUDE_FROM_ALL TRUE OPTIONS "INSTALL_HIBF OFF" "CMAKE_MESSAGE_LOG_LEVEL WARNING" ) + # sharg set (SHARG_VERSION 01f848eeb6dbac3d50a718a8ee26bcf695edf5a8) CPMDeclarePackage (sharg @@ -25,6 +26,7 @@ CPMDeclarePackage (sharg EXCLUDE_FROM_ALL TRUE OPTIONS "INSTALL_SHARG OFF" "INSTALL_TDL OFF" "CMAKE_MESSAGE_LOG_LEVEL WARNING" ) + # seqan3 set (SEQAN3_VERSION fee3fb8e5976b455e848dd68c57f64fd3f67c3c2) CPMDeclarePackage (seqan3 @@ -35,6 +37,18 @@ CPMDeclarePackage (seqan3 EXCLUDE_FROM_ALL TRUE OPTIONS "INSTALL_SEQAN3 OFF" "CMAKE_MESSAGE_LOG_LEVEL WARNING" ) + +# fmindex +set (FMINDEX_VERSION 822d4d1aa6fa725f7d34e1ea819e9c23a2b6ebc2) +CPMDeclarePackage (fmindex + NAME fmindex + GIT_TAG ${FMINDEX_VERSION} + GITHUB_REPOSITORY SGSSGene/fmindex-collection + SYSTEM TRUE + EXCLUDE_FROM_ALL TRUE + OPTIONS "CMAKE_MESSAGE_LOG_LEVEL WARNING" +) + # googletest set (GOOGLETEST_VERSION 1.14.0) CPMDeclarePackage (googletest @@ -45,6 +59,7 @@ CPMDeclarePackage (googletest EXCLUDE_FROM_ALL TRUE OPTIONS "BUILD_GMOCK OFF" "INSTALL_GTEST OFF" "CMAKE_MESSAGE_LOG_LEVEL WARNING" ) + # use_ccache set (USE_CCACHE_VERSION d2a54ef555b6fc2d496a4c9506dbeb7cf899ce37) CPMDeclarePackage (use_ccache diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bead185..3d76d4c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,7 +8,9 @@ cmake_minimum_required (VERSION 3.25) # You can add more external include paths of other projects that are needed for your project. add_library ("${PROJECT_NAME}_lib" STATIC fastq_conversion.cpp) target_include_directories ("${PROJECT_NAME}_lib" PUBLIC "${${PROJECT_NAME}_SOURCE_DIR}/include") -target_link_libraries ("${PROJECT_NAME}_lib" PUBLIC seqan3::seqan3 sharg::sharg seqan::hibf) +target_link_libraries ("${PROJECT_NAME}_lib" PUBLIC seqan3::seqan3 sharg::sharg seqan::hibf + fmindex-collection::fmindex-collection +) target_compile_options ("${PROJECT_NAME}_lib" PUBLIC "-pedantic" "-Wall" "-Wextra") # Add the application. From 5c6880e9ca7aa00dc6c759429d39acc07f0beee9 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Wed, 13 Mar 2024 13:15:46 +0100 Subject: [PATCH 3/3] [INFRA] Simplify CI a bit --- .github/workflows/ci_coverage.yml | 22 +++++----------------- .github/workflows/ci_linux.yml | 14 -------------- .github/workflows/ci_macos.yml | 14 -------------- .github/workflows/lint.yml | 3 --- 4 files changed, 5 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci_coverage.yml b/.github/workflows/ci_coverage.yml index c2aa21e..d9e14d8 100644 --- a/.github/workflows/ci_coverage.yml +++ b/.github/workflows/ci_coverage.yml @@ -11,10 +11,9 @@ on: concurrency: group: coverage-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: false + cancel-in-progress: ${{ github.event_name != 'push' }} env: - SHARG_NO_VERSION_CHECK: 1 TZ: Europe/Berlin defaults: @@ -34,16 +33,10 @@ jobs: compiler: "gcc-13" steps: - # How many commits do we need to fetch to also fetch the branch point? - - name: Get fetch depth - id: fetch_depth - run: echo "depth=$(( ${{ github.event.pull_request.commits }} + 2 ))" >> $GITHUB_OUTPUT - - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: ${{ steps.fetch_depth.outputs.depth }} - submodules: false + fetch-depth: 0 - name: Setup toolchain uses: seqan/actions/setup-toolchain@main @@ -61,7 +54,7 @@ jobs: sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/${CC/gcc/gcov} 100 pip install gcovr==6.0 - - name: Configure tests + - name: Configure run: | mkdir build cd build @@ -70,24 +63,19 @@ jobs: -DCMAKE_C_FLAGS="--coverage -fprofile-arcs -ftest-coverage -Werror" \ -DCMAKE_EXE_LINKER_FLAGS="-Wl,-lgcov" \ -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-lgcov" - make -j2 -k gtest_main yaml-cpp - - name: Build tests + - name: Build and run tests run: | - ccache -z cd build make -j2 -k check - ccache -sv - name: Generate coverage report run: | gcovr --gcov-executable ${{ github.workspace }}/.github/workflows/scripts/gcov.sh \ - --root ${{ github.workspace }}/test \ + --root ${{ github.workspace }} \ ${{ github.workspace }}/build \ --filter ${{ github.workspace }}/include \ --filter ${{ github.workspace }}/src \ - --exclude-lines-by-pattern '^\s*$' \ - --exclude-lines-by-pattern '^\s*};$' \ --exclude-unreachable-branches \ --exclude-throw-branches \ --exclude-noncode-lines \ diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml index 85109fd..cba423f 100644 --- a/.github/workflows/ci_linux.yml +++ b/.github/workflows/ci_linux.yml @@ -14,7 +14,6 @@ concurrency: cancel-in-progress: ${{ github.event_name != 'push' }} env: - SHARG_NO_VERSION_CHECK: 1 TZ: Europe/Berlin defaults: @@ -32,31 +31,24 @@ jobs: include: - name: "clang17" compiler: "clang-17" - build: unit build_type: Release cxx_flags: "-stdlib=libc++" - name: "gcc13" compiler: "gcc-13" - build: unit build_type: Release - name: "gcc12" compiler: "gcc-12" - build: unit build_type: Release - name: "gcc11" compiler: "gcc-11" - build: unit build_type: Release steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 1 - submodules: false - name: Setup toolchain uses: seqan/actions/setup-toolchain@main @@ -75,12 +67,6 @@ jobs: cd build cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }} -Werror" - make -j2 -k gtest_main yaml-cpp - - - name: Build application - run: | - cd build - make -j2 -k - name: Build and run tests run: | diff --git a/.github/workflows/ci_macos.yml b/.github/workflows/ci_macos.yml index 18599cd..2011975 100644 --- a/.github/workflows/ci_macos.yml +++ b/.github/workflows/ci_macos.yml @@ -14,7 +14,6 @@ concurrency: cancel-in-progress: ${{ github.event_name != 'push' }} env: - SHARG_NO_VERSION_CHECK: 1 TZ: Europe/Berlin defaults: @@ -32,31 +31,24 @@ jobs: include: - name: "clang17" compiler: "clang-17" - build: unit build_type: Release cxx_flags: "-stdlib=libc++" # For verbosity. This is already the default. - name: "gcc13" compiler: "gcc-13" - build: unit build_type: Release - name: "gcc12" compiler: "gcc-12" - build: unit build_type: Release - name: "gcc11" compiler: "gcc-11" - build: unit build_type: Release steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 1 - submodules: false - name: Setup toolchain uses: seqan/actions/setup-toolchain@main @@ -75,12 +67,6 @@ jobs: cd build cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ -DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }} -Werror" - make -j3 -k gtest_main yaml-cpp - - - name: Build application - run: | - cd build - make -j3 -k - name: Build and run tests run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a4a7bc7..63a5546 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,9 +22,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 1 - submodules: false - name: Run clang-format uses: DoozyX/clang-format-lint-action@v0.17