xmake.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. package("osqp")
  2. set_homepage("https://osqp.org/")
  3. set_description("The Operator Splitting QP Solver")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/osqp/osqp/releases/download/$(version)/osqp-$(version)-src.tar.gz",
  6. "https://github.com/osqp/osqp.git")
  7. add_versions("v0.6.3", "285b2a60f68d113a1090767ec8a9c81a65b3af2d258f8c78a31cc3f98ba58456")
  8. add_patches("0.6.3", "patches/0.6.3/cmake.patch", "ffe3809019eebae7559e8c4016431e9d3e9bc35776d9affe65b83904dd753999")
  9. add_deps("cmake")
  10. if is_subhost("windows") then
  11. add_deps("pkgconf")
  12. elseif is_host("linux", "macosx", "bsd") then
  13. add_deps("pkg-config")
  14. end
  15. add_deps("qdldl")
  16. on_install(function (package)
  17. local configs = {"-DCMAKE_POLICY_DEFAULT_CMP0057=NEW"}
  18. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  19. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  20. if package:config("shared") and package:is_plat("windows") then
  21. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  22. end
  23. import("package.tools.cmake").install(package, configs)
  24. end)
  25. on_test(function (package)
  26. assert(package:has_cfuncs("osqp_solve", {includes = "osqp/osqp.h"}))
  27. end)