xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package("simpleini")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/brofield/simpleini")
  4. set_description("Cross-platform C++ library providing a simple API to read and write INI-style configuration files.")
  5. set_license("MIT")
  6. set_urls("https://github.com/brofield/simpleini/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/brofield/simpleini.git")
  8. add_versions("v4.19", "dc10df3fa363be2c57627d52cbb1b5ddd0689d474bf13908e822c1522df8377e")
  9. add_configs("convert", {description = "Unicode converter to use.", type = "string", values = {"none", "generic", "icu", "win32"}})
  10. on_load(function (package)
  11. if package:config("convert") == nil then
  12. if package:is_plat("windows") then
  13. package:config_set("convert", "win32")
  14. else
  15. package:config_set("convert", "generic")
  16. end
  17. end
  18. if package:config("convert") == "none" then
  19. package:add("defines", "SI_NO_CONVERSION")
  20. elseif package:config("convert") == "generic" then
  21. package:add("defines", "SI_CONVERT_GENERIC")
  22. package:add("deps", "convertutf")
  23. elseif package:config("convert") == "icu" then
  24. package:add("defines", "SI_CONVERT_ICU")
  25. package:add("deps", "icu4c")
  26. elseif package:config("convert") == "win32" then
  27. package:add("defines", "SI_CONVERT_WIN32")
  28. end
  29. end)
  30. on_install(function (package)
  31. os.cp("SimpleIni.h", package:installdir("include"))
  32. end)
  33. on_test(function (package)
  34. assert(package:check_cxxsnippets({test = [[
  35. void test() {
  36. CSimpleIniA ini;
  37. ini.SetUnicode();
  38. }
  39. ]]}, {configs = {languages = "c++11"}, includes = "SimpleIni.h"}))
  40. end)