xmake.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.22", "b3a4b8f9e03aabd491aa55fd57457115857b9b9c7ecf4abf7ff035ca9d026eb8")
  9. add_versions("v4.19", "dc10df3fa363be2c57627d52cbb1b5ddd0689d474bf13908e822c1522df8377e")
  10. add_configs("convert", {description = "Unicode converter to use.", type = "string", values = {"none", "generic", "icu", "win32"}})
  11. on_load(function (package)
  12. if package:config("convert") == nil then
  13. if package:is_plat("windows") then
  14. package:config_set("convert", "win32")
  15. else
  16. package:config_set("convert", "generic")
  17. end
  18. end
  19. if package:config("convert") == "none" then
  20. package:add("defines", "SI_NO_CONVERSION")
  21. elseif package:config("convert") == "generic" then
  22. package:add("defines", "SI_CONVERT_GENERIC")
  23. package:add("deps", "convertutf")
  24. elseif package:config("convert") == "icu" then
  25. package:add("defines", "SI_CONVERT_ICU")
  26. package:add("deps", "icu4c")
  27. elseif package:config("convert") == "win32" then
  28. package:add("defines", "SI_CONVERT_WIN32")
  29. end
  30. end)
  31. on_install(function (package)
  32. os.cp("SimpleIni.h", package:installdir("include"))
  33. end)
  34. on_test(function (package)
  35. assert(package:check_cxxsnippets({test = [[
  36. void test() {
  37. CSimpleIniA ini;
  38. ini.SetUnicode();
  39. }
  40. ]]}, {configs = {languages = "c++11"}, includes = "SimpleIni.h"}))
  41. end)