Skip to content

Commit

Permalink
update cgal (#5542)
Browse files Browse the repository at this point in the history
* update cgal

* fix eigen
  • Loading branch information
xq114 authored Oct 20, 2024
1 parent dee3a3a commit 73a4e9b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
7 changes: 7 additions & 0 deletions packages/b/boost/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,14 @@ package("boost")
end

-- we need the fixed link order
local headeronly = not package:config("all")
local sublibs = {log = {"log_setup", "log"},
python = {"python", "numpy"},
stacktrace = {"stacktrace_backtrace", "stacktrace_basic"}}
for _, libname in ipairs(libnames) do
if package:config(libname) then
headeronly = false
end
local libs = sublibs[libname]
if libs then
for _, lib in ipairs(libs) do
Expand All @@ -137,6 +141,9 @@ package("boost")
package:add("links", get_linkname(package, libname))
end
end
if headeronly then
package:set("kind", "library", {headeronly = true})
end
-- disable auto-link all libs
if package:is_plat("windows") then
package:add("defines", "BOOST_ALL_NO_LIB")
Expand Down
26 changes: 18 additions & 8 deletions packages/c/cgal/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package("cgal")
set_license("LGPL-3.0")

add_urls("https://github.com/CGAL/cgal/releases/download/v$(version)/CGAL-$(version)-library.zip")
add_versions("6.0", "f4a66cf4e276a377d263ee3db627919d1000e29bf24664a5d0b8cb82081ef706")
add_versions("5.6.1", "cf3900280d96847db8ac5e174d5e889f9764c7fa4e3d99f316f89910058335e6")
add_versions("5.1.1", "ceca7ea896505941878f6c1fb7a7ae86653fdd9b3d87b276da72227f173a9cd2")
add_versions("5.2.1", "ccdea67db79153417504f50c534cea3bb6b0e9754e7f32fb753fc19005114db0")
Expand All @@ -13,6 +14,7 @@ package("cgal")
add_versions("5.5.2", "77b17ba5d43fe844c0eca7fb7eff7d5687174b037290c390f1251ef44cc4909b")

add_configs("header_only", {description = "Use header only version.", default = true, type = "boolean"})
add_configs("gmp", {description = "Use gmp/mpfr.", default = is_plat("macosx", "linux"), type = "boolean"})

if is_plat("mingw") and is_subhost("msys") then
add_extsources("pacman::cgal")
Expand All @@ -24,14 +26,21 @@ package("cgal")

add_deps("cmake")
add_deps("boost", "eigen")
if is_plat("macosx", "linux") then
add_deps("gmp", "mpfr")
end
on_check("windows", "mingw", function (package)
if not package:config("header_only") and (package:version():lt("6.0") or package:config("gmp")) then
raise("GMP is not supported on windows yet!")
end
end)

on_load("windows", "mingw", function (package)
package:add("defines", "CGAL_NO_GMP")
if not package:config("header_only") then
raise("Non-header-only version is not supported yet!")
on_load("windows", "mingw", "macosx", "linux", function (package)
if package:config("header_only") then
package:set("kind", "library", {headeronly = true})
end
if package:config("gmp") then
package:add("deps", "gmp", "mpfr")
else
package:add("defines", "CGAL_DISABLE_GMP")
package:add("defines", "CGAL_NO_GMP")
end
end)

Expand All @@ -41,6 +50,7 @@ package("cgal")
end
local configs = {"-DBUILD_TESTING=OFF", "-DBUILD_DOC=OFF"}
table.insert(configs, "-DCGAL_HEADER_ONLY=" .. (package:config("header_only") and "ON" or "OFF"))
table.insert(configs, "-DCGAL_DISABLE_GMP=" .. (package:config("gmp") and "OFF" or "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"))
import("package.tools.cmake").install(package, configs)
Expand All @@ -55,5 +65,5 @@ package("cgal")
DT::Point p;
std::vector<DT::Point> points;
}
]]}, {configs = {languages = "c++14"}, includes = {"CGAL/Epick_d.h", "CGAL/Delaunay_triangulation.h"}}))
]]}, {configs = {languages = "c++17"}, includes = {"CGAL/Epick_d.h", "CGAL/Delaunay_triangulation.h"}}))
end)
1 change: 1 addition & 0 deletions packages/e/eigen/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package("eigen")
add_includedirs("include/eigen3")

on_install(function (package)
io.replace("CMakeLists.txt", "add_subdirectory", "#", {plain = true})
import("package.tools.cmake").install(package, {"-DBUILD_TESTING=OFF"})
end)

Expand Down

0 comments on commit 73a4e9b

Please sign in to comment.