Skip to content

Name CMake variables consistently#1744

Merged
davidscn merged 13 commits intoprecice:developfrom
davidscn:rename-cmake
Aug 4, 2023
Merged

Name CMake variables consistently#1744
davidscn merged 13 commits intoprecice:developfrom
davidscn:rename-cmake

Conversation

@davidscn
Copy link
Copy Markdown
Member

@davidscn davidscn commented Jul 26, 2023

Main changes of this PR

Names our CMake variables consistently and cleans-up some cmake variables, which are currently not marked as advanced. Current suggestions/renamings:

  • PRECICE_PETScMapping -> PRECICE_FEATURE_PETSC_MAPPING
  • PRECICE_MPICommunication -> PRECICE_FEATURE_MPI_COMMUNICATION
  • PRECICE_Packages -> PRECICE_CONFIGURE_PACKAGE_GENERATION
  • PRECICE_PythonActions -> PRECICE_FEATURE_PYTHON_ACTIONS
  • PRECICE_ENABLE_C -> PRECICE_BINDINGS_C
  • PRECICE_ENABLE_FORTRAN ->PRECICE_BINDINGS_FORTRAN
  • PRECICE_ENABLE_LIBBACKTRACE -> PRECICE_FEATURE_LIBBACKTRACE_STACKTRACES

All remaining variables remain unchanged. As discussed in #1516 the naming scheme is supposed to follow the convention PRECICE_FEATURE, i.e., <PREFIX>_<DEPENDENCY>_<FEATURE>. The only violation I can spot right now is PRECICE_ENABLE_LIBBACKTRACE, or should we go for PRECICE_LIBBACKTRACE_STACKTRACES?

Motivation and additional information

See #1516 and closes #1516

Author's checklist

  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I added a changelog file with make changelog if there are user-observable changes since the last release.
  • I added a test to cover the proposed changes in our test suite.
  • For breaking changes: I documented the changes in the appropriate porting guide.
  • I sticked to C++17 features.
  • I sticked to CMake version 3.16.3.
  • I squashed / am about to squash all commits that should be seen as one.
  • update spack and more downstream package manager

Reviewers' checklist

  • Does the changelog entry make sense? Is it formatted correctly?
  • Do you understand the code changes?

@davidscn davidscn added the breaking change Breaks backwards compatibility and users need to act label Jul 26, 2023
@davidscn davidscn added this to the Version 3.0.0 milestone Jul 26, 2023
@davidscn davidscn requested review from MakisH and fsimonis July 26, 2023 13:53
@fsimonis
Copy link
Copy Markdown
Member

As the upcoming xSDK version 1.0.0 is currently tested with precice@develop, we should prepare an update for the precice Spack package before merging this.

Comment thread CMakeLists.txt
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
@MakisH
Copy link
Copy Markdown
Member

MakisH commented Jul 31, 2023

The only violation I can spot right now is PRECICE_ENABLE_LIBBACKTRACE, or should we go for PRECICE_LIBBACKTRACE_STACKTRACES?

I also don't have any good idea on how to handle this. Does it toggle a feature, or choose between two different dependencies?

@davidscn
Copy link
Copy Markdown
Member Author

davidscn commented Aug 1, 2023

Does it toggle a feature, or choose between two different dependencies?

It toggles more of a developer feature, which enables the generation of stacktraces (otherwise the stacktraces are just masked and unusable).

@davidscn
Copy link
Copy Markdown
Member Author

davidscn commented Aug 2, 2023

More on a side-note: do we also keep the default for all FEATURE=ON ? Some of them are more in use for corner-cases. Some projects use autodetection mechanisms for such purposes. Any opinions on this?

@MakisH
Copy link
Copy Markdown
Member

MakisH commented Aug 2, 2023

More on a side-note: do we also keep the default for all FEATURE=ON ? Some of them are more in use for corner-cases. Some projects use autodetection mechanisms for such purposes. Any opinions on this?

