2
0

xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. package("tinyxml")
  2. set_homepage("https://sourceforge.net/projects/tinyxml/")
  3. set_description("TinyXML is a simple, small, minimal, C++ XML parser that can be easily integrating into other programs.")
  4. set_license("zlib")
  5. add_urls("https://sourceforge.net/projects/tinyxml/files/tinyxml/$(version).zip", {version = function (version) return version .. "/tinyxml_" .. version:gsub("%.", "_") end})
  6. add_versions("2.6.2", "ac6bb9501c6f50cc922d22f26b02fab168db47521be5e845b83d3451a3e1d512")
  7. if is_plat("windows") then
  8. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  9. end
  10. add_configs("stl", {description = "Enable STL support.", default = true, type = "boolean"})
  11. on_install(function (package)
  12. if package:config("stl") then
  13. io.replace("tinyxml.h", "#define TINYXML_INCLUDED", "#define TINYXML_INCLUDED\n#define TIXML_USE_STL", {plain = true})
  14. end
  15. io.writefile("xmake.lua", [[
  16. add_rules("mode.debug", "mode.release")
  17. target("tinyxml")
  18. set_kind("$(kind)")
  19. add_files("tinyxml.cpp", "tinystr.cpp", "tinyxmlerror.cpp", "tinyxmlparser.cpp")
  20. add_headerfiles("tinyxml.h", "tinystr.h")
  21. ]])
  22. import("package.tools.xmake").install(package)
  23. end)
  24. on_test(function (package)
  25. assert(package:has_cxxtypes("TiXmlDocument", {includes = "tinyxml.h"}))
  26. end)