-
-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* symengine: add package * disable plat * fix links * fix links * fix links order
- Loading branch information
1 parent
2e7c8e1
commit 28c0e27
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |