vcpkg/ports/libtorch/fxdiv.patch
Alexander Neumann 20584b9d44
[libtorch] update to 2.1.2 (#36246)
* [libtorch] update to 2.1.2

* adjust features and deps

* remove dep

* fix onnx case

* use system fxdiv

* update xnnpack

* fxdiv fix in libtorch

* add newline

* xnnpack does not install configs

* more patching

* fix patch

* more fixes

* use full lib for sleef.

* fix glog symbol on osx

* try fixing msvc ice

* ok renaming did nothing

* v db

* remove comments

* v db

* cuda is only for x64

* v db

* fix usage since cuda is still external to vcpkg

* v db

---------

Co-authored-by: Jim wang (BEYONDSOFT CONSULTING INC) <v-wangjim@microsoft.com>
2024-01-30 14:15:33 -08:00

45 lines
1.7 KiB
Diff

diff --git a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
index d18523352..1f53945cf 100644
--- a/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
+++ b/aten/src/ATen/native/quantized/cpu/qnnpack/CMakeLists.txt
@@ -389,12 +389,12 @@ if(NOT TARGET fxdiv AND NOT USE_SYSTEM_FXDIV)
"${FXDIV_SOURCE_DIR}"
"${CONFU_DEPENDENCIES_BINARY_DIR}/fxdiv")
elseif(NOT TARGET fxdiv AND USE_SYSTEM_FXDIV)
- find_file(FXDIV_HDR fxdiv.h PATH_SUFFIXES include)
+ find_path(FXDIV_HDR fxdiv.h PATH_SUFFIXES include)
if(NOT FXDIV_HDR)
message(FATAL_ERROR "Cannot find fxdiv")
endif()
- add_library(fxdiv STATIC "${FXDIV_HDR}")
- set_property(TARGET fxdiv PROPERTY LINKER_LANGUAGE C)
+ add_library(fxdiv INTERFACE IMPORTED)
+ target_include_directories(fxdiv INTERFACE "${FXDIV_HDR}")
endif()
target_link_libraries(pytorch_qnnpack PRIVATE fxdiv)
diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt
index f7a595e1b..fb315c435 100644
--- a/caffe2/CMakeLists.txt
+++ b/caffe2/CMakeLists.txt
@@ -108,11 +108,18 @@ endif()
# addressed yet.
if(NOT MSVC AND USE_XNNPACK)
- if(NOT TARGET fxdiv)
+ if(NOT TARGET fxdiv AND NOT USE_SYSTEM_FXDIV)
set(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
set(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
add_subdirectory(
"${FXDIV_SOURCE_DIR}"
"${CMAKE_BINARY_DIR}/FXdiv")
+ elseif(NOT TARGET fxdiv AND USE_SYSTEM_FXDIV)
+ find_path(FXDIV_HDR fxdiv.h PATH_SUFFIXES include)
+ if(NOT FXDIV_HDR)
+ message(FATAL_ERROR "Cannot find fxdiv")
+ endif()
+ add_library(fxdiv INTERFACE IMPORTED)
+ target_include_directories(fxdiv INTERFACE "${FXDIV_HDR}")
endif()
endif()