xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package("tmxparser")
  2. set_homepage("https://github.com/sainteos/tmxparser")
  3. set_description("C++11 library for parsing the maps generated by Tiled Map Editor")
  4. set_urls("https://github.com/sainteos/tmxparser.git")
  5. add_versions("2.2.0", "d314b3115c7ed86a939eefcb6009a495f043a346")
  6. add_deps("zlib", "tinyxml2")
  7. on_install("windows", "macosx", "linux", "mingw", function (package)
  8. io.gsub("include/Tmx.h.in", "@VERSION_PATCH@", "@VERSION_ALTER@")
  9. io.writefile("xmake.lua", ([[
  10. set_version("%s")
  11. add_requires("zlib", "tinyxml2")
  12. add_rules("mode.debug", "mode.release")
  13. target("tmxparser")
  14. set_kind("$(kind)")
  15. set_languages("cxx11")
  16. add_packages("zlib", "tinyxml2")
  17. add_headerfiles("include/*.h")
  18. add_includedirs("include", "include/base64")
  19. set_configdir("include")
  20. add_configfiles("include/Tmx.h.in", {pattern = "@(.-)@"})
  21. add_files("src/**.cpp")
  22. if is_plat("windows") and is_kind("shared") then
  23. add_rules("utils.symbols.export_all", {export_classes = true})
  24. end
  25. ]]):format(package:version_str()))
  26. local configs = {}
  27. configs.kind = (package:config("shared") and "shared" or "static")
  28. if package:is_plat("linux", "mingw") and package:config("pic") ~= false then
  29. configs.cxflags = "-fPIC"
  30. end
  31. import("package.tools.xmake").install(package, configs)
  32. end)
  33. on_test(function (package)
  34. assert(package:check_cxxsnippets({test = [[
  35. void test(int argc, char** argv) {
  36. Tmx::Map map;
  37. map.ParseFile("test.xml");
  38. }
  39. ]]}, {configs = {languages = "c++11"}, includes = "Tmx.h"}))
  40. end)