xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("cminpack")
  2. set_homepage("https://devernay.github.io/cminpack/")
  3. set_description("A C/C++ rewrite of the MINPACK software (originally in FORTRAN) for solving nonlinear equations and nonlinear least squares problems")
  4. add_urls("https://github.com/devernay/cminpack/archive/$(version).tar.gz",
  5. "https://github.com/devernay/cminpack.git")
  6. add_versions("v1.3.9", "aa37bac5b5caaa4f5805ea5c4240e3834c993672f6dab0b17190ee645e251c9f")
  7. add_configs("blas", {description = "Compile cminpack using cblas library if possible", default = false, type = "boolean"})
  8. if is_plat("linux") then
  9. add_syslinks("m")
  10. end
  11. add_includedirs("include/cminpack-1")
  12. add_deps("cmake")
  13. on_load(function (package)
  14. if package:config("blas") then
  15. package:add("deps", "openblas")
  16. end
  17. end)
  18. on_install("windows", "linux", "macosx", "mingw", "msys", "android", "iphoneos", "wasm", function (package)
  19. if package:is_plat("windows", "mingw") and (not package:config("shared")) then
  20. package:add("defines", "CMINPACK_NO_DLL")
  21. end
  22. local configs = {"-DBUILD_EXAMPLES=OFF", "-DENABLE_TESTING=OFF"}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  24. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  25. table.insert(configs, "-DUSE_BLAS=" .. (package:config("blas") and "ON" or "OFF"))
  26. import("package.tools.cmake").install(package, configs)
  27. end)
  28. on_test(function (package)
  29. assert(package:has_cfuncs("lmdif", {includes = "minpack.h"}))
  30. end)