xmake.lua 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package("symengine")
  2. set_homepage("https://symengine.org")
  3. set_description("SymEngine is a fast symbolic manipulation library, written in C++")
  4. set_license("MIT")
  5. add_urls("https://github.com/symengine/symengine/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/symengine/symengine.git")
  7. add_versions("v0.13.0", "f46bcf037529cd1a422369327bf360ad4c7d2b02d0f607a62a5b09c74a55bb59")
  8. add_versions("v0.12.0", "1b5c3b0bc6a9f187635f93585649f24a18e9c7f2167cebcd885edeaaf211d956")
  9. add_versions("v0.11.2", "f6972acd6a65354f6414e69460d2e175729470632bdac05919bc2f7f32e48cbd")
  10. add_configs("integer_class", {description = "Integer class for symengine. Either gmp, gmpxx, flint or piranha", default = "boost", type = "string", values = {"boost", "gmp"}})
  11. add_configs("teuchos", {description = "Build with teuchos", default = false, type = "boolean"})
  12. if is_plat("linux") then
  13. add_syslinks("m")
  14. end
  15. add_deps("cmake")
  16. on_load(function (package)
  17. -- Unsupported gmp
  18. if package:is_plat("windows") then
  19. package:config_set("integer_class", "boost")
  20. end
  21. package:add("deps", package:config("integer_class"))
  22. end)
  23. on_install("windows", "linux", "macosx", "bsd", "mingw", "cross", function (package)
  24. local configs = {"-DBUILD_TESTS=OFF", "-DBUILD_BENCHMARKS=OFF"}
  25. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  26. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  27. table.insert(configs, "-DWITH_SYMENGINE_TEUCHOS=" .. (package:config("teuchos") and "ON" or "OFF"))
  28. if package:config("integer_class") == "boost" then
  29. table.insert(configs, "-DINTEGER_CLASS=boostmp")
  30. else
  31. table.insert(configs, "-DINTEGER_CLASS=gmp")
  32. end
  33. if package:is_plat("windows") then
  34. table.insert(configs, "-DMSVC_USE_MT=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  35. end
  36. import("package.tools.cmake").install(package, configs)
  37. if os.isfile(package:installdir("lib/libteuchos.a")) then
  38. package:add("links", "symengine", "teuchos")
  39. end
  40. end)
  41. on_test(function (package)
  42. assert(package:check_cxxsnippets({test = [[
  43. #include <symengine/expression.h>
  44. using SymEngine::Expression;
  45. void test() {
  46. Expression x("x");
  47. auto ex = pow(x+sqrt(Expression(2)), 6);
  48. }
  49. ]]}, {configs = {languages = "c++14"}}))
  50. assert(package:has_cfuncs("basic_new_stack", {includes = "symengine/cwrapper.h"}))
  51. end)