xmake-io / xrepo

🗂️ A cross-platform C/C++ package manager based on Xmake
https://xrepo.xmake.io
Apache License 2.0
360 stars 16 forks source link

`xrepo env --show`结果和`env`一样 #18

Closed playgithub closed 3 years ago

playgithub commented 3 years ago

xrepo env --show 输出大概看了一下,没有xmake相关内容 除去大括号和最后的空行,行数和env输出一样

$ xrepo env --show | wc -l
74
$ env | wc -l
71

更新 仔细看过了,内容一样,一个json格式,一个shell格式


这个例子是不是有问题,因为xrepo env没有引入任何xrepo的内容 https://github.com/xmake-io/xrepo#enter-the-package-shell-environment

add_requires("zlib 1.2.11")
add_requires("python 3.x", "luajit")
$ xrepo env shell
> python --version
> luajit --version
waruqi commented 3 years ago

跟行数有什么关系,又不会新增key,看path ld_library_path的值

playgithub commented 3 years ago

跟行数有什么关系,又不会新增key,看path ld_library_path的值

$ xrepo env --show | grep zlib
(空)
$ xrepo env -b "zlib" --show | grep zlib
  PKG_CONFIG_PATH = "/home/user/.xmake/packages/z/zlib/1.2.11/832cf454431442ab9f0ec95e35aac34d/lib/pkgconfig",
  CMAKE_PREFIX_PATH = "/home/user/.xmake/packages/z/zlib/1.2.11/832cf454431442ab9f0ec95e35aac34d",
  LD_LIBRARY_PATH = "/home/user/.xmake/packages/z/zlib/1.2.11/832cf454431442ab9f0ec95e35aac34d/lib",
waruqi commented 3 years ago

xrepo env --show

你没传递 -b packages 绑定任何包,也没配置 xmake.lua 绑定包,结果当然是空了

xrepo env -b "zlib" --show | grep zlib

绑定包了,不是有结果了么

playgithub commented 3 years ago

也没配置 xmake.lua 绑定包

加了xmake.lua

add_requires("zlib") 

xrepo会在工作目录找xmake.lua

可以了

xrepo env --xmake-lua-file xamke.lua ... 这样也不错, cmake传递CMAKE_PREFIX_PATH只能通过环境变量或-D,如果能通过包含相关路径的文件,如cmake --cmake_prefix_path_file=cmake_prefix_paths.txt,那对接包管理工具更方便