diff --git a/README.md b/README.md index 7cac7ece4..f5d69d365 100755 --- a/README.md +++ b/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! ```