如何设置CMake与Visual Studio 2017RC和CUDA 8.0一起使用? [英] How can I setup CMake for use with Visual Studio 2017RC and CUDA 8.0?

查看:111
本文介绍了如何设置CMake与Visual Studio 2017RC和CUDA 8.0一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 2017 RC包含更紧密的CMake集成,从而可以跳过生成项目/解决方案文件的中间步骤,并有效地将CMake用作项目文件本身. Microsoft提供了足够的文档来将这些功能与常规C ++文件一起使用,并且在此网站上有足够的文档(

Visual Studio 2017 RC includes much tighter CMake integration, allowing one to skip the intermediate step of generating project/solution files and use CMake effectively as the project file itself. There is sufficient documentation from Microsoft for using these features with regular C++ files, and there is sufficient documentation on this website (example) for making CUDA and Cmake play nicely, when it comes to linking CUDA code to C++ code.

我找不到有关如何使CMake,Visual Studio 2017 RC和CUDA 8.0完美播放的信息.这是一个棘手的问题,因为2017RC仍未与CUDA SDK集成,并且我希望使用2017RC,以便我到CUDA代码的C ++接口可以使用C ++ 14和/或C ++ 17.我正在进行一个大型项目的开始,该项目主要涉及编写可通过C ++访问的静态CUDA库:因此,我想让CMake负责将CUDA源代码编译成静态库,并且它有助于将链接信息提供给Visual Studio.到目前为止,使用FindCUDA的各种功能来实现这一目标还没有取得任何成功,但是我认为那是由于我的误解.我已经阅读了Nvidia上有关可分离编译的文档,但这对弄清楚CMake并没有帮助.

What I can't find information on is how to make CMake, Visual Studio 2017 RC, and CUDA 8.0 all play nicely. This is a difficult problem, because 2017RC has no integration for the CUDA SDK anyways, and I was hoping to use 2017RC so that my C++ interface to the CUDA code could use C++14 and/or C++17. I'm working on the beginning of a large project that will primarily involve writing a static CUDA library that is accessed through C++: so, I'd like to get the CMake to take care of compiling my CUDA sources into a static library, and for it to help with feeding the linking information to Visual Studio. So far, I haven't had any success with using FindCUDA's various features to accomplish this, but I'm assuming that's due to a misunderstanding on my part. I've read through the documentation on separable compilation from Nvidia, but that wasn't helpful for figuring out CMake.

此外,每当我尝试在VS2017RC中使用CMake时,我仍然会得到CMake喜欢吐出的各种vcxproj文件.这是我的错误造成的吗?如何编辑构建命令参数或CMakeLists.txt,以获取已演示的功能

Further, whenever I try to use CMake in VS2017RC, I still end up with the various vcxproj files that CMake likes to spit out. Is this due to an error on my part? How do I edit the build command arguments, or CMakeLists.txt, to get the functionality demonstrated here to work?

推荐答案

非常简短的答案(仅在撰写本文时)是您不能做到. CUDA 8不支持VS2017.目前仅支持VS2015.

The very short (and only at the time of writing) answer is that you can't. CUDA 8 doesn't support VS2017. Only VS2015 is presently supported.

您始终可以找到CUDA发行版支持的编译器/IDE版本此处

You can always find the compiler/IDE versions which the release version of CUDA supports here

编辑以添加CUDA 9版本将添加对VS2017的官方支持.

Edit to add that the CUDA 9 release will add official support for VS2017.

这篇关于如何设置CMake与Visual Studio 2017RC和CUDA 8.0一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