Migrate library and installation configuration to use Cetmodules#165
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the build system by migrating from manual CMake library management to cetmodules, a specialized CMake framework for C++ projects. The changes include converting all library definitions to use cet_make_library, establishing a unified export set for the phlex namespace, and transitioning the test suite to use cet_test.
Key changes:
- Converted 6 library modules (core, graph, metaprogramming, model, utilities, app) to use
cet_make_librarywith proper export names - Migrated 30+ unit tests and integration tests from custom helper functions to
cet_test - Updated integration tests to use
${PROJECT_BINARY_DIR}for plugin paths, making the build directory structure more flexible
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| CMakeLists.txt | Added cet_cmake_env() and cet_cmake_config() calls to initialize cetmodules infrastructure |
| phlex/CMakeLists.txt | Registered the phlex export set and reorganized subdirectory inclusion order; created interface libraries for module and configuration |
| phlex/app/CMakeLists.txt | Converted run_phlex library to use cet_make_library, added INSTALL_RPATH to phlex executable, and switched to explicit header installation |
| phlex/core/CMakeLists.txt | Migrated core library to cet_make_library with explicit file-based header installation and interface library setup |
| phlex/graph/CMakeLists.txt | Converted graph library to cetmodules with manual header installation |
| phlex/metaprogramming/CMakeLists.txt | Transitioned metaprogramming interface library to cet_make_library |
| phlex/model/CMakeLists.txt | Migrated model library to cetmodules with explicit header file installation |
| phlex/utilities/CMakeLists.txt | Converted utilities library to cet_make_library with manual header installation |
| test/CMakeLists.txt | Replaced custom add_unit_test and add_catch_test functions with direct cet_test calls for all 25 unit tests |
| test/benchmarks/CMakeLists.txt | Converted benchmark tests to use cet_test with HANDBUILT and updated plugin path to use ${PROJECT_BINARY_DIR} |
| test/max-parallelism/CMakeLists.txt | Migrated parallelism check tests to cet_test framework |
| test/memory-checks/CMakeLists.txt | Converted memory check test to cet_test |
| test/mock-workflow/CMakeLists.txt | Updated mock workflow integration test to use cet_test |
| test/plugins/CMakeLists.txt | Converted plugin test to cet_test framework |
| test/utilities/CMakeLists.txt | Migrated utility tests (sized_tuple, sleep_for, thread_counter) to cet_test |
knoepfel
left a comment
There was a problem hiding this comment.
@greenc-FNAL, modulo some awkward cmake-format choices, this PR looks fine. Do you anticipate any other changes?
I'm just about to take a look what Copilot has to say in its review, but otherwise it's self-contained. As for the |
- Adopt `cetmodules` for library generation and export sets:
- Convert `phlex::module` and `phlex::configuration` to use `cet_make_library`.
- Establish `phlex` export set via `cet_register_export_set`.
- Update `phlex::core` and other libraries to use `cet_make_library`.
- Re-enable `phlex/app` build (previously disabled) and update `run_phlex`.
- Fix installation configuration:
- Add `INSTALL_RPATH` to `phlex` executable.
- Workaround for `cetmodules` issue with `FILE_SET` in `install(TARGETS)`:
- Replaced `FILE_SET HEADERS` with explicit `install(FILES ...)` for `phlex/app` headers.
- This addresses `cetmodules` issue Framework-R-D#34 (FNALssi/cetmodules#34).
- Update integration tests to use `${PROJECT_BINARY_DIR}` for plugin paths.
- Replace custom `add_unit_test` and `add_catch_test` CMake functions with standard `cet_test()` from `cetmodules`. - Update `test/CMakeLists.txt` to include `CetTest` module. - Refactor all unit and Catch2 tests in `test/CMakeLists.txt`, `test/memory-checks/CMakeLists.txt`, and `test/utilities/CMakeLists.txt` to use `cet_test`. - Utilize `USE_CATCH2_MAIN` option for Catch2 tests to leverage built-in main function generation. - Explicitly specify source files using `SOURCE` keyword for better clarity. - This change standardizes the testing infrastructure, reduces boilerplate code, and ensures better integration with the `cetmodules` ecosystem. Convert integration tests to use cet_test() - Replace manual add_test() calls with cet_test(HANDBUILT ...). - Ensure PHLEX_PLUGIN_PATH is correctly set to PROJECT_BINARY_DIR. Run `cmake-format` (non-FORM)
8f8acdc to
4ac6626
Compare
I find long lists like: cet_make_library(
LIBRARY_NAME
phlex_utilities_int
EXPORT_NAME
utilities
INTERFACE
NO_SOURCE
LIBRARIES
phlex_utilities
TBB::tbb
spdlog::spdlog
)difficult to parse. However, now is probably not the time to revisit the CMake formatting. We can do that another different time. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #165 +/- ##
==========================================
+ Coverage 80.90% 80.95% +0.04%
==========================================
Files 115 115
Lines 2042 2042
Branches 330 330
==========================================
+ Hits 1652 1653 +1
Misses 256 256
+ Partials 134 133 -1
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Description
This PR modernizes the build system by fully adopting
cetmodulesfor library generation, export sets, and installation configuration. It also transitions the majority of the test suite to usecet_test.Key Changes
Library Configuration:
phlex/(core,graph,metaprogramming,model,utilities,app) to usecet_make_library.phlexexport set viacet_register_export_set.Installation Fixes:
INSTALL_RPATHto thephlexexecutable to ensure it can locatelibrun_phlex.sorelative to the binary.cetmodulesissue Remove for_each(...) registration API #34 (regardingFILE_SETininstall(TARGETS)) by replacingFILE_SET HEADERSwith explicitinstall(FILES ...)forphlex/appheaders.Test Suite Modernization:
cet_test(excepttest/form, to follow as a separate PR).${PROJECT_BINARY_DIR}forPHLEX_PLUGIN_PATH, ensuring plugins are found regardless of the build directory structure.Notes