xmake.lua 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package("coin-or-coinutils")
  2. set_homepage("https://github.com/coin-or/CoinUtils")
  3. set_description("COIN-OR Utilities")
  4. set_license("EPL-2.0")
  5. add_urls("https://github.com/coin-or/CoinUtils/archive/refs/tags/releases/$(version).tar.gz",
  6. "https://github.com/coin-or/CoinUtils.git")
  7. add_versions("2.11.12", "eef1785d78639b228ae2de26b334129fe6a7d399c4ac6f8fc5bb9054ba00de64")
  8. if is_plat("mingw") and is_subhost("msys") then
  9. add_extsources("pacman::coin-or-coinutils")
  10. elseif is_plat("linux") then
  11. add_extsources("apt::coinor-libcoinutils-dev", "pacman::coin-or-coinutils")
  12. elseif is_plat("macosx") then
  13. add_extsources("brew::coinutils")
  14. end
  15. add_deps("bzip2", "zlib", "glpk")
  16. on_load(function (package)
  17. package:add("defines", "COIN_HAS_ZLIB", "COIN_HAS_BZLIB", "COIN_HAS_GLPK")
  18. if package:is_plat("linux", "macosx", "bsd") then
  19. package:add("deps", "readline")
  20. package:add("defines", "COIN_HAS_READLINE")
  21. end
  22. if package:is_plat("macosx", "iphoneos") then
  23. package:add("frameworks", "Accelerate")
  24. elseif package:is_plat("linux", "bsd") then
  25. package:add("syslinks", "m")
  26. end
  27. if not package:is_debug() then
  28. package:add("defines", "NDEBUG")
  29. end
  30. end)
  31. add_includedirs("include", "include/coin")
  32. on_install(function (package)
  33. io.replace("CoinUtils/src/CoinFinite.cpp", [[#include "CoinUtilsConfig.h"]], [[#include "CoinUtilsConfig.h"
  34. #include <cfloat>]], {plain = true})
  35. io.gsub("CoinUtils/src/config.h.in", "# *undef (.-)\n", "${define %1}\n")
  36. io.gsub("CoinUtils/src/config_coinutils.h.in", "# *undef (.-)\n", "${define %1}\n")
  37. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  38. import("package.tools.xmake").install(package)
  39. end)
  40. on_test(function (package)
  41. assert(package:check_cxxsnippets({test = [[
  42. #include <coin/CoinPackedVector.hpp>
  43. void test() {
  44. const int ne = 4;
  45. const int inx[ne] = { 1, 4, 0, 2 };
  46. const double el[ne] = { 10., 40., 1., 50. };
  47. CoinPackedVector r(ne, inx, el);
  48. r.sortIncrElement();
  49. r.sortOriginalOrder();
  50. }
  51. ]]}, {configs = {languages = "c++11"}}))
  52. end)