2026-03-05 13:29:56 +08:00
|
|
|
【1】部署私有的仓库库。
|
|
|
|
|
1,新建一个仓库,作为仓库库,存储其他库信息的库。
|
|
|
|
|
2,对于某个库,
|
|
|
|
|
(远程git库)使用xmake package -f remote
|
|
|
|
|
生成一个以packages开头的目录结构,
|
|
|
|
|
将该目录结构放到仓库库根目录(packages目录)。
|
|
|
|
|
3,使用方使用方法,先添加仓库库(如果没有添加),其中xmake-library是仓库库,可以跟分支信息。
|
|
|
|
|
xmake repo用于当前工程。
|
|
|
|
|
xrepo是全局设定,这里用全局的。
|
|
|
|
|
xrepo add-repo xmake-library https://www.sinxmiao.cn/taynpg/xmake-library.git main
|
|
|
|
|
xrepo rm-repo xmake-library删除。
|
|
|
|
|
4,工程配置示例:
|
|
|
|
|
add_rules("mode.debug", "mode.release")
|
|
|
|
|
add_rules("plugin.compile_commands.autoupdate", {outputdir = "build"})
|
|
|
|
|
add_requires("zoost")
|
|
|
|
|
|
|
|
|
|
if is_plat("windows") then
|
|
|
|
|
add_cxxflags("/utf-8")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
target("zoost-use")
|
|
|
|
|
set_kind("binary")
|
|
|
|
|
add_files("src/*.cpp")
|
2026-03-05 14:07:48 +08:00
|
|
|
add_packages("zoost")
|
|
|
|
|
|
|
|
|
|
【1.1 如果当前环境有多个编译器,比如2个vs版本】
|
|
|
|
|
可以尝试使用:
|
|
|
|
|
xrepo install -p windows --vs=2017 --toolchain=msvc zoost
|
|
|
|
|
xrepo install -p windows --vs=2022 --toolchain=msvc zoost
|
|
|
|
|
这种来指定不同的库版本。当然工程中也需要指定如xmake f --vs=2022 --toolchain=msvc来对应。
|
2026-03-05 14:12:21 +08:00
|
|
|
后续使用发现,指定了--vs=2022 --toolchain=msvc应该会自适应编译器版本,但是--toolchain=msvc
|
|
|
|
|
必须要设定,不能光设定--vs=2022。
|
2026-03-06 11:45:09 +08:00
|
|
|
--比如当在vs2022中安装了v141工具集时,xmake使用
|
|
|
|
|
xmake -f --vs_toolset=14.16,而不是v141这种写法。
|
2026-03-05 14:07:48 +08:00
|
|
|
|
|
|
|
|
【2】xmake的基本配置
|
|
|
|
|
|
|
|
|
|
-c 表示清除之前的缓存。
|
|
|
|
|
--toolchain=msvc 一般使用vs的时候最好也指定,不然有时候某些功能不生效。
|
|
|
|
|
|
|
|
|
|
1,配置debug,xmake f -m debug
|
|
|
|
|
2,指定vs2017,xmake f --vs=2017 --toolchain=msvc
|
|
|
|
|
3,重新构建,xmake --rebuild
|