symengine: add package (#2941)
* symengine: add package * disable plat * fix links * fix links * fix links orderpull/2949/head
parent
2e7c8e14b0
commit
28c0e27120
1 changed files with 58 additions and 0 deletions
@ -0,0 +1,58 @@ |
||||
package("symengine") |
||||
set_homepage("https://symengine.org") |
||||
set_description("SymEngine is a fast symbolic manipulation library, written in C++") |
||||
set_license("MIT") |
||||
|
||||
add_urls("https://github.com/symengine/symengine/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/symengine/symengine.git") |
||||
|
||||
add_versions("v0.11.2", "f6972acd6a65354f6414e69460d2e175729470632bdac05919bc2f7f32e48cbd") |
||||
|
||||
add_configs("integer_class", {description = "Integer class for symengine. Either gmp, gmpxx, flint or piranha", default = "boost", type = "string", values = {"boost", "gmp"}}) |
||||
add_configs("teuchos", {description = "Build with teuchos", default = false, type = "boolean"}) |
||||
|
||||
if is_plat("linux") then |
||||
add_syslinks("m") |
||||
end |
||||
|
||||
add_deps("cmake") |
||||
|
||||
on_load(function (package) |
||||
-- Unsupported gmp |
||||
if package:is_plat("windows") then |
||||
package:config_set("integer_class", "boost") |
||||
end |
||||
package:add("deps", package:config("integer_class")) |
||||
end) |
||||
|
||||
on_install("windows", "linux", "macosx", "bsd", "mingw", "cross", function (package) |
||||
local configs = {"-DBUILD_TESTS=OFF", "-DBUILD_BENCHMARKS=OFF"} |
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) |
||||
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
||||
table.insert(configs, "-DWITH_SYMENGINE_TEUCHOS=" .. (package:config("teuchos") and "ON" or "OFF")) |
||||
if package:config("integer_class") == "boost" then |
||||
table.insert(configs, "-DINTEGER_CLASS=boostmp") |
||||
else |
||||
table.insert(configs, "-DINTEGER_CLASS=gmp") |
||||
end |
||||
if package:is_plat("windows") then |
||||
table.insert(configs, "-DMSVC_USE_MT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF")) |
||||
end |
||||
import("package.tools.cmake").install(package, configs) |
||||
|
||||
if os.isfile(package:installdir("lib/libteuchos.a")) then |
||||
package:add("links", "symengine", "teuchos") |
||||
end |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include <symengine/expression.h> |
||||
using SymEngine::Expression; |
||||
void test() { |
||||
Expression x("x"); |
||||
auto ex = pow(x+sqrt(Expression(2)), 6); |
||||
} |
||||
]]}, {configs = {languages = "c++14"}})) |
||||
assert(package:has_cfuncs("basic_new_stack", {includes = "symengine/cwrapper.h"})) |
||||
end) |
Loading…
Reference in new issue