Skip to content
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

Bugfix: CMake Install paths #1516

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Bugfix: CMake Install paths #1516

wants to merge 1 commit into from

Conversation

Davknapp
Copy link
Collaborator

@Davknapp Davknapp commented Mar 27, 2025

Instead of hard-coding paths use GNUInstallDirs to automatically set installation dirs for bin, lib etc..

We hard coded some installation paths, while p4est and sc use GNUInstallDirs to automatically set these paths. This PR unifies the behaviour

All these boxes must be checked by the AUTHOR before requesting review:

  • The PR is small enough to be reviewed easily. If not, consider splitting up the changes in multiple PRs.
  • The title starts with one of the following prefixes: Documentation:, Bugfix:, Feature:, Improvement: or Other:.
  • If the PR is related to an issue, make sure to link it.
  • The author made sure that, as a reviewer, he/she would check all boxes below.

All these boxes must be checked by the REVIEWERS before merging the pull request:

As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.

General

  • The reviewer executed the new code features at least once and checked the results manually.
  • The code follows the t8code coding guidelines.
  • New source/header files are properly added to the CMake files.
  • The code is well documented. In particular, all function declarations, structs/classes and their members have a proper doxygen documentation.
  • All new algorithms and data structures are sufficiently optimal in terms of memory and runtime (If this should be merged, but there is still potential for optimization, create a new issue).

Tests

  • The code is covered in an existing or new test case using Google Test.

If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):

  • Should this use case be added to the github action?
  • If not, does the specific use case compile and all tests pass (check manually).

Scripts and Wiki

  • If a new directory with source files is added, it must be covered by the script/find_all_source_files.scp to check the indentation of these files.
  • If this PR introduces a new feature, it must be covered in an example or tutorial and a Wiki article.

License

  • The author added a BSD statement to doc/ (or already has one).

@Davknapp Davknapp added priority:medium Should be solved within half a year workload:medium Would take a week or less CMake Is about the CMake build system labels Mar 27, 2025
@KerstinHartung
Copy link

Thanks @Davknapp ! That fixes the issue of incorrect linking and two lib-directories I had encountered.

Comment on lines +131 to +134
file(RELATIVE_PATH relativeRpath
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your solution may be completely right, but better safe than sorry:
According to CMake documentation, the RELATIVE_PATH argument of file works like this:

image

It seems to odd to me that we use two directories here instead; and wouldn't this mean relativePath would contain the relative path from the bin to the libfolder, so basically .../lib? 🤔

Or is this supposed to be some correction of the current state only?

@@ -36,7 +36,7 @@ function( add_t8_example )
set_target_properties( ${ADD_T8_EXAMPLE_NAME} PROPERTIES EXPORT_COMPILE_COMMANDS ON )
endif( T8CODE_EXPORT_COMPILE_COMMANDS )

install( TARGETS ${ADD_T8_EXAMPLE_NAME} DESTINATION bin )
install( TARGETS ${ADD_T8_EXAMPLE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} )
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be install( TARGETS ${ADD_T8_EXAMPLE_NAME} RUNTIME ) , like in the tutorials below?

Copy link
Collaborator

@spenke91 spenke91 left a comment

Choose a reason for hiding this comment

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

I tested it on the Teamsserver and it worked fine - however, it also did so before, so maybe that's not a great test. As you can see, I do have some question about the relative path 🤔

@spenke91 spenke91 assigned Davknapp and unassigned spenke91 Apr 2, 2025
@spenke91
Copy link
Collaborator

spenke91 commented Apr 2, 2025

Also, the PR description says it unifies the installation dirs with p4est and sc, but p4est does not seem to use GNUInstallDirs - do you think we might run into problems with that again at some point?

@Davknapp Davknapp added this to CMake Apr 7, 2025
@Davknapp Davknapp moved this to In Progress in CMake Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake Is about the CMake build system priority:medium Should be solved within half a year workload:medium Would take a week or less
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants