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

Allow Ginkgo to Use the --prefix Option #1534

Merged
merged 5 commits into from
Feb 14, 2024

Conversation

MarcelKoch
Copy link
Member

@MarcelKoch MarcelKoch commented Jan 18, 2024

This PR allows Ginkgo to use the --prefix option of cmake --install. Before, the path set by --prefix would just be ignored and the CMAKE_INSTALL_PREFIX set at configure time would be used.

In principle, this is a minor change, except for the PKG config file. Getting this to work is quite cumbersome, but now it should work as expected.

Changes to the pkg-config file:

  • The prefix now uses the path specified by --prefix (if present)
  • libdir and includedir are now relative to prefix
  • The -L and -I paths for ginkgo also use paths relative to prefix

@MarcelKoch MarcelKoch self-assigned this Jan 18, 2024
@MarcelKoch MarcelKoch added the 1:ST:ready-for-review This PR is ready for review label Jan 18, 2024
@ginkgo-bot ginkgo-bot added the reg:build This is related to the build system. label Jan 18, 2024
cmake/ginkgo.pc.in Outdated Show resolved Hide resolved
@MarcelKoch MarcelKoch force-pushed the enable-setting-install-prefix branch 2 times, most recently from 556a62e to 206a493 Compare January 18, 2024 16:26
@MarcelKoch MarcelKoch marked this pull request as draft January 18, 2024 16:50
@MarcelKoch MarcelKoch marked this pull request as ready for review January 19, 2024 09:54
@MarcelKoch MarcelKoch requested a review from a team January 19, 2024 09:54
cmake/GinkgoConfig.cmake.in Outdated Show resolved Hide resolved
@upsj
Copy link
Member

upsj commented Jan 19, 2024

@MarcelKoch can you maybe list the behavioral changes in the pkg-config flag generation so we can check them against the code?

Copy link
Member

@upsj upsj left a comment

Choose a reason for hiding this comment

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

LGTM! Honestly I believe we are doing too much in our pkg-config generation, ideally it should only need

Libs: -lginkgo(d) -lginkgo_* <mpi link flags>
Cflags: -I${includedir}

I am not even sure if the MPI headers (and libraries) should be listed here, as they would need to be available for applications anyways. I would probably be happiest if we don't need to support static linking via pkg-config, because then we can also ignore all transitive dependencies and in a future release (see #715) require users to only link against libginkgo(d).so

Base automatically changed from fix-external-usage to develop January 22, 2024 13:08
@MarcelKoch MarcelKoch requested a review from a team January 24, 2024 09:34
@upsj upsj requested a review from pratikvn February 7, 2024 09:45
INSTALL.md Outdated
For example, to build everything (in debug mode), use:

```cmake
cmake -G "Unix Makefiles" -H. -BDebug -DCMAKE_BUILD_TYPE=Debug -DGINKGO_DEVEL_TOOLS=ON \
cmake .. -BDebug -DCMAKE_BUILD_TYPE=Debug -DGINKGO_DEVEL_TOOLS=ON \
Copy link
Member

Choose a reason for hiding this comment

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

can be simplified a bit

Suggested change
cmake .. -BDebug -DCMAKE_BUILD_TYPE=Debug -DGINKGO_DEVEL_TOOLS=ON \
cmake .. -BDebug -DCMAKE_BUILD_TYPE=Debug \

INSTALL.md Outdated
For example, to build everything (in debug mode), use:

```cmake
cmake -G "Unix Makefiles" -H. -BDebug -DCMAKE_BUILD_TYPE=Debug -DGINKGO_DEVEL_TOOLS=ON \
cmake .. -BDebug -DCMAKE_BUILD_TYPE=Debug -DGINKGO_DEVEL_TOOLS=ON \
-DGINKGO_BUILD_TESTS=ON -DGINKGO_BUILD_REFERENCE=ON -DGINKGO_BUILD_OMP=ON \
-DGINKGO_BUILD_CUDA=ON -DGINKGO_BUILD_HIP=ON
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
-DGINKGO_BUILD_CUDA=ON -DGINKGO_BUILD_HIP=ON
-DGINKGO_BUILD_CUDA=ON -DGINKGO_BUILD_HIP=ON -DGINKGO_BUILD_MPI=on

@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
project(GinkgoExportBuildWithPkgConfigTest LANGUAGES CXX)

find_package(PkgConfig REQUIRED)
pkg_check_modules(GINKGO REQUIRED IMPORTED_TARGET ginkgo)
pkg_check_modules(GINKGO REQUIRED IMPORTED_TARGET "ginkgo_${CMAKE_BUILD_TYPE}")
Copy link
Member

Choose a reason for hiding this comment

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

Is there no imported target with just ginkgo now ?

Copy link
Member Author

Choose a reason for hiding this comment

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

The IMPORTED_TARGET is just an option for PkgConfig, it has nothing to do with the package name. But I missed that we also installed the ginkgo.pc. I think that should be possible to fix.

@MarcelKoch MarcelKoch force-pushed the enable-setting-install-prefix branch 5 times, most recently from 141acd7 to 9ca0da6 Compare February 14, 2024 09:34
@MarcelKoch MarcelKoch added 1:ST:ready-to-merge This PR is ready to merge. and removed 1:ST:ready-for-review This PR is ready for review labels Feb 14, 2024
@MarcelKoch MarcelKoch merged commit 45692bd into develop Feb 14, 2024
13 of 15 checks passed
@MarcelKoch MarcelKoch deleted the enable-setting-install-prefix branch February 14, 2024 19:07
Copy link

sonarcloud bot commented Feb 15, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1:ST:ready-to-merge This PR is ready to merge. reg:build This is related to the build system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants