CMake and CUDA Platform independent!

We guys have started working on a CUDA library and I would like the library to remain easily compilable across various platforms.

I think CMake might help. I have no prior experience working with CMake.

I also located a CMake script for CUDA in the forum : https://code.sci.utah.edu/svn/people/abe/code/CMake-cuda

I would like to have a high level view of how this works. I know that CMake creates configuration files required by the platform to compile. Can it be used to generate DLLs under windows and “.SO” under linux seamlessly?? I just need some perspective about CMake and this script for CUDA.

Thanks for any help!

Best Regards,
Sarnath

To answer your first question, I would highly suggest reading the CMake manual, specifically the “running CMake” guide. http://www.cmake.org/cmake/help/runningcmake.html CMake is capable of outputting makefils and/or IDE project files in a variety of formats depending on platform.

To answer your 2nd question, yes: you can create shared libraries seamlessly across platforms. That is the whole point of CMake!

This is all it takes.

cuda_add_library(mylib SHARED file1.cu file2.cu file3.cpp file4.cpp)

Thank you Mr.Anderson! The link looks to be slightly outdated. However, it helped me find out where to get the real-help.

I am reading through the HTML help generated by
“cmake --help-html” command. It is helpful!

Thanks
Best Regards,
Sarnath