Define namespace prefixed alias for cpuinfo in the CMake build#89
Define namespace prefixed alias for cpuinfo in the CMake build#89malfet merged 1 commit intopytorch:masterfrom
Conversation
|
Hi @petrhosek! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
This allows projects that depend on cpuinfo to use namespace qualified target name regardless of whether they consume cpuinfo through add_subdirectory or find_package.
|
Thank you for the review, would it be possible to merge this PR? |
|
I don't have write access to the repo. @malfet PTAL |
|
@Maratyszcza does the change look good to you? |
|
It's a common convention in modern CMake to provide aliases for each installed library to ensure that the library can be consumes via See for example https://github.com/abseil/abseil-cpp/blob/d2c5297a3c3948de765100cb7e5cccca1210d23c/CMake/AbseilHelpers.cmake#L329. This can avoid similar constructs in downstream projects such as https://github.com/google/ruy/blob/368db7123bf3178c92c8502696c6865fb07bfcda/CMakeLists.txt#L85. There's an ongoing discussion about how to supports this directly in CMake, see https://gitlab.kitware.com/cmake/cmake/-/issues/22687 |
|
Thank you for the explanation, looks good to me |
|
cc @bjacob |
Summary: Pull Request resolved: pytorch#84876 Fixes the following error when building qnnpack: ``` CMake Error: install(EXPORT "cpuinfo-targets" ...) includes target "cpuinfo" which requires target "clog" that is not in any export set. ``` This diff mirrors the changes to the CMakeLists of - pytorch/cpuinfo#69 - pytorch/cpuinfo#89 Test Plan: # Build Qnnpack ``` export ANDROID_NDK=/opt/android_ndk/r20 export ANDROID_NDK_HOME=${ANDROID_NDK} export ANDROID_SDK=/opt/android_sdk export ANDROID_HOME=${ANDROID_SDK} cd ~/fbsource/fbcode/caffe2/aten/src/ATen/native/quantized/cpu/qnnpack ./scripts/build-android-arm64.sh ``` Succeeds Differential Revision: D39438768 fbshipit-source-id: 9bd0119ffea984d274e85b8b756b630743a89f0f
This allows projects that depend on cpuinfo to use namespace qualified
target name regardless of whether they consume cpuinfo through
add_subdirectory or find_package.