From dd2f4ec5ffb432af239aa50b0ab9957054b1106a Mon Sep 17 00:00:00 2001 From: Leander Schulten Date: Sun, 23 Oct 2022 14:31:10 +0200 Subject: [PATCH] [torch-th] fix arm64-osx build --- ports/torch-th/fix-arm64-osx-config.patch | 13 +++++++++++++ ports/torch-th/portfile.cmake | 16 ++++++++-------- ports/torch-th/vcpkg.json | 13 ++++++++++--- versions/baseline.json | 2 +- versions/t-/torch-th.json | 5 +++++ 5 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 ports/torch-th/fix-arm64-osx-config.patch diff --git a/ports/torch-th/fix-arm64-osx-config.patch b/ports/torch-th/fix-arm64-osx-config.patch new file mode 100644 index 00000000000000..de6b0017269ea7 --- /dev/null +++ b/ports/torch-th/fix-arm64-osx-config.patch @@ -0,0 +1,13 @@ +diff --git a/lib/TH/cmake/FindARM.cmake b/lib/TH/cmake/FindARM.cmake +index 2dcb2a2..9d68601 100644 +--- a/lib/TH/cmake/FindARM.cmake ++++ b/lib/TH/cmake/FindARM.cmake +@@ -45,7 +45,7 @@ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") + CPUINFO) + + #neon instruction can be found on the majority part of modern ARM processor +- STRING(REGEX REPLACE "^.*(neon).*$" "\\1" NEON_THERE ${CPUINFO}) ++ STRING(REGEX REPLACE "^.*(neon).*$" "\\1" NEON_THERE "${CPUINFO}") + STRING(COMPARE EQUAL "neon" "${NEON_THERE}" NEON_TRUE) + IF (NEON_TRUE) + set(NEON_FOUND true CACHE BOOL "NEON available on host") diff --git a/ports/torch-th/portfile.cmake b/ports/torch-th/portfile.cmake index 7fd23944b5eb90..5850724e8fcf2f 100644 --- a/ports/torch-th/portfile.cmake +++ b/ports/torch-th/portfile.cmake @@ -8,19 +8,19 @@ vcpkg_from_github( HEAD_REF master PATCHES debug.patch + fix-arm64-osx-config.patch ) -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH}/lib/TH - PREFER_NINJA +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/lib/TH" OPTIONS -DWITH_OPENMP=OFF ) -vcpkg_install_cmake() +vcpkg_cmake_install() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/cmake) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/cmake") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") -file(INSTALL ${SOURCE_PATH}/COPYRIGHT.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/torch-th RENAME copyright) +file(INSTALL "${SOURCE_PATH}/COPYRIGHT.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/torch-th" RENAME copyright) diff --git a/ports/torch-th/vcpkg.json b/ports/torch-th/vcpkg.json index 81f500f820fe71..a2da610f09bc3e 100644 --- a/ports/torch-th/vcpkg.json +++ b/ports/torch-th/vcpkg.json @@ -1,7 +1,14 @@ { "name": "torch-th", - "version-string": "2019-04-19", - "port-version": 3, + "version-date": "2019-04-19", + "port-version": 4, "description": "Torch's TH library", - "homepage": "https://github.com/torch/torch7" + "homepage": "https://github.com/torch/torch7", + "license": "BSD-3-Clause", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] } diff --git a/versions/baseline.json b/versions/baseline.json index 32b4280b1759e8..24d33b53cb3227 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -7490,7 +7490,7 @@ }, "torch-th": { "baseline": "2019-04-19", - "port-version": 3 + "port-version": 4 }, "tracy": { "baseline": "0.8.2", diff --git a/versions/t-/torch-th.json b/versions/t-/torch-th.json index 6860040471c6df..e4f280774ffd63 100644 --- a/versions/t-/torch-th.json +++ b/versions/t-/torch-th.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e870a035791ae5e1dbb2c86fe94644812852ca2d", + "version-date": "2019-04-19", + "port-version": 4 + }, { "git-tree": "dd64f0dab429a6baf6dbb12119909ebd9caaa43a", "version-string": "2019-04-19",