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

Tweak build for QIREE (downstream) #587

Closed
wants to merge 2 commits into from

Conversation

ausbin
Copy link
Contributor

@ausbin ausbin commented Jun 2, 2024

I'm working on linking Qwerty with QIREE, but QIREEConfig.cmake attempts to find_package(XACC 1.0.0), which is not valid unless there is a xacc-config-version.cmake, which this PR adds. Yes we could tweak QIREE's configuration not to do that, but I think this is a valid usecase for software downstream of XACC.

This PR also avoids installing gtest if tests are not being built. If ORNL folks point cmake to $XACC_DIR to find gtest when building QIREE (I have no clue if so), then this is a breaking change. (However, I don't think make install for any software package should install the unit testing framework it uses, in my opinion. Imagine how many different versions of unit testing libraries you'd have in /usr/lib if that were common practice.)

This creates a version file so that you can specify a version for
find_package(XACC), like find_package(XACC 1.0.0). For more info, see:
https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-version-selection
@@ -20,11 +20,7 @@ if(NOT TARGET format)
endif()

# Set version info
set(XACC_VERSION_MAJOR @MAJOR_VERSION@)
set(XACC_VERSION_MINOR @MINOR_VERSION@)
set(XACC_VERSION_PATCH @PATCH_VERSION@)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are set by find_package() automatically. See the end of this section: https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-version-selection

# file without ${PACKAGE_FIND_VERSION} set, then if() will still get three
# operands. Without the quotes, if() will only get two operands in that case,
# throwing an error.
if(${PACKAGE_VERSION} VERSION_GREATER_EQUAL "${PACKAGE_FIND_VERSION}")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if this behavior is right. For reference, here is the LLVMConfigVersion.cmake on my system:

set(PACKAGE_VERSION "18.1.6")

# LLVM is API-compatible only with matching major.minor versions
# and patch versions not less than that requested.
if("18.1" VERSION_EQUAL
    "${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
   AND NOT "6" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
  set(PACKAGE_VERSION_COMPATIBLE 1)
  if("6" VERSION_EQUAL
      "${PACKAGE_FIND_VERSION_PATCH}")
    set(PACKAGE_VERSION_EXACT 1)
  endif()
endif()

Note that it's doing more careful logic there. If we release XACC 2.0 that breaks everything, then maybe this should not pass (it currently would say "ok, looks compatible to me")

@ausbin
Copy link
Contributor Author

ausbin commented Jun 3, 2024

Closed in favor of ORNL-QCI#4

@ausbin ausbin closed this Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant