[CMake] Building generated c++ code with py++ and boost.python

Pecevski Dejan dejan at igi.tugraz.at
Tue Oct 10 14:53:29 EDT 2006


Hi,

As part of our build process which uses cmake, we want to generate 
wrapper c++ files from existing sources, for python interfacing (using 
Py++ and boost.python).
The dependency we want to achieve is :
    A1.cpp A2.cpp A3.cpp   A1.h A2.h A3.h  ...  <-----  Abase.h  generate.py
   wrapLibrary.so  <-----  A1.cpp A2.cpp A3.cpp  baseLibrary.a
where
    - Abase.h is the header file containing the classes that are to be 
exposed in python (INCLUDES several header files from other directories)
    - generate.py is the python script which parses Abase.h and produces 
the wrapper code from it
   - A1.cpp A2.cpp A3.cpp  A1.h A2.h A3.h  - automatically generated 
wrapper c++ files
   - wrapLibrary.so is the library which contains the compiled wrapper 
code along with the library which is wrapped (baseLibrary.a).
Note that the automatically generated c++ file list are NOT KNOWN 
apriori (they are dependent on the contents of Abase.h and generate.py).

I have two questions on how to setup this with cmake:
1. To setup the first dependency rule properly, one should also add as 
dependencies the files that Abase.h file includes
    so that when you change the code in these files, wrapper code is 
recreated. For example if Abase.h includes another header file B.h, and 
B.h (but not Abase.h)   is changed then the rule should be activated.
    Is there some way to setup this in cmake?
    It seems like the scanning mechanism for the dependencies of c++ 
sources doesn't work for ADD_CUSTOM_TARGET.
   
2. For the second rule to work, one should include dynamically the list 
of all generated files in the rule. The file list that is to be included 
can be retrieved with a FILE(GLOB ...) command (that is after they are 
created).
I have some vague idea how to setup this with recursive calling of cmake 
commands, but I'm not really sure it can work out. Is this setup 
possible, and is there some elegant way to do this?

Any help would be appreciated!

Thanks,
Dejan
   
   
   
   


More information about the CMake mailing list