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

Support CMake find_package #69

Merged
merged 2 commits into from
Mar 26, 2022
Merged

Support CMake find_package #69

merged 2 commits into from
Mar 26, 2022

Conversation

luncliff
Copy link
Contributor

Changes

CMake build generates cpuinfo-config.cmake and some other CMake scripts.
These files will be installed under {prefix}/share/cpuinfo.

Folder PATH listing for volume Local Disk
Volume serial number is 58BA-9039
C:\USERS\LUNCL\SOURCE\CPUINFO\INSTALL
├───bin
│       cache-info.exe
│       cpu-info.exe
│       cpuid-dump.exe
│       isa-info.exe
│       
├───include
│       clog.h
│       cpuinfo.h
│       
├───lib
│   │   clog.lib
│   │   cpuinfo.lib
│   │   
│   └───pkgconfig
│           libcpuinfo.pc
│
└───share
    └───cpuinfo
            cpuinfo-config.cmake
            cpuinfo-targets-debug.cmake
            cpuinfo-targets.cmake

After install, CMake users can search the libraries (cpuinfo and clog) using find_package config mode.

find_package(cpuinfo CONFIG REQUIRED)
target_link_libraries(main
PRIVATE
    cpuinfo::cpuinfo cpuinfo::clog
)

* export 2 target 'cpuinfo', 'clog'
* create cpuinfo-config.cmake template
@petrhosek
Copy link
Contributor

We're planning on taking a dependency on cpuinfo from LLVM (transitively via TFLite) and this change is one of the blockers so we would really like to see it merged. Is there any way we can help? I have looked over the change and it looks good to me.

@malfet malfet merged commit ba0f4a2 into pytorch:master Mar 26, 2022
megengine-bot pushed a commit to MegEngine/cpuinfo that referenced this pull request Sep 5, 2022
* Support CMake 'find_package'

* export 2 target 'cpuinfo', 'clog'
* create cpuinfo-config.cmake template

* fix script include

GitOrigin-RevId: ba0f4a2
salilsdesai added a commit to salilsdesai/pytorch that referenced this pull request Sep 16, 2022
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
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Sep 16, 2022
Summary:
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

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

Pull Request resolved: #84876
Approved by: https://github.com/digantdesai
mehtanirav pushed a commit to pytorch/pytorch that referenced this pull request Oct 4, 2022
Summary:
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

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

Pull Request resolved: #84876
Approved by: https://github.com/digantdesai
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants