On Fri, Jan 14, 2011 at 11:05 AM, Patrick Charrier <span dir="ltr"><<a href="mailto:patrick.charrier@igd.fraunhofer.de">patrick.charrier@igd.fraunhofer.de</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi all,<br>
<br>
I am experiencing some (random) reloading of VS-project files and<br>
rebuilding when using the combination of CMake, Visual Studio and CUDA.<br>
<br>
Particularly when performing the following steps.<br>
1. Project has been built before.<br>
2. Perform an SVN update.<br>
3. Start CMake. Configure and Generate.<br>
4. Open the generated VS Solution.<br>
5. Build in Debug Mode. (Or Rebuild All.)<br>
6. Build in Release Mode. (Or Rebuild All.)<br>
<br>
After Point 6 the fun part starts.<br>
7. At this point VS runs CMake Configuration and Generation. Why this in<br>
the first place?<br>
8. VS will then ask to reload the newly generated VS-project files for all<br>
the CUDA VS-projects (libraries) in the solution.<br>
9. I hit yes and the project is being built.<br>
10. When trying to start the application, VS will prompt me to reload the<br>
VS-project files again, as in step 8.<br>
11. I hit yes again, but this time VS just says:<br>
1>------ Skipped Build: Project: PACKAGE, Configuration: Release Win32 ------<br>
1>Project not selected to build for this solution configuration<br>
2>------ Skipped Build: Project: INSTALL, Configuration: Release Win32 ------<br>
2>Project not selected to build for this solution configuration<br>
========== Build: 0 succeeded, 0 failed, 7 up-to-date, 2 skipped ==========<br>
<br>
The problem only occurs with CUDA and VS from what I know.<br>
My main question is, why is there a Reconfiguration and Regeneration in<br>
step 7, and how can I avoid it? There should be no need for it, since step<br>
3 should assure that the project files are fresh. Also why did it build<br>
smoothly in Debug (step 5), but not Release (step 6)?<br>
Also, what does the second Regenerate in step 11 mean?<br>
<br>
My guess is, that step 7 is somehow caused by Debug and Release sharing<br>
the same CUDA ".depend" and ".cmake" files in the CMakeFiles subdirectory of<br>
each CUDA VS-project. But how exactly, and how could I fix that?<br>
<br>
Thank you and Best Regards,<br>
Patrick<br>
<br></blockquote><div><br>This is the expected behavior and is a product of the FindCUDA script's ability to generate the file level dependencies. Here's what happens.<br><br>1. Start with fresh build directory. Configure with CMake. At this point we don't know that <a href="http://file.cu">file.cu</a> depends on header.h. We generate the VS project file anyway with not dependencies for <a href="http://file.cu">file.cu</a>.<br>
2. Build your project. At this point when <a href="http://file.cu">file.cu</a> is compiled it generates file.cu.obj.depend which is created with nvcc -M similarly to how gcc -M is run. At this point, your configuration is stale, because file.cu.obj.depend has changed.<br>
3. If you click build or run CMake will want to reconfigure, because file.cu.obj.depend has changed.<br>4. When CMake configures again it will generate a new vcproj file listing header.h as a dependency for <a href="http://file.cu">file.cu</a>. If you change header.h, then <a href="http://file.cu">file.cu</a> will automatically be recompiled just as if <a href="http://file.cu">file.cu</a> were a C file.<br>
5. Whenever the dependencies of <a href="http://file.cu">file.cu</a> change, file.cu.obj.depend will change signaling CMake that it needs to reconfigure the VS project. <br></div></div><br>James<br>