Boost logo

Boost-Build :

From: Jurko Gospodnetić (jurko.gospodnetic_at_[hidden])
Date: 2008-07-23 05:47:42


   Hi Emil.

> I want to add nVidia CUDA as a toolset in boost build. I need some help.
>
> What needs to happen is that nvcc runs for sources of type .cu, and it
> produces regular object files. The tricky part is that it invokes the
> native C compiler. For that purpose, nvcc is given the path to the
> native compiler, as well as the compile options to pass to it.

   Can you split what your CUDA toolset does into two separate steps:
   1. preprocessign the .cu file and constructing whatever C/C++ source
are needed from it.
   2. running the C/C++ compiler on the generated files?

   In case your CUDA tool wants to run the compiler internally - I do
not know of a way to do what you want without some heavy Boost Jam/Build
modifications (which would generally start by duplicating the options
you need for one compiler to get things working and then continue by
removing the duplication but I sincerely hope this is not the case you
need).

   On the other hand, if your CUDA tool simply prepares the needed C/C++
sources then everything should be pretty straight-forward. You just
create a new TYPE for your .cu files, tell Boost Build how to generate
source files from them and then let Boost Build do its magic from there.
Once you do that you will be able to do things like:

   exe my-exe : aaa.cpp bbb.cu ;

   Which will make Boost Build transform your bbb.cu file into
appropriate C/C++ sources, convert those sources to object files and
then finally use those object files to link together your my-exe executable.

   There should be examples on how to construct such a new type in the
docs (something about .VERBATIM files if I remember correctly). And feel
free to send any questions to this list.

   Hope this helps.

   Best regards,
     Jurko Gospodnetić


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk