xmake.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package("corrade")
  2. set_homepage("https://magnum.graphics/corrade/")
  3. set_description("Corrade is a multiplatform utility library written in C++11/C++14.")
  4. set_license("MIT")
  5. add_urls("https://github.com/mosra/corrade/archive/refs/tags/$(version).zip",
  6. "https://github.com/mosra/corrade.git")
  7. add_versions("v2020.06", "d89a06128c334920d91fecf23cc1df48fd6be26543dc0ed81b2f819a92d70e72")
  8. add_patches("2020.06", "patches/2020.06/msvc.patch", "af90c9bad846a2cbe834fe270860446f6329636f9b9b7ad23454cf479c1dc05f")
  9. if is_plat("windows") then
  10. add_syslinks("shell32")
  11. elseif is_plat("linux") then
  12. add_syslinks("dl")
  13. end
  14. add_deps("cmake")
  15. on_load("windows", "linux", "macosx", function (package)
  16. if package:is_cross() then
  17. package:add("deps", "corrade", {host = true, private = true})
  18. end
  19. end)
  20. on_install("windows", "linux", "macosx", function (package)
  21. local configs = {"-DBUILD_TESTS=OFF", "-DLIB_SUFFIX="}
  22. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  23. table.insert(configs, "-DCORRADE_BUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
  24. table.insert(configs, "-DBUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
  25. import("package.tools.cmake").install(package, configs)
  26. if package:is_cross() then
  27. os.rm(path.join(package:installdir("bin"), "*"))
  28. else
  29. package:addenv("PATH", "bin")
  30. end
  31. end)
  32. on_test(function (package)
  33. if not package:is_cross() then
  34. os.vrun("corrade-rc --help")
  35. end
  36. assert(package:check_cxxsnippets({test = [[
  37. #include <string>
  38. void test() {
  39. Corrade::Utility::Resource rs{"data"};
  40. rs.get(std::string("license.txt"));
  41. }
  42. ]]}, {configs = {languages = "c++14"}, includes = "Corrade/Utility/Resource.h"}))
  43. end)