xmake.lua 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package("libeconf")
  2. set_homepage("https://github.com/openSUSE/libeconf")
  3. set_description("A highly flexible and extensible library for parsing and managing configuration files.")
  4. set_license("MIT")
  5. add_urls("https://github.com/openSUSE/libeconf/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/openSUSE/libeconf.git")
  7. add_versions("v0.8.0", "d50b7135483f13c1a6229a293bd5fdac77b1d827607c72cc61d13be56f58aaa2")
  8. add_versions("v0.7.10", "e8fee300cbbae11287d2682d185d946a1ffbd23bf02b4f97d68f2df34d8de07f")
  9. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  10. if is_plat("wasm") then
  11. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  12. end
  13. add_deps("cmake")
  14. on_install("!windows and !mingw", function (package)
  15. io.replace("CMakeLists.txt", "add_subdirectory(doc)", "", {plain = true})
  16. if not package:config("tools") then
  17. io.replace("CMakeLists.txt", "add_subdirectory(util)", "", {plain = true})
  18. end
  19. if package:is_plat("macosx") then
  20. io.replace("lib/CMakeLists.txt", [[LINK_FLAGS "-Wl,--no-undefined -Wl,--no-undefined-version -Wl,--version-script,\"${PROJECT_SOURCE_DIR}/lib/libeconf.map\""]], "", {plain = true})
  21. end
  22. local configs = {}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  24. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  25. import("package.tools.cmake").install(package, configs)
  26. end)
  27. on_test(function (package)
  28. assert(package:has_cfuncs("econf_readFile", {includes = "libeconf.h"}))
  29. end)