-
文档上不是说到可以不用搭建包仓库直接定义package吗 add_rules("mode.debug", "mode.release")
if is_os("windows") then
if(is_mode("release")) then
set_config("vs_runtime", "MD")
else
set_config("vs_runtime", "MDd")
end
else
add_cxflags("-MD")
end
package("zlib")
set_homepage("http://www.zlib.net")
set_description("A Massively Spiffy Yet Delicately Unobtrusive Compression Library")
add_urls("https://github.com/madler/zlib/archive/$(version).tar.gz",
"https://github.com/madler/zlib.git")
add_versions("v1.2.10", "42cd7b2bdaf1c4570e0877e61f2fdc0bce8019492431d054d3d86925e5058dc5")
add_versions("v1.2.11", "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff")
add_versions("v1.2.12", "d8688496ea40fb61787500e863cc63c9afcbc524468cedeb478068924eb54932")
if is_plat("mingw") and is_subhost("msys") then
add_extsources("pacman::zlib")
elseif is_plat("linux") then
add_extsources("pacman::zlib", "apt::zlib1g-dev")
elseif is_plat("macosx") then
add_extsources("brew::zlib")
end
on_install(function (package)
local configs = {}
if package:config("shared") then
configs.kind = "shared"
elseif not package:is_plat("windows", "mingw") and package:config("pic") ~= false then
configs.cxflags = "-fPIC"
end
import("package.tools.xmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("inflate", {includes = "zlib.h"}))
end)
package_end()
add_requires("zlib v1.2.10", {configs = {shared = false, pic = true, vs_runtime = "MD"}, system = false, alias = "myzlib"})
target("test")
set_kind("binary")
add_files("src/*.c")
add_packages("myzlib") 如果没有on_test 的情况下可以看到尝试安装完后的目录结构是这样的 │ manifest.txt
│ references.txt
│
├─include
└─lib
│ source.lib
│
└─pkgconfig
zlib.pc |
Beta Was this translation helpful? Give feedback.
Answered by
waruqi
Nov 23, 2022
Replies: 1 comment 3 replies
-
既然摘也得摘完整,自己对比下 xmake-repo 里面的 zlib 配置,差了哪 |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
kench1994
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
既然摘也得摘完整,自己对比下 xmake-repo 里面的 zlib 配置,差了哪