xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("dune-common")
  2. set_homepage("https://dune-project.org/")
  3. set_description("DUNE, the Distributed and Unified Numerics Environment is a modular toolbox for solving partial differential equations with grid-based methods.")
  4. set_license("GPL-2.0")
  5. add_urls("https://dune-project.org/download/$(version)/dune-common-$(version).tar.gz")
  6. add_versions("2.8.0", "c9110b3fa350547c5e962c961905c6c67680471199ca41ed680489a0f30ffce9")
  7. add_configs("python", {description = "Enable the python interface.", default = false, type = "boolean"})
  8. add_deps("cmake")
  9. add_links("dunecommon")
  10. on_load("macosx", "linux", function (package)
  11. if package:config("python") then
  12. package:add("deps", "python 3.x")
  13. end
  14. end)
  15. on_install("macosx", "linux", function (package)
  16. local configs = {"-DBUILD_TESTING=OFF"}
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  19. table.insert(configs, "-DDUNE_ENABLE_PYTHONBINDINGS=" .. (package:config("python") and "ON" or "OFF"))
  20. import("package.tools.cmake").install(package, configs)
  21. end)
  22. on_test(function (package)
  23. assert(package:check_cxxsnippets({test = [[
  24. #include <dune/common/std/make_array.hh>
  25. void test() {
  26. auto array = Dune::Std::make_array(1, 2);
  27. }
  28. ]]}, {configs = {languages = "c++14"}}))
  29. end)