Browse Source

improve cjson

ruki 6 years ago
parent
commit
4e7a9bd9d7
1 changed files with 16 additions and 3 deletions
  1. 16 3
      packages/c/cjson/xmake.lua

+ 16 - 3
packages/c/cjson/xmake.lua

@@ -1,10 +1,23 @@
 package("cjson")
 package("cjson")
+
     set_homepage("https://github.com/DaveGamble/cJSON")
     set_homepage("https://github.com/DaveGamble/cJSON")
     set_description("Ultralightweight JSON parser in ANSI C.")
     set_description("Ultralightweight JSON parser in ANSI C.")
 
 
     set_urls("https://github.com/DaveGamble/cJSON/archive/v$(version).zip")
     set_urls("https://github.com/DaveGamble/cJSON/archive/v$(version).zip")
     add_versions("1.7.10", "80a0584410656c8d8da2ba703744f44d7535fc4f0778d8bf4f980ce77c6a9f65")
     add_versions("1.7.10", "80a0584410656c8d8da2ba703744f44d7535fc4f0778d8bf4f980ce77c6a9f65")
-    on_install("macosx", "linux", function(package)
-        os.vrun("make")
-        os.vrun("make PREFIX=\"%s\" install", package:installdir())
+
+    if is_host("windows") then
+        add_deps("cmake")
+    end
+
+    if is_plat("windows") and winos.version():gt("winxp") then
+        on_install("windows", function (package)
+            import("package.tools.cmake").install(package)
+        end)
+    end
+
+    on_install("macosx", "linux", function (package)
+        os.vrun("make static")
+        os.cp("*.a", package:installdir("lib"))
+        os.cp("*.h", package:installdir("include"))
     end)
     end)