1 # Copyright David Abrahams 2001-2006. Distributed under the Boost
2 # Software License, Version 1.0. (See accompanying
3 # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
13 if ! [ python.configured ] && ! ( --without-python in [ modules.peek : ARGV ] )
15 # Attempt default configuration of python
16 import toolset : using ;
20 if [ python.configured ] || ( --without-python in [ modules.peek : ARGV ] )
22 alias config-warning ;
26 message config-warning
27 : "warning: No python installation configured and autoconfiguration"
28 : "note: failed. See http://www.boost.org/libs/python/doc/building.html"
29 : "note: for configuration instructions or pass --without-python to"
30 : "note: suppress this message and silently skip all Boost.Python targets"
34 py2-version = [ py-version 2 ] ;
35 py3-version = [ py-version 3 ] ;
38 : source-location ../src
41 rule cond ( test ? : yes * : no * ) { if $(test) { return $(yes) ; } else { return $(no) ; } }
42 rule unless ( test ? : yes * : no * ) { if ! $(test) { return $(yes) ; } else { return $(no) ; } }
43 local rule eq ( a : b ) { if $(a) = $(b) { return 1 ; } }
45 lib_boost_python(2) = boost_python ;
46 lib_boost_python(3) = boost_python3 ;
48 lib_boost_python($(py2-version)) = $(lib_boost_python(2)) ;
49 lib_boost_python($(py3-version)) = $(lib_boost_python(3)) ;
51 rule lib_boost_python ( version )
53 lib $(lib_boost_python($(version)))
62 converter/from_python.cpp
63 converter/registry.cpp
68 object/inheritance.cpp
69 object/life_support.cpp
70 object/pickle_support.cpp
73 converter/builtin_converters.cpp
74 converter/arg_to_python_base.cpp
76 object/stl_iterator.cpp
82 object/function_doc_signature.cpp
84 <link>static:<define>BOOST_PYTHON_STATIC_LIB
85 <define>BOOST_PYTHON_SOURCE
87 # On Windows, all code using Python has to link to the Python
90 # On *nix we never link libboost_python to libpython. When
91 # extending Python, all Python symbols are provided by the
92 # Python interpreter executable. When embedding Python, the
93 # client executable is expected to explicitly link to
94 # /python//python (the target representing libpython) itself.
96 # python_for_extensions is a target defined by Boost.Build to
97 # provide the Python include paths, and on Windows, the Python
98 # import library, as usage requirements.
99 [ cond [ python.configured ] : <library>/python//python_for_extensions ]
101 # we prevent building when there is no python available
102 # as it's not possible anyway, and to cause dependents to
104 [ unless [ python.configured ] : <build>no ]
105 <dependency>config-warning
107 <python-debugging>on:<define>BOOST_DEBUG_PYTHON
110 -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
111 <tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag
113 <conditional>@python.require-py
117 : # usage requirements
118 <link>static:<define>BOOST_PYTHON_STATIC_LIB
119 <python-debugging>on:<define>BOOST_DEBUG_PYTHON
123 lib_boost_numpy(2) = boost_numpy ;
124 lib_boost_numpy(3) = boost_numpy3 ;
126 lib_boost_numpy($(py2-version)) = $(lib_boost_numpy(2)) ;
127 lib_boost_numpy($(py3-version)) = $(lib_boost_numpy(3)) ;
129 rule lib_boost_numpy ( version )
131 numpy-include = [ python.numpy-include ] ;
132 lib $(lib_boost_numpy($(version)))
141 <link>static:<define>BOOST_NUMPY_STATIC_LIB
142 <define>BOOST_NUMPY_SOURCE
143 [ cond [ python.numpy ] : <library>/python//python_for_extensions ]
144 [ unless [ python.numpy ] : <build>no ]
145 <include>$(numpy-include)
146 <library>$(lib_boost_python($(version)))
147 <python-debugging>on:<define>BOOST_DEBUG_PYTHON
150 -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
151 <tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag
153 <conditional>@python.require-py
157 : # usage requirements
158 <link>static:<define>BOOST_NUMPY_STATIC_LIB
159 <python-debugging>on:<define>BOOST_DEBUG_PYTHON
169 lib_boost_python $(py$(N)-version) ;
170 libraries += $(lib_boost_python($(py$(N)-version))) ;
174 alias $(lib_boost_python($(N))) ;
176 if $(py$(N)-version) && [ python.numpy ]
178 lib_boost_numpy $(py$(N)-version) ;
179 libraries += $(lib_boost_numpy($(py$(N)-version))) ;
183 alias $(lib_boost_numpy($(N))) ;
187 boost-install $(libraries) ;