Pārlūkot izejas kodu

Update README.md

ruki 3 gadi atpakaļ
vecāks
revīzija
97f9b40934
1 mainītis faili ar 16 papildinājumiem un 12 dzēšanām
  1. 16 12
      README.md

+ 16 - 12
README.md

@@ -105,20 +105,24 @@ Create a package configuration file to this warehouse based on the package addre
 ```console
 $ xmake l scripts/new.lua github:glennrp/libpng
 package("libpng")
-     set_homepage("http://libpng.sf.net")
-     set_description("LIBPNG: Portable Network Graphics support, official libpng repository")
+    set_homepage("http://libpng.sf.net")
+    set_description("LIBPNG: Portable Network Graphics support, official libpng repository")
 
-     add_urls("https://github.com/glennrp/libpng/archive/refs/tags/v1.6.35.tar.gz",
-              "https://github.com/glennrp/libpng.git")
-     add_versions("v1.6.35", "6d59d6a154ccbb772ec11772cb8f8beb0d382b61e7ccc62435bf7311c9f4b210")
+    add_urls("https://github.com/glennrp/libpng/archive/refs/tags/v1.6.35.tar.gz",
+             "https://github.com/glennrp/libpng.git")
+    add_versions("v1.6.35", "6d59d6a154ccbb772ec11772cb8f8beb0d382b61e7ccc62435bf7311c9f4b210")
 
-     on_install(function (package)
-         local configs = {}
-         import("package.tools.xmake").install(package, configs)
-     end)
+    add_deps("cmake")
 
-     on_test(function (package)
-         assert(package:has_cfuncs("foo", {includes = "foo.h"}))
-     end)
+    on_install(function (package)
+        local configs = {}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("foo", {includes = "foo.h"}))
+    end)
 packages/l/libpng/xmake.lua generated!
 ```