On Sat, May 5, 2012 at 3:32 AM, Ming <ymy...@wisc.edu> wrote: > *From: **James Bigler* <jamesbig...@gmail.com>* * > *Sent: Saturday, May 05, 2012 1:51 AM* > *To: **Ming* <ymy...@wisc.edu>* * > *Cc: **cmake@cmake.org* <cmake@cmake.org>* * > *Subject: Re: [CMake] Moving large MSVS projects to CUDA* > ** > *On Fri, May 4, 2012 at 12:39 PM, Ming <ymy...@wisc.edu> wrote: > * > >> *Hello CMake community,* >> ** >> *I have experience using CMake to generate sime cuda-enabled executables >> (where the cpp’s reside in one folder, etc.).* >> *I am attempting to move a large project that utilizes CMake, from just >> c++ to CUDA enabled c++. * >> ** >> *It is a project that generates a large set of libraries (comprising a >> toolkit), using various cmake scripts. I have modified the “add_libraries” >> call to be “cuda_add_libraries”, and changed all of the .cc files to .cu >> (but with no additional CUDA code). An approach I thought would be similar >> to changing a simple program from add_executable to “cuda_add_executable” >> and renaming the extension to “.cu”* >> *My goal was first to have it compile properly in its original form post >> migration, but am met with some very strange errors in visual studio. * >> ** >> *I am wondering if anyone else has undertaken such a migration before >> (libraries or binaries), and if so, what types of general steps need to be >> taken other than just telling CMake we’re adding “.cu” files?* >> ** >> *Thanks all in advance,* >> *Ming* >> >> *-- >> >> Powered by **www.kitware.com* <http://www.kitware.com> >> >> *Visit other Kitware open-source projects at ** >> http://www.kitware.com/opensource/opensource.html*<http://www.kitware.com/opensource/opensource.html> >> >> *Please keep messages on-topic and check the CMake FAQ at: ** >> http://www.cmake.org/Wiki/CMake_FAQ*<http://www.cmake.org/Wiki/CMake_FAQ> >> >> *Follow this link to subscribe/unsubscribe: >> **http://www.cmake.org/mailman/listinfo/cmake*<http://www.cmake.org/mailman/listinfo/cmake> >> > > > *What kind of strange errors? > > Typically when adding a new CUDA enabled library, you simply start adding > the .cu files with the host/device code mixed to a cuda_add_* target. > > James > * > Thank you all for the reply, > > -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
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake