Skip to content

Guarantee fypp files are preprocessed before compiling target sources - #98

Merged
wdeconinck merged 3 commits into
ecmwf:developfrom
cresswellp:feature/fypp_target_dependencies
Jul 29, 2026
Merged

Guarantee fypp files are preprocessed before compiling target sources#98
wdeconinck merged 3 commits into
ecmwf:developfrom
cresswellp:feature/fypp_target_dependencies

Conversation

@cresswellp

Copy link
Copy Markdown
Contributor

Description

Add a custom target to fckit_target_preprocess_fypp to ensure all source files generated from fypp preprocessing are available before compiling any sources in the original target.

The reason for the change is that if one of the generated sources is a module, files USE-ing that module can begin compiling before the relevant .mod file is available, resulting in build failures. This is a particular problem when using Ninja; its dynamic module dependency scanning will fail to notice any (yet-to-be-generated) modules in .fypp files, and begin compiling files that depend on those modules; even files in other targets that depend on the current library target.

Pre-processing is fast compared to compile times, so the additional dependencies are added by default as the cost to overall build time is negligible and there seems few good reasons not to guarantee the sources are available; but this can be disabled with the NO_TARGET_DEPENDS option if needed. We can reverse this if necessary (off by default) but having this on by default seems sensible.

Note also if fckit_target_preprocess_fypp is called twice on the same target, the custom target is only set up on the first call. A second call on the same input target would be unusual, though. As a belt-and-braces solution, either for a second call or when using the NO_TARGET_DEPENDS option, the list of generated sources can be returned to the caller using OUTPUT_SOURCES, so the calling project can explicitly manage its own dependencies if required.

Tests are added for all new features.

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

@wdeconinck

Copy link
Copy Markdown
Member

Thanks @cresswellp that is really neat!

@wdeconinck wdeconinck added the approved-for-ci Approved for CI run label Jul 29, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.07%. Comparing base (86e0bd1) to head (0a5e340).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop      #98   +/-   ##
========================================
  Coverage    51.07%   51.07%           
========================================
  Files           58       58           
  Lines         4854     4854           
  Branches       453      453           
========================================
  Hits          2479     2479           
  Misses        2375     2375           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot removed the approved-for-ci Approved for CI run label Jul 29, 2026
@wdeconinck
wdeconinck merged commit f227438 into ecmwf:develop Jul 29, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants