-
-
Notifications
You must be signed in to change notification settings - Fork 788
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
Support custom vc build tools #5823
Conversation
msvc-wine 并没有提供类似 bat 的环境变量工具 mstorsjo/msvc-wine#146 ,但他们目录结构都是 |
那就直接复用 |
msvc-wine... /home/star/msvc/bin/x64/cl.exe -c -nologo -O2 /EHsc -DNDEBUG -Fobuild/.objs/test/windows/x64/release/src/main.cpp.obj src/main.cpp
checking for flags (cl_sourceDependencies) ... no
> cl.exe "/sourceDependencies" "/tmp/.xmake1000/241115/_47189BF6655A4500867A807596EDBC10.json" "-nologo"
checkinfo: _2A70BC855C6B47118314FA08E23BEC9B.cpp
z:\tmp\.xmake1000\241115\_2A70BC855C6B47118314FA08E23BEC9B.cpp : fatal error C1083: Cannot open compiler generated file: 'z:\dev\null.obj': Permission denied |
add_rules("mode.debug", "mode.release")
set_runtimes("MD")
add_requires("fmt[shared]")
add_packages("fmt")
target("test")
set_kind("shared")
add_files("src/*.cpp") $ xmake f -c -p windows -a x64 --sdk=~/msvc
$ xmake -v
checking for the c++ compiler (cxx) ... cl.exe
checking for flags (-O2) ... ok
checking for flags (-DNDEBUG) ... ok
[ 50%]: cache compiling.release src/main.cpp
/home/star/msvc/bin/x64/cl.exe -c -nologo -O2 -MD -DFMT_LIB_EXPORT /EHsc -I/home/star/.xmake/packages/f/fmt/11.0.2/5686d8134ed840a1bdc1f40efb05e098/include /utf-8 -DNDEBUG -Fobuild/.objs/test/windows/x64/release/src/main.cpp.obj src/main.cpp
checking for flags (cl_sourceDependencies) ... no
[ 75%]: linking.release test.dll
/home/star/msvc/bin/x64/link.exe -dll -nologo -machine:x64 -libpath:/home/star/.xmake/packages/f/fmt/11.0.2/5686d8134ed840a1bdc1f40efb05e098/lib /opt:ref /opt:icf fmt.lib -out:build/windows/x64/release/test.dll build/.objs/test/windows/x64/release/src/main.cpp.obj
checking for the c compiler (cc) ... cl.exe
[100%]: build ok, spent 1.637s |
|
|
为啥会位置不同,用的是当前目录下的 check.lua , xmake.lua 不也在这个目录下么。 |
Why are the locations different? Check.lua in the current directory is used. Isn’t xmake.lua also in this directory? |
|
我这可以的么 ruki-2:test ruki$ xmake f --toolchain=clang -c
checking for platform ... macosx
checking for architecture ... x86_64
check diff --git a/xmake/toolchains/clang/xmake.lua b/xmake/toolchains/clang/xmake.lua
index cc8da1d26..b5eb7ec15 100644
--- a/xmake/toolchains/clang/xmake.lua
+++ b/xmake/toolchains/clang/xmake.lua
@@ -44,6 +44,7 @@ toolchain("clang" .. suffix)
set_toolset("mrc", "llvm-rc")
on_check(function (toolchain)
+ import("check")()
return import("lib.detect.find_tool")("clang" .. suffix)
end)
$ cat xmake/toolchains/clang/check.lua
function main()
print("check")
end |
可能没描述清楚,需要指定 clang 版本 |
It may not be described clearly, you need to specify the clang version |
哦,那是因为加了 suffix 目录不对了,那就加个 rootdir 就好了 |
Oh, that’s because adding the suffix directory is wrong, then just add a rootdir. |
目前看没啥大问题,能开个 issues ,大概备注下 当前 patch 支持的 toolchains,对应的下载 link ,以及配置和编译命令么? 也便于其他人查阅使用,后期也方便同步到文档。 另外,这些 toolchain 如果能做成包,直接走包集成使用就更好了,直接一键拉取编译。 还有,msvc wine 里面带 wine 么,是不是编译出来的 bin ,也可以扩展 |
There are no big problems so far. Can you open an issue and make notes about the toolchains supported by the current patch, the corresponding download links, and the configuration and compilation commands? It is also convenient for other people to check and use, and it is also convenient to synchronize to the document later. In addition, it would be better if these toolchains can be made into packages and directly integrated and used, and they can be directly pulled and compiled with one click. |
_get_configs_for_cross(package, configs, opt) | ||
else | ||
_get_configs_for_generic(package, configs, opt) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
貌似 windows 平台使用了交叉编译 configs 反而才是对的,不过可能会 break 一些包。
比如在交叉编译下,CMAKE_SYSTEM_VERSION 这个值是空的,需要手动传参
#5732