vcpkg/ports/xnnpack/use-packages.patch
Park DongHa e809a42f87
[cpuinfo,fbgemm,xnnpack] update cpuinfo to latest (#23944)
* [cpuinfo] update to latest

* use official support of CMake find_package

* [cpuinfo] update triplet support

* [nnpack] fix cpuinfo usage

* [qnnpack] fix cpuinfo usage

* [fbgemm] fix cpuinfo usage

* [xnnpack] fix cpuinfo usage

* [cpuinfo] add license

* [nnpack] port license/dependencies

* [qnnpack] port license

* [xnnpack] port license

* [fbgemm] port license

* fix supports

* I think this should work?

* alright, arm&windows is unsupported... for now

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
2022-04-12 12:47:40 -07:00

91 lines
3.1 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b69ce50c..1e8938b7 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3042,7 +3032,7 @@ ELSE()
ENDIF()
ENDIF()
-TARGET_INCLUDE_DIRECTORIES(XNNPACK PUBLIC include)
+TARGET_INCLUDE_DIRECTORIES(XNNPACK PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
TARGET_INCLUDE_DIRECTORIES(XNNPACK PRIVATE src)
IF(WIN32)
# Target Windows 7+ API
@@ -3057,7 +3047,7 @@ IF(LIBM)
ENDIF()
# ---[ Configure clog
-IF(NOT TARGET clog)
+IF(FALSE)
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
SET(CLOG_BUILD_TESTS OFF CACHE BOOL "")
SET(CLOG_RUNTIME_TYPE "${CPUINFO_RUNTIME_TYPE}" CACHE STRING "")
@@ -3075,10 +3065,9 @@ IF(NOT TARGET clog)
SET_PROPERTY(TARGET clog PROPERTY IMPORTED_LOCATION "${CLOG_LIBRARY}")
ENDIF()
ENDIF()
-TARGET_LINK_LIBRARIES(XNNPACK PRIVATE clog)
# ---[ Configure cpuinfo
-IF(NOT TARGET cpuinfo)
+IF(FALSE)
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
SET(CPUINFO_BUILD_TOOLS OFF CACHE BOOL "")
SET(CPUINFO_BUILD_UNIT_TESTS OFF CACHE BOOL "")
@@ -3096,10 +3085,11 @@ IF(NOT TARGET cpuinfo)
SET_PROPERTY(TARGET cpuinfo PROPERTY IMPORTED_LOCATION "${CPUINFO_LIBRARY}")
ENDIF()
ENDIF()
-TARGET_LINK_LIBRARIES(XNNPACK PRIVATE cpuinfo)
+find_package(cpuinfo CONFIG REQUIRED)
+target_link_libraries(XNNPACK PUBLIC cpuinfo::clog cpuinfo::cpuinfo)
# ---[ Configure pthreadpool
-IF(NOT TARGET pthreadpool)
+IF(FALSE)
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
SET(PTHREADPOOL_BUILD_TESTS OFF CACHE BOOL "")
SET(PTHREADPOOL_BUILD_BENCHMARKS OFF CACHE BOOL "")
@@ -3119,7 +3109,7 @@ ENDIF()
TARGET_LINK_LIBRARIES(XNNPACK PUBLIC pthreadpool)
# ---[ Configure FXdiv
-IF(NOT TARGET fxdiv)
+IF(FALSE)
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
SET(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
SET(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
@@ -3135,10 +3125,11 @@ IF(NOT TARGET fxdiv)
SET_PROPERTY(TARGET fxdiv PROPERTY LINKER_LANGUAGE C)
ENDIF()
ENDIF()
-TARGET_LINK_LIBRARIES(XNNPACK PRIVATE fxdiv)
+find_path(FXDIV_INCLUDE_DIRS "fxdiv.h")
+target_include_directories(XNNPACK PRIVATE ${FXDIV_INCLUDE_DIRS})
# ---[ Configure FP16
-IF(NOT TARGET fp16)
+IF(FALSE)
IF(NOT XNNPACK_USE_SYSTEM_LIBS)
SET(FP16_BUILD_TESTS OFF CACHE BOOL "")
SET(FP16_BUILD_BENCHMARKS OFF CACHE BOOL "")
@@ -3154,12 +3145,17 @@ IF(NOT TARGET fp16)
SET_PROPERTY(TARGET fp16 PROPERTY LINKER_LANGUAGE C)
ENDIF()
ENDIF()
-TARGET_LINK_LIBRARIES(XNNPACK PRIVATE fp16)
+find_path(FP16_INCLUDE_DIRS "fp16.h")
+target_include_directories(XNNPACK PRIVATE ${FP16_INCLUDE_DIRS})
INSTALL(TARGETS XNNPACK
+ EXPORT xnnpack-config
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+install(EXPORT xnnpack-config NAMESPACE unofficial::
+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xnnpack)
# ---[ XNNPACK unit tests
IF(XNNPACK_BUILD_TESTS)