vcpkg/ports/xnnpack/use-packages.patch
Park DongHa 968c5eba7b
[xnnpack] create a new port (#17064)
* [xnnpack] create a new port

* [xnnpack] create a patch

* [cpuinfo] update to latest

* [cpuinfo] update baseline and port SHA

* Update ports/cpuinfo/fix-install.patch

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update ports/cpuinfo/fix-install.patch

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update ports/cpuinfo/portfile.cmake

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update ports/cpuinfo/fix-install.patch

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* [cpuinfo] update port SHA

* [cpuinfo] recover find_package

* fixup target path to `share/unofficial-cpuinfo`
* change IMPORTED target name to `unofficial::cpuinfo::cpuinfo`

* [fbgemm] resolve failure after cpuinfo rename

* change cpuinfo::cpuinfo to unofficial

* [fbgemm] update port version

* [nnpack] use changes target name

* [nnpack] update port-version

* [pthreadpool] support find_package

* update to latest source code

* [pthreadpool] update port version

* [pthreadpool] support uwp

* use WindowStore in platform check

* [xnnpack] support find_package

* windows: static build
* export with namespace `unofficial::`

* [xnnpack] update code to latest

* change snapshot to resolve linux compile errors

* [xnnpack] "supports" in manifest

* update baseline & port SHA

* [xnnpack] use 'vcpkg-cmake' ports

* update port git-tree SHA

* [xnnpack] remove unused configure options

* [xnnpack] update code version

* snapshot: 21/04/10 -> 21/05/17

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
Co-authored-by: Billy Robert ONeal III <bion@microsoft.com>
2021-05-17 23:22:24 -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(unofficial-cpuinfo CONFIG REQUIRED)
+target_link_libraries(XNNPACK PUBLIC unofficial::cpuinfo::clog unofficial::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)