Link cpuinfo only if supported (#11147)

* Remove unnecessary target_include_directories for cpuinfo

Headers already exposed as public by CMake target: 5916273f79/CMakeLists.txt (L213)

* Link to cpuinfo library only if supported
This commit is contained in:
Lukas 2022-04-08 06:32:12 +02:00 committed by GitHub
parent 541eff8d89
commit 1b664e6d4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -895,7 +895,6 @@ else()
set(CPUINFO_SUPPORTED FALSE)
endif()
# TODO do we have to add target_include_directories to each project that uses this?
if (CPUINFO_SUPPORTED)
set(PYTORCH_CPUINFO_DIR external/pytorch_cpuinfo)
set(PYTORCH_CPUINFO_INCLUDE_DIR ${PYTORCH_CPUINFO_DIR}/include)

View file

@ -210,13 +210,14 @@ if (ARM64 OR ARM OR X86 OR X64 OR X86_64)
# msvc compiler report syntax error with cpuinfo arm source files
# and cpuinfo does not have code for getting arm uarch info under windows
else()
# Link cpuinfo
# Link cpuinfo if supported
# Using it mainly in ARM with Android.
# Its functionality in detecting x86 cpu features are lacking, so is support for Windows.
target_include_directories(onnxruntime_common PRIVATE ${PYTORCH_CPUINFO_INCLUDE_DIR})
target_link_libraries(onnxruntime_common cpuinfo)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo clog)
if (CPUINFO_SUPPORTED)
target_link_libraries(onnxruntime_common cpuinfo)
list(APPEND onnxruntime_EXTERNAL_LIBRARIES cpuinfo clog)
endif()
endif()
endif()