[C++-sig] python-extension depending on other project

mattknox_ca Matt.Knox at tdam.com
Fri Nov 16 20:43:22 CET 2007


Hi there,

I have 2 projects I am trying to build, one is a C++ shared library, the
other is a C++ python extension. My python extension needs to link to the
shared library, and hence the shared library needs to be built first.
However, bjam won't let me specify the library (test.a) as a requirement for
the python extension because it doesn't exist when it is invoked. It won't
exist until the shared library poject is built. So I am not sure how to
build these two things using a common Jamroot. My Jamroot looks like this:

###### Jamroot #######

import os ; 
BOOST_ROOT = [ os.environ BOOST_ROOT ] ; 
use-project /boost : $(BOOST_ROOT) ;

project test
  : requirements
  <library>/boost/python//boost_python
  <include>some_folder
  ;

# pure C++ shared library
build-project c_lib ;
# python extension
build-project py_ext ;

##############################

Then I have 2 subfolders (c_lib and py_ext) with the following Jamfile's:

###### Jamfile for c_lib project #######

import os ; 

# Declare a library called test
lib test : test.cpp ;

C_LIBS = [ os.environ C_LIBS ] ; 

# copies built library to current directory
install . : test : <location>$(C_LIBS)lib ;

###### Jamfile for py_ext project #######

import os ; 
C_LIBS = [ os.environ C_LIBS ] ; 

project quant
  : requirements
  <library-file>$(C_LIBS)lib/test.a
  ;

# Declare a Python extension called _holiday.
python-extension py_ext : py_ext.cpp ;

# copies built library to current directory
install . : py_ext ;

##############################

This results in the error "error: Unable to find file or target named..."
because test.a does not exist yet. So basically my question is, how do I
properly specify these dependencies here? I realize I am probably doing
something rather stupid, but if someone could point out the error in my ways
I would be extremely grateful. Thanks!

- Matt
-- 
View this message in context: http://www.nabble.com/python-extension-depending-on-other-project-tf4823455.html#a13800157
Sent from the Python - c++-sig mailing list archive at Nabble.com.




More information about the Cplusplus-sig mailing list