[CMake] Moving large MSVS projects to CUDA

Ming ymyang at wisc.edu
Mon May 7 13:41:03 EDT 2012


    -The code in question is the Geant4 (http://geant4.web.cern.ch/geant4/support/download.shtml) toolkit, which uses CMake to handle its cross-platform configurations. The end result of the toolkit is to compile a large set of libraries.
  -I’ve changed all of the source files from .cc to .cu, and changed all “add_library” terms to “cuda_add_library”
  -I’ve also updated all of the “include directories” to “cuda_include_directories”
  -The end result is that I am able to generate a build directory (without any errors) using cmake, for VS2010. 

  However when I attempt to build the package in an analagous fashion, I get errors from visual studio informing me mid-build that it:

  Cannot load macro project “ for the following reason:
  C:\...\Projects\VSMacros80\Samples\Samples.vsmacros’ is an invalid or inaccessible macro project file

  Once I acknowledge this message, it then says:

  CMake has regenerated 3 .sln and/or .vcproj files.
  Click:
  --Yes to reload the whole solution...
  --No to reload the solution ...
  --Cancel to do nothing

  This message shows up even though CMake was done generating files and was closed prior to the build.
  The same thing happens on my work computer, and I am able to compile other programs just fine, so I do not believe it to be a corrupt install of visual studio.  Any suggestions on why this would occur is appreciated!

  Thanks,
  Ming

  Uploaded screenshots of the error messages:
  https://mywebspace.wisc.edu/ymyang/web/macroerr1.png 
  https://mywebspace.wisc.edu/ymyang/web/macroerr2.png 

I believe the macro error is a known problem with the CMake VS macro in VS 2010 (MS broke it).  The regeneration of the project files is also a known behavior of FindCUDA.  The dependencies are computed by nvcc during build and saved in a file.  When the dependency file is regenerated CMake will want to reconfigure to add those new dependencies to the project file.  This is the expected behavior.

My current recommendation for CUDA + VS 2010 is to specify CMAKE_SUPPRESS_REGENERATION OFF in your project file's CMakeLists.txt:
option(CMAKE_SUPPRESS_REGENERATION "Suppress regeneration of build scripts during build" ON)

This will disable the VS CMake plugin, requiring you to manually configure with CMake when you change the build scripts.  I also recommend configuring CMake after your first build to pick up the file level dependencies that CUDA generates.

James

Hey James, 
Thanks you for the reply.  I am a bit new to this (and definitely jumping into the deep end with what I am attempting).  Could you elaborate on what you mean by “manually configure with CMake” after the initial build?  Is it safe to interpret that as re-running CMake-gui after a build, for the same source and build directories?.  Or is there something else implied?  I’ve had issues in the past trying to perform a configure command in CMake-gui when the buidl directory already existed..?

Thanks!
Ming
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120507/57c410d0/attachment.htm>


More information about the CMake mailing list