Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add built-in environments i.e. msvc.lua #2070

Closed
waruqi opened this issue Feb 20, 2022 Discussed in #2069 · 2 comments
Closed

Add built-in environments i.e. msvc.lua #2070

waruqi opened this issue Feb 20, 2022 Discussed in #2069 · 2 comments

Comments

@waruqi
Copy link
Member

waruqi commented Feb 20, 2022

Discussed in #2069

Originally posted by xq114 February 20, 2022
目前要创建虚拟环境必须自己写env.lua,但写虚拟环境这个过程很容易出错(没有详细的文档,set_toolchains容易写成set_toolchain等),xmake可以加一些内置的虚拟环境来方便上手使用,也作为用户编写自己虚拟环境的参考。

举例一些常用的虚拟环境:

-- msvc.lua
if is_host("windows") then
  set_toolchains("msvc")
end
-- mingw.lua
add_requires("mingw-w64")
-- python.lua
add_requires("python")

等等。后面两个可能有待商榷,第一个msvc.lua需求量肯定很多。内置msvc环境之后,用户想在命令行使用msvc工具无需再手动配置,直接运行

xrepo env -b msvc shell

就行了,省去了命令行使用msvc的诸多不便。

@waruqi waruqi added this to the v2.6.4 milestone Feb 20, 2022
@waruqi
Copy link
Member Author

waruqi commented Feb 20, 2022

$ xrepo env -l
/Users/ruki/.xmake/envs:
  - base
/Users/ruki/xmake/scripts/xrepo/envs (builtin):
  - msvc
  - llvm-mingw
  - llvm
  - mingw-w64
  - python3
  - python2
envs(6) found!
$ xrepo env -l msvc
/Users/ruki/projects/personal/xmake/xmake/scripts/xrepo/envs/msvc.lua:
if is_host("windows") then
    set_toolchains("msvc")
end

@waruqi
Copy link
Member Author

waruqi commented Feb 20, 2022

目前只是初步添加了一些,有需要改进的可以来个 pr

@waruqi waruqi closed this as completed Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant