[C++-sig] Re: Re: Re: Problem with vc++ 7

Mike Rovner mike at bindkey.com
Tue Nov 26 20:09:30 CET 2002


"David Abrahams" <dave at boost-consulting.com> wrote in message
news:ufztp2ohd.fsf at boost-consulting.com...
> "Mike Rovner" <mike at bindkey.com> writes:
>
> > "David Abrahams" <dave at boost-consulting.com> wrote in message
> > news:ubs4d72tg.fsf at boost-consulting.com...
> >> > How to include my files from c:/a/b/c/include dir and libs (say
> >> > c:/d/e/f.lib)?
> >> >
> >> > When I say:
> >> >     extension t1 : t1.cpp
> >> >     <dll>../build/boost_python
> >>
> >> You need a colon here. Sources and dependencies are a separate
> >> argument from requirements
> >>
> >> >     <include>c:/a/b/c/include
> >
> > OK. It works and reveal an error in boost/example/Jamfile (missed
colons).

My fault! I misinterpreted <dll>... as dependency and placed a colon before
it.
Now it all works fine (vc6).

> >> Please submit a patch which explains whatever you think needs to be
> >> clarified.
> >
> > On my way.

That is my first attempt to suggest changes, so please be patient and lead
me through.

Suggested text:

Using bjam to build python extensions
=========================

bjam is a standard tool for building boostlibrary itself. Thus it is
preferable way to build python extensions based on boost.python with bjam.
Basic example listed in tutorial.

However if you want to add external libraries in your extension (that is why
you use boost.python, isn't it?), you must add them to dependency section:

# Specify our location in the boost project hierarchy
subproject libs/python/MyExtension ; ##################### if you put your
dir in boost hierarchy

# Include definitions needed for Python modules
SEARCH on python.jam = $(BOOST_BUILD_PATH) ;
include python.jam ;

# Declare a Python extension
extension Example
:  # sources
   Example.cpp
   <dll>../build/boost_python

:  # dependencies
   <include>FULL_PATH_INCLUDE_DIR
   <include>RELATIVE_PATH_INCLUDE_DIR
   <library-file>FULL_PATH.lib
   <library-path>PATH_TO_LIB
   <library-file>LIBNAME.lib
  ;

# Declare a test for the extension module
boost-python-runtest test1
    :  # Python test driver
    test1.py
    # extension modules to use
    <pyd>Example ;

Keeping your projects under boost hierarchy is often inconvenient. You may
adjust Jamfile to build your extension from any place by
- specifying BOOST_BUILD_PATH environment variable pointing to the root of
your boost tree or
- copying boost-build.jam file to some place in (or above) your source
directory
and changing the line subproject to the
    project-root ;
in the Jamfile.
---------------
See also
http://www.python.org/cgi-bin/moinmoin/boost_2epython_2fBuildingExtensions

BTW, still open question: How to specify library in a platform-independent
way?








More information about the Cplusplus-sig mailing list