Browse Source

update pybind11 (#1169)

* fix libtorch

* update pybind11
Hoildkv 3 years ago
parent
commit
c00ebfdb3a
2 changed files with 8 additions and 1 deletions
  1. 7 0
      packages/l/libtorch/xmake.lua
  2. 1 1
      packages/p/pybind11/xmake.lua

+ 7 - 0
packages/l/libtorch/xmake.lua

@@ -15,7 +15,9 @@ package("libtorch")
     add_patches("1.9.x", 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_patches("1.11.0", path.join(os.scriptdir(), "patches", "1.11.0", "gcc11.patch"), "1404b0bc6ce7433ecdc59d3412e3d9ed507bb5fd2cd59134a254d7d4a8d73012")
     add_patches("1.11.0", path.join(os.scriptdir(), "patches", "1.11.0", "gcc11.patch"), "1404b0bc6ce7433ecdc59d3412e3d9ed507bb5fd2cd59134a254d7d4a8d73012")
 
 
+    add_configs("shared", {description = "Build shared library.", default = true, type = "boolean"})
     add_configs("python", {description = "Build python interface.", default = false, type = "boolean"})
     add_configs("python", {description = "Build python interface.", default = false, type = "boolean"})
+    add_configs("openmp", {description = "Use OpenMP for parallel code.", default = true, type = "boolean"})
     add_configs("cuda",   {description = "Enable CUDA support.", default = false, type = "boolean"})
     add_configs("cuda",   {description = "Enable CUDA support.", default = false, type = "boolean"})
     add_configs("ninja",  {description = "Use ninja as build tool.", default = false, type = "boolean"})
     add_configs("ninja",  {description = "Use ninja as build tool.", default = false, type = "boolean"})
     add_configs("blas",   {description = "Set BLAS vendor.", default = "openblas", type = "string", values = {"mkl", "openblas", "eigen"}})
     add_configs("blas",   {description = "Set BLAS vendor.", default = "openblas", type = "string", values = {"mkl", "openblas", "eigen"}})
@@ -41,6 +43,9 @@ package("libtorch")
         if package:config("ninja") then
         if package:config("ninja") then
             package:add("deps", "ninja")
             package:add("deps", "ninja")
         end
         end
+        if package:config("openmp") then
+            package:add("deps", "openmp")
+        end
         if package:config("cuda") then
         if package:config("cuda") then
             package:add("deps", "cuda", {configs = {utils = {"nvrtc", "cudnn", "cufft", "curand", "cublas", "cudart_static"}}})
             package:add("deps", "cuda", {configs = {utils = {"nvrtc", "cudnn", "cufft", "curand", "cublas", "cudart_static"}}})
             package:add("deps", "nvtx")
             package:add("deps", "nvtx")
@@ -105,6 +110,7 @@ package("libtorch")
         os.vrun("python -m pip install typing_extensions pyyaml")
         os.vrun("python -m pip install typing_extensions pyyaml")
         local configs = {"-DUSE_MPI=OFF",
         local configs = {"-DUSE_MPI=OFF",
                          "-DCMAKE_INSTALL_LIBDIR=lib",
                          "-DCMAKE_INSTALL_LIBDIR=lib",
+                         "-DBUILD_TEST=OFF",
                          "-DATEN_NO_TEST=ON"}
                          "-DATEN_NO_TEST=ON"}
         if package:config("python") then
         if package:config("python") then
             table.insert(configs, "-DBUILD_PYTHON=ON")
             table.insert(configs, "-DBUILD_PYTHON=ON")
@@ -134,6 +140,7 @@ package("libtorch")
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DUSE_CUDA=" .. (package:config("cuda") and "ON" or "OFF"))
         table.insert(configs, "-DUSE_CUDA=" .. (package:config("cuda") and "ON" or "OFF"))
+        table.insert(configs, "-DUSE_OPENMP=" .. (package:config("openmp") and "ON" or "OFF"))
         table.insert(configs, "-DUSE_DISTRIBUTED=" .. (package:config("distributed") and "ON" or "OFF"))
         table.insert(configs, "-DUSE_DISTRIBUTED=" .. (package:config("distributed") and "ON" or "OFF"))
         if package:is_plat("windows") then
         if package:is_plat("windows") then
             table.insert(configs, "-DCAFFE2_USE_MSVC_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
             table.insert(configs, "-DCAFFE2_USE_MSVC_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))

+ 1 - 1
packages/p/pybind11/xmake.lua

@@ -12,9 +12,9 @@ package("pybind11")
     add_versions("v2.7.1", "350ebf8f4c025687503a80350897c95d8271bf536d98261f0b8ed2c1a697070f")
     add_versions("v2.7.1", "350ebf8f4c025687503a80350897c95d8271bf536d98261f0b8ed2c1a697070f")
     add_versions("v2.8.1", "90907e50b76c8e04f1b99e751958d18e72c4cffa750474b5395a93042035e4a3")
     add_versions("v2.8.1", "90907e50b76c8e04f1b99e751958d18e72c4cffa750474b5395a93042035e4a3")
     add_versions("v2.9.1", "ef9e63be55b3b29b4447ead511a7a898fdf36847f21cec27a13df0db051ed96b")
     add_versions("v2.9.1", "ef9e63be55b3b29b4447ead511a7a898fdf36847f21cec27a13df0db051ed96b")
+    add_versions("v2.9.2", "d1646e6f70d8a3acb2ddd85ce1ed543b5dd579c68b8fb8e9638282af20edead8")
 
 
     add_deps("cmake", "python 3.x")
     add_deps("cmake", "python 3.x")
-
     on_install("windows", "macosx", "linux", function (package)
     on_install("windows", "macosx", "linux", function (package)
         import("package.tools.cmake").install(package, {"-DPYBIND11_TEST=OFF"})
         import("package.tools.cmake").install(package, {"-DPYBIND11_TEST=OFF"})
     end)
     end)