-
Notifications
You must be signed in to change notification settings - Fork 503
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
Improve Detection of libMesh Installation via LIBMESH_ROOT
and CMake's PkgConfig
#3149
Improve Detection of libMesh Installation via LIBMESH_ROOT
and CMake's PkgConfig
#3149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing implementation relies on the system's pkg-config path, which can be problematic in environments where libMesh is installed in non-standard locations.
Can you provide an example where the root directory of the libMesh installation is the cause of the problem? We currently rely on a libMesh installation installed in a custom location in CI and this should be captured as part of the CMAKE_PREFIX_PATH
variable in the current implementation. I'd probably rather dig into why that isn't working, if that's the case, than add a new variable to our CMake files.
The search suffixes I can understand may be a problem, but, similar to the root directory, I'd rather avoid deviating from CMake's built-in capabilities if at all possible.
I encountered an issue when building everything locally within a Docker container. The installation works fine when OpenMC is installed in the system directory. However, we can only configure CMAKE_INSTALL_PREFIX once, and we've configured it multiple times to identify different root directories for various packages like DAGMC and NCrystal. While enabling all of them, I faced problems where the setup for |
Just to be clear, you're saying that the
can you specify where we're configuring it multiple times. I'm wondering if we're miscommunicating about I do see in our CI files that the |
Thanks for introducing CMAKE_PREFIX_PATH. It looks like the workflow is functioning with the previous config file, which makes me wonder why my Docker setup was consistently failing. I’ll dig deeper into the Docker environment to identify what might be causing the issue there. |
76e1504
to
2e1a065
Compare
Added some hints, and have removed LIBMESH_PC variable. |
@ahnaf-tahmid-chowdhury were you able to accomplish what's needed by updating the |
Yes, we can rely on CMAKE_PREFIX_PATH. However, since everything is working, I have just added some hints for getting the configuration file by setting the root dir only. |
It appears that a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ahnaf-tahmid-chowdhury for these improvements.
Overview:
This PR enhances the current CMake configuration for finding the
libMesh
installation when building OpenMC with libMesh support. The existing implementation relies on the system'spkg-config
path, which can be problematic in environments wherelibMesh
is installed in non-standard locations. The proposed changes address this issue by introducing the ability to use aLIBMESH_ROOT
environment variable to locate thelibMesh
installation.Changes:
LIBMESH_ROOT
is set, the CMake script will now search for thelibmesh.pc
file in several commonpkgconfig
subdirectories within the provided root path. If found, thePKG_CONFIG_PATH
is updated to include the directory containing the.pc
file.libmesh.pc
file is found or when it fails to locate the file.LIBMESH_ROOT
is not set, defaulting to using the system'spkg-config
path and CMake’s prefix path mechanism.Example:
Set
LIBMESH_ROOT
environment variable:export LIBMESH_ROOT=/path/to/custom/libmesh/install
CMake now finds
libmesh.pc
automatically in$LIBMESH_ROOT/lib/pkgconfig
or other common pkgconfig directories within the installation.Additional Information:
The updated CMake script can handle installations in various locations, such as:
${LIBMESH_ROOT}/lib/pkgconfig
${LIBMESH_ROOT}/lib64/pkgconfig
${LIBMESH_ROOT}/lib/x86_64-linux-gnu/pkgconfig
${LIBMESH_ROOT}/share/pkgconfig