xmake icon indicating copy to clipboard operation
xmake copied to clipboard

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

Open Zcaic opened this issue 1 year ago • 7 comments

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

Zcaic avatar Oct 18 '24 02:10 Zcaic

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?

Issues-translate-bot avatar Oct 18 '24 03:10 Issues-translate-bot

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

waruqi avatar Oct 18 '24 13:10 waruqi

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

Issues-translate-bot avatar Oct 18 '24 13:10 Issues-translate-bot

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

star-hengxing avatar Oct 18 '24 14:10 star-hengxing

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.

Issues-translate-bot avatar Oct 18 '24 14:10 Issues-translate-bot

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

Zcaic avatar Oct 18 '24 14:10 Zcaic

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.

Issues-translate-bot avatar Oct 18 '24 14:10 Issues-translate-bot

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

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

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

waruqi avatar Oct 21 '24 02:10 waruqi

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

waruqi avatar Oct 21 '24 02:10 waruqi

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

Zcaic avatar Oct 21 '24 02:10 Zcaic

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 avatar Oct 21 '24 03:10 Issues-translate-bot

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 avatar Oct 21 '24 03:10 Issues-translate-bot

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

Issues-translate-bot avatar Oct 21 '24 03:10 Issues-translate-bot

现在支持了 可以试下: https://github.com/xmake-io/xmake/issues/5848

waruqi avatar Nov 20 '24 07:11 waruqi

强啊大佬,我晚上回去就去试试

Zcaic avatar Nov 20 '24 07:11 Zcaic

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


It's strong, boss. I'll try it when I get back tonight.

Issues-translate-bot avatar Nov 20 '24 07:11 Issues-translate-bot