Răsfoiți Sursa

Add Tmx.h.in as config file

PucklaMotzer09 4 ani în urmă
părinte
comite
243dbb02f7
1 a modificat fișierele cu 6 adăugiri și 6 ștergeri
  1. 6 6
      packages/t/tmxparser/xmake.lua

+ 6 - 6
packages/t/tmxparser/xmake.lua

@@ -9,11 +9,9 @@ package("tmxparser")
     add_deps("zlib", "tinyxml2")
 
     on_install(function (package)
-        io.gsub("include/Tmx.h.in", "@VERSION_MAJOR@", "2")
-        io.gsub("include/Tmx.h.in", "@VERSION_MINOR@", "2")
-        io.gsub("include/Tmx.h.in", "@VERSION_PATCH@", "0")
-        os.mv("include/Tmx.h.in", "include/Tmx.h")
-        io.writefile("xmake.lua", [[
+        io.gsub("include/Tmx.h.in", "@VERSION_PATCH@", "@VERSION_ALTER@")
+        io.writefile("xmake.lua", ([[
+            set_version("%s")
             add_requires("zlib", "tinyxml2")
             add_rules("mode.debug", "mode.release")
             target("tmxparser")
@@ -22,8 +20,10 @@ package("tmxparser")
                 add_packages("zlib", "tinyxml2")
                 add_headerfiles("include/*.h")
                 add_includedirs("include", "include/base64")
+                set_configdir("include")
+                add_configfiles("include/Tmx.h.in", {pattern = "@(.-)@"})
                 add_files("src/**.cpp")
-        ]])
+        ]]):format(package:version_str()))
         import("package.tools.xmake").install(package, {kind = package:config("shared") and "shared" or "static"})
     end)