diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ca06ee..b0d8873 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6526,7 +6526,7 @@ ELSE() SET_PROPERTY(SOURCE ${COLD_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS "$<$>: -Os >") ENDIF() -TARGET_INCLUDE_DIRECTORIES(XNNPACK PUBLIC include) +TARGET_INCLUDE_DIRECTORIES(XNNPACK PUBLIC $ $) TARGET_INCLUDE_DIRECTORIES(XNNPACK PRIVATE src) TARGET_INCLUDE_DIRECTORIES(all_microkernels PRIVATE include src) TARGET_INCLUDE_DIRECTORIES(packing PRIVATE include src) @@ -6547,7 +6547,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 "") @@ -6565,11 +6565,9 @@ IF(NOT TARGET clog) SET_PROPERTY(TARGET clog PROPERTY IMPORTED_LOCATION "${CLOG_LIBRARY}") ENDIF() ENDIF() -TARGET_LINK_LIBRARIES(XNNPACK PRIVATE clog) -TARGET_LINK_LIBRARIES(jit 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 "") @@ -6587,10 +6585,12 @@ 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 PRIVATE cpuinfo::clog cpuinfo::cpuinfo) +TARGET_LINK_LIBRARIES(jit PRIVATE cpuinfo::clog) # ---[ 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 "") @@ -6607,14 +6607,15 @@ IF(NOT TARGET pthreadpool) SET_PROPERTY(TARGET pthreadpool PROPERTY IMPORTED_LOCATION "${PTHREADPOOL_LIBRARY}") ENDIF() ENDIF() -TARGET_LINK_LIBRARIES(XNNPACK PUBLIC pthreadpool) -TARGET_LINK_LIBRARIES(all_microkernels PRIVATE pthreadpool) -TARGET_LINK_LIBRARIES(indirection PRIVATE pthreadpool) -TARGET_LINK_LIBRARIES(jit PRIVATE pthreadpool) -TARGET_LINK_LIBRARIES(packing PRIVATE pthreadpool) +find_package(unofficial-pthreadpool CONFIG REQUIRED) +target_link_libraries(XNNPACK PUBLIC unofficial::pthreadpool) +target_link_libraries(all_microkernels PRIVATE unofficial::pthreadpool) +target_link_libraries(indirection PRIVATE unofficial::pthreadpool) +target_link_libraries(jit PRIVATE unofficial::pthreadpool) +target_link_libraries(packing PRIVATE unofficial::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 "") @@ -6630,12 +6631,13 @@ IF(NOT TARGET fxdiv) SET_PROPERTY(TARGET fxdiv PROPERTY LINKER_LANGUAGE C) ENDIF() ENDIF() -TARGET_LINK_LIBRARIES(XNNPACK PRIVATE fxdiv) -TARGET_LINK_LIBRARIES(all_microkernels PRIVATE fxdiv) -TARGET_LINK_LIBRARIES(indirection PRIVATE fxdiv) +find_path(FXDIV_INCLUDE_DIRS "fxdiv.h" REQUIRED) +target_include_directories(XNNPACK PRIVATE ${FXDIV_INCLUDE_DIRS}) +target_include_directories(all_microkernels PRIVATE ${FXDIV_INCLUDE_DIRS}) +target_include_directories(indirection 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 "") @@ -6651,15 +6653,21 @@ IF(NOT TARGET fp16) SET_PROPERTY(TARGET fp16 PROPERTY LINKER_LANGUAGE C) ENDIF() ENDIF() -TARGET_LINK_LIBRARIES(XNNPACK PRIVATE fp16) -TARGET_LINK_LIBRARIES(all_microkernels PRIVATE fp16) -TARGET_LINK_LIBRARIES(packing PRIVATE fp16) -TARGET_LINK_LIBRARIES(indirection PRIVATE fp16) +find_path(FP16_INCLUDE_DIRS "fp16.h" REQUIRED) +target_include_directories(XNNPACK PRIVATE ${FP16_INCLUDE_DIRS}) +target_include_directories(all_microkernels PRIVATE ${FP16_INCLUDE_DIRS}) +target_include_directories(packing PRIVATE ${FP16_INCLUDE_DIRS}) +target_include_directories(indirection 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)