|
|
@ -7,9 +7,11 @@ package("libtorch") |
|
|
|
add_urls("https://github.com/pytorch/pytorch.git") |
|
|
|
add_urls("https://github.com/pytorch/pytorch.git") |
|
|
|
add_versions("v1.8.0", "37c1f4a7fef115d719104e871d0cf39434aa9d56") |
|
|
|
add_versions("v1.8.0", "37c1f4a7fef115d719104e871d0cf39434aa9d56") |
|
|
|
add_versions("v1.8.1", "56b43f4fec1f76953f15a627694d4bba34588969") |
|
|
|
add_versions("v1.8.1", "56b43f4fec1f76953f15a627694d4bba34588969") |
|
|
|
|
|
|
|
add_versions("v1.8.2", "e0495a7aa104471d95dc85a1b8f6473fbcc427a8") |
|
|
|
add_versions("v1.9.0", "d69c22dd61a2f006dcfe1e3ea8468a3ecaf931aa") |
|
|
|
add_versions("v1.9.0", "d69c22dd61a2f006dcfe1e3ea8468a3ecaf931aa") |
|
|
|
|
|
|
|
add_versions("v1.9.1", "dfbd030854359207cb3040b864614affeace11ce") |
|
|
|
|
|
|
|
|
|
|
|
add_patches("v1.9.0", path.join(os.scriptdir(), "patches", "1.9.0", "gcc11.patch"), "4191bb3296f18f040c230d7c5364fb160871962d6278e4ae0f8bc481f27d8e4b") |
|
|
|
add_patches("1.9.x", path.join(os.scriptdir(), "patches", "1.9.0", "gcc11.patch"), "4191bb3296f18f040c230d7c5364fb160871962d6278e4ae0f8bc481f27d8e4b") |
|
|
|
|
|
|
|
|
|
|
|
add_configs("python", {description = "Build python interface.", default = false, type = "boolean"}) |
|
|
|
add_configs("python", {description = "Build python interface.", default = false, type = "boolean"}) |
|
|
|
add_configs("ninja", {description = "Use ninja as build tool.", default = true, type = "boolean"}) |
|
|
|
add_configs("ninja", {description = "Use ninja as build tool.", default = true, type = "boolean"}) |
|
|
@ -46,6 +48,13 @@ package("libtorch") |
|
|
|
on_install("windows|x64", "macosx", "linux", function (package) |
|
|
|
on_install("windows|x64", "macosx", "linux", function (package) |
|
|
|
import("package.tools.cmake") |
|
|
|
import("package.tools.cmake") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if package:is_plat("windows") then |
|
|
|
|
|
|
|
local vs = import("core.tool.toolchain").load("msvc"):config("vs") |
|
|
|
|
|
|
|
if tonumber(vs) < 2019 then |
|
|
|
|
|
|
|
raise("Your compiler is too old to use this library.") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- tackle link flags |
|
|
|
-- tackle link flags |
|
|
|
local has_cuda = package:dep("cuda"):exists() and package:dep("nvtx"):exists() |
|
|
|
local has_cuda = package:dep("cuda"):exists() and package:dep("nvtx"):exists() |
|
|
|
local libnames = {"torch", "torch_cpu"} |
|
|
|
local libnames = {"torch", "torch_cpu"} |
|
|
@ -72,10 +81,12 @@ package("libtorch") |
|
|
|
package:add("links", lib) |
|
|
|
package:add("links", lib) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
package:add("links", "fbgemm") |
|
|
|
if not package:config("shared") then |
|
|
|
package:add("links", "asmjit") |
|
|
|
for _, lib in ipairs({"nnpack", "pytorch_qnnpack", "qnnpack", "XNNPACK", "caffe2_protos", "protobuf-lite", "protobuf", "protoc", "onnx", "onnx_proto", "foxi_loader", "pthreadpool", "eigen_blas", "fbgemm", "cpuinfo", "clog", "dnnl", "mkldnn", "sleef", "asmjit", "fmt"}) do |
|
|
|
package:add("links", "cpuinfo") |
|
|
|
package:add("links", lib) |
|
|
|
package:add("links", "clog") |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
package:add("links", "kineto") |
|
|
|
|
|
|
|
|
|
|
|
-- some patches to the third-party cmake files |
|
|
|
-- some patches to the third-party cmake files |
|
|
|
io.replace("third_party/fbgemm/CMakeLists.txt", "PRIVATE FBGEMM_STATIC", "PUBLIC FBGEMM_STATIC", {plain = true}) |
|
|
|
io.replace("third_party/fbgemm/CMakeLists.txt", "PRIVATE FBGEMM_STATIC", "PUBLIC FBGEMM_STATIC", {plain = true}) |
|
|
|