Skip to content

[CMake] Avoid unneeded artifacts in the library installation directory #19044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

guitargeek
Copy link
Contributor

@guitargeek guitargeek commented Jun 14, 2025

Avoid unneeded artifacts in the library installation directory, in particular empty directories if the Python interfaces are installed in a directory other than the library installation directory.

Motivated by:

More detail in the commit description.

@guitargeek guitargeek self-assigned this Jun 14, 2025
@guitargeek guitargeek added in:Build System clean build Ask CI to do non-incremental build on PR labels Jun 14, 2025
Copy link

github-actions bot commented Jun 14, 2025

Test Results

    19 files      19 suites   3d 9h 58m 37s ⏱️
 2 810 tests  2 810 ✅ 0 💤 0 ❌
51 894 runs  51 894 ✅ 0 💤 0 ❌

Results for commit cebd367.

♻️ This comment has been updated with latest results.

Explicitly install byproducts of generating Core dictionaries, and put
the CMake code right next to where these byproducts are declared. This
is better than relying on all `.pcm` files getting installed via some
other part of the CMake code.
Explicitly installing the `modules.idx` file is better than copying it
by regex when copying the full library output directory.
Explicitly listing all the `pcm` files that otherwise would not get
installed seems tedious, but it has one clear advantage over
`install(DIRECTORY ...)`. The problem with the latter is that it
copies any subdirectories, not matter if the files in it were matched by
regex or not. So what happens is that you end up with several empty
directories in the install tree, notably the full directory structure of
the Python interfaces, in case they are installed to a different
directory. One way to fix this is to install the individual pcm files
instead, as suggested by this commit.
If the `CMAKE_INSTALL_PYTHONDIR` is different from the
`CMAKE_INSTALL_LIBDIR`, the cppyy libraries will still be installed in
the `CMAKE_INSTALL_LIBDIR` and then there are symlinks created in the
`CMAKE_INSTALL_PYTHONDIR`.

This should not be done, as system links should be avoided in the
install tree, it entangles the regular ROOT libraries with the Python
libraries, and there is actually no reason to do it.
@guitargeek guitargeek force-pushed the python_install_dir branch from 6950325 to cebd367 Compare June 14, 2025 20:58
@guitargeek guitargeek marked this pull request as ready for review June 14, 2025 20:58
@guitargeek guitargeek requested a review from bellenot as a code owner June 14, 2025 20:58
install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${byproduct}.pcm DESTINATION ${CMAKE_INSTALL_LIBDIR})
endforeach()

list(APPEND core_implicit_modules "-mByproduct" "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the semantic of those additions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clean build Ask CI to do non-incremental build on PR in:Build System
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants