Skip to content

Commit

Permalink
[torch-th] fix arm64-osx build (#27412)
Browse files Browse the repository at this point in the history
  • Loading branch information
autoantwort authored Oct 26, 2022
1 parent a1af533 commit fa31050
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
13 changes: 13 additions & 0 deletions ports/torch-th/fix-arm64-osx-config.patch
Original file line number Diff line number Diff line change
@@ -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")
16 changes: 8 additions & 8 deletions ports/torch-th/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
13 changes: 10 additions & 3 deletions ports/torch-th/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7490,7 +7490,7 @@
},
"torch-th": {
"baseline": "2019-04-19",
"port-version": 3
"port-version": 4
},
"tracy": {
"baseline": "0.8.2",
Expand Down
5 changes: 5 additions & 0 deletions versions/t-/torch-th.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e870a035791ae5e1dbb2c86fe94644812852ca2d",
"version-date": "2019-04-19",
"port-version": 4
},
{
"git-tree": "dd64f0dab429a6baf6dbb12119909ebd9caaa43a",
"version-string": "2019-04-19",
Expand Down

0 comments on commit fa31050

Please sign in to comment.