Repository navigation
Improve Detection of libMesh Installation via LIBMESH_ROOT and CMake's PkgConfig - #3149
Conversation
pshriwise
left a comment
There was a problem hiding this comment.
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 |
pshriwise
left a comment
There was a problem hiding this comment.
Thanks @ahnaf-tahmid-chowdhury for these improvements.
Overview:
This PR enhances the current CMake configuration for finding the
libMeshinstallation when building OpenMC with libMesh support. The existing implementation relies on the system'spkg-configpath, which can be problematic in environments wherelibMeshis installed in non-standard locations. The proposed changes address this issue by introducing the ability to use aLIBMESH_ROOTenvironment variable to locate thelibMeshinstallation.Changes:
LIBMESH_ROOTis set, the CMake script will now search for thelibmesh.pcfile in several commonpkgconfigsubdirectories within the provided root path. If found, thePKG_CONFIG_PATHis updated to include the directory containing the.pcfile.libmesh.pcfile is found or when it fails to locate the file.LIBMESH_ROOTis not set, defaulting to using the system'spkg-configpath and CMake’s prefix path mechanism.Example:
Set
LIBMESH_ROOTenvironment variable:export LIBMESH_ROOT=/path/to/custom/libmesh/installCMake now finds
libmesh.pcautomatically in$LIBMESH_ROOT/lib/pkgconfigor 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