I have a Visual Studio 2008 application in which I want to make CUDA rules and CUDA libraries portable, so they are carried along with the source code and selectable or not according to the Visual Studio build configuration for the project. I have done this with other runtime libraries such as Visual Studio 2008 redistributable by keeping copies of libraries local to the source code folders. I can’t figure out how to do this with the CUDA rules file.
My problem is that Visual Studio requires that I specify a search path for rules files befor it will recognize and apply them. There is a default search path for rules files, which in my case is:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCProjectDefaults
And I can add additional search paths for rules using the Visual Studio menu selections Tools | Options | VC++ Project Settings | Rule File Search Paths. For example, I might specify
The problem with the above is that the path is an absolute path. I cannot figure out how to make it a relative path, relative to the source code for the project. If I want to create code_version_2, I need to keep referring to the old path (F:\VC++ Projects\code_version_1) or else change my Visual Studio search path for each new code version. What I would like to do is have the rules carried along with the source automatically by specifying a path relative to the root of the source code. Specifically, I tried using $(SolutionDir), which works for the compiler and linker settings, but it does not work for the CUDA rules.
Another approach might be to ask all persons who might want to build the code to put the rules file in a standard directory such as C:\CUDA_rules. This presents a configuration management issue unless you rename the rules file for each code version, which would be a hassle.
The root reason for all this is that I want to share the source code with others and to allow these other people to have a different CUDA installation or none at all. In this way, someone who does not have CUDA toolkit installed could build project configurations (there are several) that do not use CUDA. For those who do use CUDA, having the rules local to the source would make the source code responsible for fixing the CUDA version and libraries, not leaving it to the users installation, which could present compatibility problems.
As it stands, if a user does not have a CUDA toolkit installation, he cannot even open the code project in the Visual Studio IDE because it complains that it can’t find the rules file. Putting the rules file relative to the source would make sure it is always there.
Does anyone know how to do this?