diff options
| author | ruki <waruqi@gmail.com> | 2019-04-01 22:40:33 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2019-04-01 10:03:22 +0800 |
| commit | 74f0e8c43811b6dd6361592905b6dd3c12496706 (patch) | |
| tree | 945fd0291f9ad83800e78351c9221faf4070a1f2 /zh/README.md | |
| parent | f94bfa4943c7d6cc4932b38a8578d678da978730 (diff) | |
| download | xmake-docs-74f0e8c43811b6dd6361592905b6dd3c12496706.tar.gz xmake-docs-74f0e8c43811b6dd6361592905b6dd3c12496706.zip | |
update docs
Diffstat (limited to 'zh/README.md')
| -rw-r--r-- | zh/README.md | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/zh/README.md b/zh/README.md index 70f5bcae..aff62b33 100644 --- a/zh/README.md +++ b/zh/README.md @@ -1249,11 +1249,70 @@ package("openssl") 某些包在编译时候有各种编译选项,我们也可以传递进来,当然包本身得支持: ```lua -add_requires("tbox", {config = {small=true}}) +add_requires("tbox", {configs = {small=true}}) ``` 传递`--small=true`给tbox包,使得编译安装的tbox包是启用此选项的。 +##### 第三方依赖包安装 + +2.2.5版本之后,xmake支持对对第三方包管理器里面的依赖库安装支持,例如:conan,brew, vcpkg等 + +添加homebrew的依赖包: + +```lua +add_requires("brew::zlib", {alias = "zlib"}}) +add_requires("brew::pcre2/libpcre2-8", {alias = "pcre2"}}) + +target("test") + set_kind("binary") + add_files("src/*.c") + add_packages("pcre2", "zlib") +``` + +添加vcpkg的依赖包: + +```lua +add_requires("vcpkg::zlib", "vcpkg::pcre2") + +target("test") + set_kind("binary") + add_files("src/*.c") + add_packages("vcpkg::zlib", "vcpkg::pcre2") +``` + +添加conan的依赖包: + +```lua +add_requires("CONAN::zlib/1.2.11@conan/stable", {alias = "zlib", debug = true}) +add_requires("CONAN::OpenSSL/1.0.2n@conan/stable", {alias = "openssl", + configs = {options = "OpenSSL:shared=True"}}) + +target("test") + set_kind("binary") + add_files("src/*.c") + add_packages("openssl", "zlib") +``` + +执行xmake进行编译后: + +```console +ruki:test_package ruki$ xmake +checking for the architecture ... x86_64 +checking for the Xcode directory ... /Applications/Xcode.app +checking for the SDK version of Xcode ... 10.14 +note: try installing these packages (pass -y to skip confirm)? + -> CONAN::zlib/1.2.11@conan/stable (debug) + -> CONAN::OpenSSL/1.0.2n@conan/stable +please input: y (y/n) + + => installing CONAN::zlib/1.2.11@conan/stable .. ok + => installing CONAN::OpenSSL/1.0.2n@conan/stable .. ok + +[ 0%]: ccache compiling.release src/main.c +[100%]: linking.release test +``` + ##### 使用自建私有包仓库 如果需要的包不在官方仓库[xmake-repo](https://github.com/xmake-io/xmake-repo)中,我们可以提交贡献代码到仓库进行支持。 |
