123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- # Copyright David Abrahams 2001-2006. Distributed under the Boost
- # Software License, Version 1.0. (See accompanying
- # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- import os ;
- import indirect ;
- import modules ;
- import feature ;
- import property ;
- import python ;
- if ! [ python.configured ] && ! ( --without-python in [ modules.peek : ARGV ] )
- {
- # Attempt default configuration of python
- import toolset : using ;
- using python ;
- }
- if [ python.configured ] || ( --without-python in [ modules.peek : ARGV ] )
- {
- alias config-warning ;
- }
- else
- {
- message config-warning
- : "warning: No python installation configured and autoconfiguration"
- : "note: failed. See http://www.boost.org/libs/python/doc/building.html"
- : "note: for configuration instructions or pass --without-python to"
- : "note: suppress this message and silently skip all Boost.Python targets"
- ;
- }
- if [ python.configured ]
- {
- project boost/python
- : source-location ../src
- ;
- rule cond ( test ? : yes * : no * ) { if $(test) { return $(yes) ; } else { return $(no) ; } }
- rule unless ( test ? : yes * : no * ) { if ! $(test) { return $(yes) ; } else { return $(no) ; } }
- local rule eq ( a : b ) { if $(a) = $(b) { return 1 ; } }
- lib boost_python
- : # sources
- list.cpp
- long.cpp
- dict.cpp
- tuple.cpp
- str.cpp
- slice.cpp
- converter/from_python.cpp
- converter/registry.cpp
- converter/type_id.cpp
- object/enum.cpp
- object/class.cpp
- object/function.cpp
- object/inheritance.cpp
- object/life_support.cpp
- object/pickle_support.cpp
- errors.cpp
- module.cpp
- converter/builtin_converters.cpp
- converter/arg_to_python_base.cpp
- object/iterator.cpp
- object/stl_iterator.cpp
- object_protocol.cpp
- object_operators.cpp
- wrapper.cpp
- import.cpp
- exec.cpp
- object/function_doc_signature.cpp
- : # requirements
- <link>static:<define>BOOST_PYTHON_STATIC_LIB
- <define>BOOST_PYTHON_SOURCE
- # On Windows, all code using Python has to link to the Python
- # import library.
- #
- # On *nix we never link libboost_python to libpython. When
- # extending Python, all Python symbols are provided by the
- # Python interpreter executable. When embedding Python, the
- # client executable is expected to explicitly link to
- # /python//python (the target representing libpython) itself.
- #
- # python_for_extensions is a target defined by Boost.Build to
- # provide the Python include paths, and on Windows, the Python
- # import library, as usage requirements.
- [ cond [ python.configured ] : <library>/python//python_for_extensions ]
- # we prevent building when there is no python available
- # as it's not possible anyway, and to cause dependents to
- # fail to build
- [ unless [ python.configured ] : <build>no ]
- <dependency>config-warning
- <python-debugging>on:<define>BOOST_DEBUG_PYTHON
- -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
- <tag>@$(__name__).python-tag
- <conditional>@python.require-py
- : # default build
- <link>shared
- : # usage requirements
- <link>static:<define>BOOST_PYTHON_STATIC_LIB
- <python-debugging>on:<define>BOOST_DEBUG_PYTHON
- ;
- numpy-include = [ python.numpy-include ] ;
- lib boost_numpy
- : # sources
- numpy/dtype.cpp
- numpy/matrix.cpp
- numpy/ndarray.cpp
- numpy/numpy.cpp
- numpy/scalars.cpp
- numpy/ufunc.cpp
- : # requirements
- <link>static:<define>BOOST_NUMPY_STATIC_LIB
- <define>BOOST_NUMPY_SOURCE
- [ cond [ python.numpy ] : <library>/python//python_for_extensions ]
- [ unless [ python.numpy ] : <build>no ]
- <include>$(numpy-include)
- <library>boost_python
- <python-debugging>on:<define>BOOST_DEBUG_PYTHON
- -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
- <tag>@$(__name__).python-tag
- <conditional>@python.require-py
- : # default build
- <link>shared
- : # usage requirements
- <link>static:<define>BOOST_NUMPY_STATIC_LIB
- <python-debugging>on:<define>BOOST_DEBUG_PYTHON
- ;
- # boost-install creates `stage` and `install` targets
- #
- # `stage` stages (builds and copies into `stage/lib`) the given libraries
- # `boost_python` and `boost_numpy` and their dependencies and is similar
- # to issuing `b2 --with-python stage` from top level
- #
- # `install` installs the two libraries and their dependencies and is similar
- # to issuing `b2 --with-python install` from top level
- boost-install boost_python boost_numpy ;
- }
- else
- {
- # When Python isn't configured, the above `boost-install` is not executed,
- # so we create empty `stage` and `install` targets that do nothing but issue
- # a warning message unless `--without-python` is given
- alias stage : config-warning ;
- explicit stage ;
- alias install : config-warning ;
- explicit install ;
- }
|