xmake.lua 1.4 KB

1234567891011121314151617181920212223242526272829
  1. package("libfyaml")
  2. set_homepage("https://github.com/pantoniou/libfyaml")
  3. set_description("Fully feature complete YAML parser and emitter, supporting the latest YAML spec and passing the full YAML testsuite.")
  4. set_license("MIT")
  5. add_urls("https://github.com/pantoniou/libfyaml/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/pantoniou/libfyaml.git")
  7. add_versions("v0.9", "927306fc85c7566904751766d36178650766b34e59ce56882eaa5b60f791668c")
  8. add_deps("cmake")
  9. on_install("linux", "macosx", "android", "iphoneos", "cross", function (package)
  10. if package:is_plat("android") then
  11. import("core.tool.toolchain")
  12. local ndk = toolchain.load("ndk", {plat = package:plat(), arch = package:arch()})
  13. local ndk_sdkver = ndk:config("ndk_sdkver")
  14. assert(ndk_sdkver and tonumber(ndk_sdkver) > 21, "package(libfyaml): need ndk api level > 21 for android")
  15. end
  16. local configs = {}
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  19. import("package.tools.cmake").install(package, configs)
  20. end)
  21. on_test(function (package)
  22. assert(package:has_cfuncs("fy_library_version", {includes = "libfyaml.h"}))
  23. end)