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

xmake 生成的vstudio工程,支持 cuda #2077

Closed
soloist-v opened this issue Feb 21, 2022 · 5 comments
Closed

xmake 生成的vstudio工程,支持 cuda #2077

soloist-v opened this issue Feb 21, 2022 · 5 comments

Comments

@soloist-v
Copy link

soloist-v commented Feb 21, 2022

我的项目中使用了cuda 和 Qt
我使用xmake能够正确编译结果,但是我使用命令xmake project -k vs -m "debug,release"将项目导出未vs工程后,出现了一些问题

1. 在xmake中添加的宏定义 add_defines("or=||", "and=&&", "not_eq=!=")到了vs中就会报错,这回导致vs工程无法打开,我手动去除了这些宏,加入到了对应的 cpp文件中,就可以正常打开vs工程了;

2. 我开始用vs编译工程,但是遇见了符号找不到的问题,我发现是对应的.cu文件并没有引入到项目中导致,但是我在xmake.lua中已经正确添加了.cu文件;

3. 当我使用xmake project -k vsxmake -m "debug,release"生成vsxmake工程时,同样无法正确加载解决方案,我发现是因为vcxproj.filters文件在生成时出现了问题导致的,由于我在xmake中使用了绝对路径:

xmake文件中: add_files(include_tensorRT_Pro_tensorRT .. "common/*.cpp")
auto_strike.vcxproj.filters 文件中:
<ClCompile Include="$(XmakeProjectDir)\D:\CppInclude\print\my_print.cpp">
    <Filter>D:\CppInclude\print</Filter>
</ClCompile>
<ClCompile Include="$(XmakeProjectDir)\D:\CppInclude\tensorRT_Pro\src\tensorRT\common\cuda_tools.cpp">
    <Filter>D:\CppInclude\tensorRT_Pro\src\tensorRT\common</Filter>
</ClCompile>
@soloist-v soloist-v added the bug label Feb 21, 2022
@waruqi
Copy link
Member

waruqi commented Feb 21, 2022

暂不支持,用 xmake project -k vsxmake

@waruqi waruqi closed this as completed Feb 21, 2022
@xq114
Copy link
Contributor

xq114 commented Feb 21, 2022

这个可以先作为feature request备着,vs生成器要支持cuda并不一定非要custom command,用安装cuda toolkit同时安装的vs integration(CUDA 11.x.props)也可以做到,只是把<ClCompile>换成<CudaCompile>而已,vsxmake就是这么实现的 @waruqi

vsxmake支持绝对路径也是应该的,这里要改 https://github.com/xmake-io/xmake/blob/master/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec)

@waruqi waruqi reopened this Feb 21, 2022
@waruqi
Copy link
Member

waruqi commented Feb 21, 2022

这个可以先作为feature request备着,vs生成器要支持cuda并不一定非要custom command,用安装cuda toolkit同时安装的vs integration(CUDA 11.x.props)也可以做到,只是把<ClCompile>换成<CudaCompile>而已,vsxmake就是这么实现的 @waruqi

可以先备着,但目前我暂时没 win cuda 环境,也放着吧

vsxmake支持绝对路径也是应该的,这里要改 https://github.com/xmake-io/xmake/blob/master/xmake/plugins/project/vsxmake/vsproj/templates/vcxproj.filters/File.c(filec)

为什么要绝对路径?这跟 cuda 没啥关系吧

@waruqi waruqi changed the title xmake 生成的vstudio工程不能引入cu文件 xmake 生成的vstudio工程,支持 cuda Feb 21, 2022
This was referenced Feb 24, 2022
@waruqi waruqi added this to the v2.6.4 milestone Feb 25, 2022
@xq114
Copy link
Contributor

xq114 commented Feb 27, 2022

已修复这些问题,xmake update -s dev再试试

@waruqi waruqi closed this as completed Feb 28, 2022
@soloist-v
Copy link
Author

ok

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

3 participants