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

Completes the WIP CMake config for find_package #116

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

ilumsden
Copy link
Collaborator

The big thing this PR does is complete @JaeseungYeom's WIP DYADConfig.cmake and similar stuff for exporting DYAD and making it compatible with find_package(DYAD CONFIG).

It also does the following more minor things:

  • Makes the naming of install path variables (e.g., DYAD_INSTALL_INCLUDE_DIR) more consistent and tweaks the values to be more consistent with expected behavior for installation paths
  • Replaces the glibc version check with a portable version
  • Replaces the CMake targets that added -Werror with a macro that will directly add the flag to targets with target_compile_options

In case we want to revert any of these changes, this PR currently does not delete any of the old code. Instead, the old code is just all commented out.

These changes have all been tested with the unit testing from the in-progress refactor/enhancement of the A4MD benchmark. Thanks to that, I can confirm that these changes allow external projects to properly use DYAD as a dependency with find_package.

@ilumsden
Copy link
Collaborator Author

ilumsden commented Jul 3, 2024

This PR has been rebased on top of #117. It should only be merged once #117 is merged

@ilumsden
Copy link
Collaborator Author

ilumsden commented Jul 3, 2024

This PR is ready for review @hariharan-devarajan @JaeseungYeom. Just note that it shouldn't be merged before #117

ilumsden added a commit to TauferLab/dyad that referenced this pull request Jul 9, 2024
@JaeseungYeom
Copy link
Contributor

Was this the PR that had ${CMAKE_INSTALL_PREFIX}/ removed?
We had a discussion on either testing to make sure linking is not broken with dynamic libraries or put it back.

@ilumsden
Copy link
Collaborator Author

ilumsden commented Sep 3, 2024

@JaeseungYeom @hariharan-devarajan I've updated this PR to undo the removal of CMAKE_INSTALL_PREFIX in places. I still need to test that I can still use this to find DYAD in another CMake project, but this PR should be ready to discuss in our meeting on Thursday.

Copy link
Collaborator

@hariharan-devarajan hariharan-devarajan left a comment

Choose a reason for hiding this comment

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

Some minor comments.

CMakeLists.txt Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
cmake/modules/SetupCompiler.cmake Outdated Show resolved Hide resolved
@ilumsden
Copy link
Collaborator Author

ilumsden commented Sep 4, 2024

@hariharan-devarajan @JaeseungYeom tests with A4X-Benchmark were successful. I'll make the last couple of minor edits that @hariharan-devarajan suggested, and then this PR is fully ready for final review and merge.

@ilumsden
Copy link
Collaborator Author

ilumsden commented Sep 5, 2024

@ilumsden double check that links/rpath is set correctly by running ldd

@ilumsden
Copy link
Collaborator Author

@ilumsden double check that links/rpath is set correctly by running ldd

RPATH is set correctly. When building with Spack, I get the following:

RPATH                /usr/WS2/lumsden1/spack/opt/spack/linux-rhel8-zen/gcc-10.3.1/dyad-cmake_export-l55ylmzb6eam427yrwgacppqpg3if2m5/lib64:/usr/WS2/lumsden1/spack/opt/spack/linux-rhel8-zen/gcc-10.3.1/dyad-cmake_export-l55ylmzb6eam427yrwgacppqpg3if2m5/lib64:/usr/WS2/lumsden1/spack/opt/spack/linux-rhel8-zen/gcc-10.3.1/gcc-runtime-10.3.1-jzsuaszeq4v63m2mgk3ccsbokplmvaxm/lib:/collab/usr/global/tools/tce4/packages/gcc/gcc-10.3.1/lib/gcc/x86_64-redhat-linux/10

The last 3 paths are injected by Spack. The first path is coming from DYAD's CMake.

@@ -89,11 +95,11 @@ macro(dyad_add_c_flags MY_FLAGS)
endmacro()

dyad_add_cxx_flags(CMAKE_CXX_FLAGS
-fPIC -Wall -Wextra -pedantic -Wno-unused-parameter -Wnon-virtual-dtor
-Wall -Wextra -pedantic -Wno-unused-parameter -Wnon-virtual-dtor
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JaeseungYeom @hariharan-devarajan I slightly misspoke yesterday.

I did not replace -fPIC with something else. I just removed it here (and below for C) because we were already using the CMake compiler-independent version of specifying it. So, the manual use of -fPIC here is redundant.

This is the line where the CMake-specific variable is set: https://github.com/TauferLab/dyad/blob/00fe8812a60ffeab37ce5814b3d6947d45d37031/CMakeLists.txt#L195

-Wno-deprecated-declarations)

dyad_add_c_flags(CMAKE_C_FLAGS
-fPIC -Wall -Wextra -pedantic -Wno-unused-parameter
-Wall -Wextra -pedantic -Wno-unused-parameter
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See comment above

Copy link
Collaborator

@hariharan-devarajan hariharan-devarajan left a comment

Choose a reason for hiding this comment

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

Comments for -FPIC.

Remove the commented target properties.

@ilumsden
Copy link
Collaborator Author

@hariharan-devarajan @JaeseungYeom all the comments from yesterday have been addressed. I just have to rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CMake CHECK_GLIBC_VERSION macro causes configure crashes on non-LC systems
3 participants