xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
10k stars 780 forks source link

Xmake是否支持在plat=windows的情况下,自定义msvc的编译链 #5732

Open Zcaic opened 6 days ago

Zcaic commented 6 days ago

Xmake Version

2.9.5

Operating System Version and Architecture

Windows10

Describe Bug

我电脑由于不能联网,所以安装的是便携版的msvc,并设置好相应的PATHINLCUDE、`LIB``环境变量,用cmake是能够正确识别和编译的,但是用xmake的时候,发现会提示找不到vs。

Expected Behavior

Project Configuration

Additional Information and Error Logs

Issues-translate-bot commented 6 days ago

Bot detected the issue body's language is not English, translate it automatically.


Title: Does Xmake support customizing the msvc compilation chain when plat=windows?

waruqi commented 5 days ago

这边支持 vcvarsall.bat 的探测和加载,以及支持 vs prompt cmd 环境。。其他的环境不支持

Issues-translate-bot commented 5 days ago

Bot detected the issue body's language is not English, translate it automatically.


This supports the detection and loading of vcvarsall.bat, as well as the vs prompt cmd environment. . Other environments are not supported

star-hengxing commented 5 days ago

如果要支持,需要 config 新增几个参数专门设置 INCLUDE/LIBPATH,然后还是在 find_vstudio 基于这些值去查找吧。 这样貌似也能无缝支持 wine-msvc 的工具链,包管理那边继续走环境变量。

Issues-translate-bot commented 5 days ago

Bot detected the issue body's language is not English, translate it automatically.


If you want to support it, you need to add several parameters to config to specifically set INCLUDE/LIBPATH, and then use find_vstudio to search based on these values. This seems to be able to seamlessly support the wine-msvc tool chain, and the package management will continue to use environment variables.

Zcaic commented 5 days ago

我看了下源码,xmake好像是根据注册表去找vs的,而且构建工具好像用的是msbuild,不知道我理解的对不对

Issues-translate-bot commented 5 days ago

Bot detected the issue body's language is not English, translate it automatically.


I looked at the source code. It seems that xmake looks for VS based on the registry, and the build tool seems to use msbuild. I don’t know if I understand it correctly.

waruqi commented 3 days ago

跟 msbuild 有啥关系,xmake 直接调用的编译器。

环境加载依赖 vcallvars.bat 你可以自己看下源码

https://github.com/xmake-io/xmake/blob/dev/xmake/modules/detect/sdks/find_vstudio.lua

waruqi commented 3 days ago

我没用过便携版的msvc,可以提供下 安装包,或者直接提 pr 到 xmake-repo 收录进来。后面倒是可以考虑整合进来

Zcaic commented 3 days ago

好的嘞,大佬,这是便携版MSVC的下载开源工具,https://github.com/Data-Oriented-House/PortableBuildTools

Issues-translate-bot commented 3 days ago

Bot detected the issue body's language is not English, translate it automatically.


What does it have to do with msbuild, the compiler called directly by xmake.

Environment loading depends on vcallvars.bat. You can look at the source code yourself.

https://github.com/xmake-io/xmake/blob/dev/xmake/modules/detect/sdks/find_vstudio.lua

Issues-translate-bot commented 3 days ago

Bot detected the issue body's language is not English, translate it automatically.


I have never used the portable version of msvc. You can provide the installation package, or directly upload the pr to xmake-repo for inclusion. You can consider integrating it later.

Issues-translate-bot commented 3 days ago

Bot detected the issue body's language is not English, translate it automatically.


Okay, boss, this is the downloadable open source tool for the portable version of MSVC, https://github.com/Data-Oriented-House/PortableBuildTools