seqan / seqan3

The modern C++ library for sequence analysis. Contains version 3 of the library and API docs.
https://www.seqan.de
Other
411 stars 82 forks source link

[INFRA] Use CPM #3288

Closed eseiler closed 1 month ago

eseiler commented 1 month ago

This should make things easier eventually. See https://github.com/cpm-cmake/CPM.cmake

Ideally, we would use CMake to create seqan3-config.cmake and seqan3-config-version.cmake, i.e. use proper CMake packaging, which got a lot better since SeqAn3 was created.

For now, I'm keeping the old way of packaging.

Overview

Dependency Clone Source Package Installed Package
CPM.cmake CPM Vendored -
sdsl CPM Vendored Vendored
cereal CPM Vendored Vendored
google benchmark CPM CPM -
google test CPM CPM -
doxygen-awesome CPM CPM -
SeqAn2 CPM CPM -
use_ccache CPM Vendored -

CPM.cmake

When running from a git clone, build_system/CPM.cmake downloads the actual CPM.cmake and includes it. For source packages, the downloaded CPM.cmake replaces the build_system/CPM.cmake file in the project.

CPM

Dependencies are gathered by CPM.

Local packages (i.e., such found via find_package) can be used by setting the environment variable CPM_USE_LOCAL_PACKAGES to ON, or passing -DCPM_USE_LOCAL_PACKAGES=ON to CMake.

Packages can also be overridden by passing -D<DEPENDENCY>_SOURCE_DIR=<path> to CMake. For example, with -Ddoxygen_awesome_SOURCE_DIR=/path/to/doxygen-awesome, the doxygen-awesome package will be used from /path/to/doxygen-awesome. <DEPENDENCY> refers to the value of NAME in build_system/package-lock.cmake.

Vendored

Vendored dependencies are included in the project and have a fixed path. For example, sdsl is vendored in include/seqan3/vendor/sdsl-lite.

SeqAn2

SeqAn2 will be included when building tests if

SEQAN3_WITH_SEQAN2 is OFF by default. If CI is set, you can pass -DSEQAN3_WITH_SEQAN2_CI=OFF to CMake to disable SeqAn2.

Werror

Warnings are treated as errors if

SEQAN3_WITH_WERROR is ON by default. You can pass -DSEQAN3_WITH_WERROR=OFF to CMake to disable treating warnings as errors.

To do

seqan-actions commented 1 month ago

Documentation preview available at https://docs.seqan.de/preview/seqan/seqan3/3288

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.13%. Comparing base (30bdf8d) to head (d4a9857). Report is 14 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3288 +/- ## ======================================= Coverage 98.13% 98.13% ======================================= Files 271 271 Lines 11955 11955 Branches 104 104 ======================================= Hits 11732 11732 Misses 223 223 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

eseiler commented 1 month ago

Currently I am a big fan of CPM and this PR is a big step in the right direction.

  1. Where do the changes of gtest_build-> gtest_main and benchmark_build -> benchmark_main come from? that is from having newer dependencies?

{gtest,benchmark}_build where target defined by SeqAn3. {gtest,benchmark}_main are targets defined by gtest and benchmark.

  1. The workflows/CI has many -j2 removed, was that on purpose?

It's set in the environment, such that we don't need to update each workflow if the runners get more cores.

https://github.com/seqan/actions/blob/305a1ba7fe9e52ab47371785c3387d0dbcd23a02/docker/gcc/Dockerfile#L35-L36

https://github.com/seqan/actions/blob/305a1ba7fe9e52ab47371785c3387d0dbcd23a02/setup-compiler/action.yml#L106-L107

I guess there is also a way to make it dynamic in the docker image, but it isn't for now.

I put some random annotation with my thoughts to some lines. I think that this PR already tackles so much, that it is good to go.