As long as the user receives a clear message "PETSc not found - Set PRECICE_FEATURE_PETSC_MAPPING=OFF", I would be fine with the current behavior. The autodetection could lead to silently disabling some features, which may be making reproducibility more complicated.

@fsimonis
Copy link
Copy Markdown
Member

fsimonis commented Aug 3, 2023

I like the new format. The feature prefix really makes them easier to detect in ccmake too.

Some projects use autodetection mechanisms for such purposes. Any opinions on this?

Autodetection is a huge pain as your entire system leaks into your builds, making them non-reproducible. I already ran into this with some other projects. Explicit options and hard errors are the way to go. CMake has some support for this, but it is super confusing from the developer and user perspective.

libbacktrace is intended to be a developer tool, so I wouldn't make it too prominent. Technically, it toggles more extensive stacktraces, which could be seen as a feature.

Some TODOs:

  • Update cmake/GenerateVersionInformation.cmake (output of precice-tools version)
  • Update 'CMakePresets.txt`

I have a spack branch ready now. So, its not blocking a merge.

@davidscn
Copy link
Copy Markdown
Member Author

davidscn commented Aug 3, 2023

Update 'CMakePresets.txt`

I don't see any update requirements in the CMakePresets.json

@fsimonis
Copy link
Copy Markdown
Member

fsimonis commented Aug 3, 2023

Oops right.

So it's just a question what to do with the libbacktrace now.

@davidscn
Copy link
Copy Markdown
Member Author

davidscn commented Aug 3, 2023

So it's just a question what to do with the libbacktrace now.

Yes, for me, libbacktrace fits more into the category of developer features and not into our FEATURE category. Googletest might eventually end-up in the same. I would either

  • PRECICE_ENABLE_LIBBACKTRACE -> leave it as it is right now
  • PRECICE_DEVEL_LIBBACKTRACE -> to indicate development features
  • PRECICE_CONFIGURE_LIBBACKTRACE -> in analogy to our package generation

Once we agreed here, I would merge this PR, as I understand that a corresponding spack patch is ready.

@MakisH
Copy link
Copy Markdown
Member

MakisH commented Aug 3, 2023

* `PRECICE_ENABLE_LIBBACKTRACE` -> leave it as it is right now

The ENABLE_ prefix sounds a bit arbitrary now. Why should this be prefixed, but not, e.g., PRECICE_MPI_MAPPING?

* `PRECICE_DEVEL_LIBBACKTRACE` -> to indicate development features

This is the option I like the most, even though I would find it hard to argue that it is only a feature for developers of preCICE. I could imagine that people use stacktraces when debugging their codes, which use preCICE. But no real objection here.

* `PRECICE_CONFIGURE_LIBBACKTRACE` -> in analogy to our package generation

I thought that the package generation was really that we prepare the configuration for the package generation. The CONFIGURE_ here sounds strange to me (again: why for this but not also for everything else).

@davidscn
Copy link
Copy Markdown
Member Author

davidscn commented Aug 3, 2023

This is the option I like the most, even though I would find it hard to argue that it is only a feature for developers of preCICE. I could imagine that people use stacktraces when debugging their codes, which use preCICE. But no real objection here.

I mean we can also go for PRECICE_FEATURE_LIBBACKTRACE_STACKTRACES if you argue this way.

@MakisH
Copy link
Copy Markdown
Member

MakisH commented Aug 4, 2023

This is the option I like the most, even though I would find it hard to argue that it is only a feature for developers of preCICE. I could imagine that people use stacktraces when debugging their codes, which use preCICE. But no real objection here.

I mean we can also go for PRECICE_FEATURE_LIBBACKTRACE_STACKTRACES if you argue this way.

Sounds consistent, I guess let's do that.

@davidscn davidscn merged commit 1678f9f into precice:develop Aug 4, 2023
@davidscn davidscn mentioned this pull request Sep 22, 2023
7 tasks
@davidscn davidscn deleted the rename-cmake branch July 17, 2024 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Breaks backwards compatibility and users need to act

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Naming convention for CMake variables

3 participants