2
0

xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("yaml-cpp")
  2. set_homepage("https://github.com/jbeder/yaml-cpp/")
  3. set_description("A YAML parser and emitter in C++")
  4. set_license("MIT")
  5. add_urls("https://github.com/jbeder/yaml-cpp/archive/refs/tags/$(version).tar.gz", {version = function (version)
  6. return version:le("0.7.0") and "yaml-cpp-" .. tostring(version) or version
  7. end})
  8. add_urls("https://github.com/jbeder/yaml-cpp.git")
  9. add_versions("0.6.3", "77ea1b90b3718aa0c324207cb29418f5bced2354c2e483a9523d98c3460af1ed")
  10. add_versions("0.7.0", "43e6a9fcb146ad871515f0d0873947e5d497a1c9c60c58cb102a97b47208b7c3")
  11. add_versions("0.8.0", "fbe74bbdcee21d656715688706da3c8becfd946d92cd44705cc6098bb23b3a16")
  12. add_deps("cmake")
  13. on_load("windows", function (package)
  14. if not package:config("shared") then
  15. package:add("defines", "YAML_CPP_STATIC_DEFINE")
  16. end
  17. end)
  18. on_install("windows", "linux", "macosx", "mingw", function (package)
  19. local configs = {"-DYAML_CPP_BUILD_TESTS=OFF"}
  20. table.insert(configs, "-DYAML_BUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  21. if package:is_plat("windows") then
  22. table.insert(configs, "-DYAML_MSVC_SHARED_RT=" .. (package:config("vs_runtime"):startswith("MT") and "OFF" or "ON"))
  23. end
  24. import("package.tools.cmake").install(package, configs, {buildir = os.tmpfile() .. ".dir"})
  25. package:addenv("PATH", "bin")
  26. end)
  27. on_test(function (package)
  28. assert(package:has_cxxtypes("YAML::Parser", {configs = {languages = "c++11"}, includes = "yaml-cpp/yaml.h"}))
  29. end)