Browse Source

add cgal, libigl and fix some packages (#195)

* update python

* remove duplicate versions

* update eigen

* add cgal and libigl

* remove trailing spaces

* improve format
Hoildkv 4 years ago
parent
commit
a30a394a80

+ 47 - 0
packages/c/cgal/xmake.lua

@@ -0,0 +1,47 @@
+package("cgal")
+
+    set_homepage("https://www.cgal.org/")
+    set_description("CGAL is a software project that provides easy access to efficient and reliable geometric algorithms in the form of a C++ library.")
+    set_license("LGPL-3.0")
+
+    add_urls("https://github.com/CGAL/cgal/releases/download/v$(version)/CGAL-$(version)-library.zip")
+    add_versions("5.1.1", "ceca7ea896505941878f6c1fb7a7ae86653fdd9b3d87b276da72227f173a9cd2")
+
+    add_configs("header_only", {description = "Use header only version.", default = true, type = "boolean"})
+
+    add_deps("cmake")
+    add_deps("boost")
+    if is_plat("macosx", "linux") then
+        add_deps("gmp", "mpfr")
+    end
+
+    on_load("windows", function (package)
+        if not package:config("header_only") then
+            raise("Non-header-only version is not supported yet!")
+        end
+    end)
+
+    on_install("windows", "macosx", "linux", function (package)
+        if package:config("header_only") then
+            os.mv("include", package:installdir())
+            os.mv("lib", package:installdir())
+            return
+        end
+        local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_DOC=OFF"}
+        table.insert(configs, "-DCGAL_HEADER_ONLY=OFF")
+        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"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        package:check_cxxsnippets({test = [[
+            #include <vector>
+            void test() {
+                using K = CGAL::Epick_d<CGAL::Dynamic_dimension_tag>;
+                using DT = CGAL::Delaunay_triangulation<K>;
+                DT::Point p;
+                std::vector<DT::Point> points;
+            }
+        ]]}, {config = {languages = "c++14"}, includes = {"CGAL/Epick_d.h", "CGAL/Delaunay_triangulation.h"}})
+    end)

+ 2 - 1
packages/e/eigen/xmake.lua

@@ -5,8 +5,9 @@ package("eigen")
 
     add_urls("https://gitlab.com/libeigen/eigen/-/archive/$(version)/eigen-$(version).tar.bz2",
              "https://gitlab.com/libeigen/eigen")
-    add_versions("3.3.8", "0215c6593c4ee9f1f7f28238c4e8995584ebf3b556e9dbf933d84feb98d5b9ef")
     add_versions("3.3.7", "685adf14bd8e9c015b78097c1dc22f2f01343756f196acdc76a678e1ae352e11")
+    add_versions("3.3.8", "0215c6593c4ee9f1f7f28238c4e8995584ebf3b556e9dbf933d84feb98d5b9ef")
+    add_versions("3.3.9", "0fa5cafe78f66d2b501b43016858070d52ba47bd9b1016b0165a7b8e04675677")
 
     add_deps("cmake")
     add_includedirs("include")

+ 55 - 0
packages/l/libigl/xmake.lua

@@ -0,0 +1,55 @@
+package("libigl")
+
+    set_homepage("https://libigl.github.io/")
+    set_description("Simple C++ geometry processing library.")
+
+    add_urls("https://github.com/libigl/libigl/archive/v$(version).tar.gz",
+             "https://github.com/libigl/libigl.git")
+    add_versions("2.2.0", "b336e548d718536956e2d6958a0624bc76d50be99039454072ecdc5cf1b2ede5")
+
+    add_configs("header_only", {description = "Use header only version.", default = true, type = "boolean"})
+    add_configs("use_cgal", {description = "Use CGAL library.", default = false, type = "boolean"})
+
+    add_deps("cmake", "eigen")
+    on_load("macosx", "linux", "windows", function (package)
+        if not package:config("header_only") then
+            raise("Non-header-only version is not supported yet!")
+        end
+        if package:config("use_cgal") then
+            package:add("deps", "cgal")
+        end
+    end)
+
+    on_install("macosx", "linux", "windows", function (package)
+        if package:config("header_only") then
+            os.mv("include", package:installdir())
+            return
+        end
+        local configs = {"-DLIBIGL_BUILD_TESTS=OFF", "-DLIBIGL_BUILD_TUTORIALS=OFF", "-DLIBIGL_SKIP_DOWNLOAD=ON"}
+        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"))
+        if not package:config("shared") then
+            table.insert(configs, "-DLIBIGL_USE_STATIC_LIBRARY=ON")
+        end
+        if package:is_plat("windows") then
+            table.insert(configs, "-DIGL_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+        end
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                Eigen::MatrixXd V(4,2);
+                V<<0,0,
+                   1,0,
+                   1,1,
+                   0,1;
+                Eigen::MatrixXi F(2,3);
+                F<<0,1,2,
+                   0,2,3;
+                Eigen::SparseMatrix<double> L;
+                igl::cotmatrix(V,F,L);
+            }
+        ]]}, {configs = {languages = "c++14"}, includes = {"igl/cotmatrix.h", "Eigen/Dense", "Eigen/Sparse"}}))
+    end)

+ 7 - 0
packages/p/python/xmake.lua

@@ -57,6 +57,13 @@ package("python")
 
     on_load("@macosx", "@linux", function (package)
 
+        -- check system libs
+        if is_host("linux") then
+            for link, lib in pairs({z = "zlib", ffi = "libffi"}) do
+                assert(find_package("system::" .. link, {plat = os.host(), arch = os.arch()}), ("%s-dev not found, please use your system package manager to install it."):format(lib))
+            end
+        end
+
         -- set includedirs
         local version = package:version()
         local pyver = ("python%d.%d"):format(version:major(), version:minor())

+ 0 - 1
packages/v/vulkan-headers/xmake.lua

@@ -6,7 +6,6 @@ package("vulkan-headers")
 
     add_urls("https://github.com/KhronosGroup/Vulkan-Headers/archive/$(version).tar.gz", {version = function (version) return version:startswith("v") and version or "sdk-" .. version:gsub("%+", ".") end})
     add_versions("v1.2.162", "deab1a7a28ad3e0a7a0a1c4cd9c54758dce115a5f231b7205432d2bbbfb4d456")
-    add_versions("v1.2.154", "b636f0ace2c2b8a7dbdfddf16c53c1f49a4b39d6da562727bfea00b5ec447537")
     add_versions("1.2.154+0", "a0528ade4dd3bd826b960ba4ccabc62e92ecedc3c70331b291e0a7671b3520f9")
 
     add_deps("cmake")