]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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) | |
4 | ||
5 | import os ; | |
6 | import indirect ; | |
7 | import modules ; | |
8 | import feature ; | |
b32b8144 | 9 | import property ; |
7c673cae FG |
10 | |
11 | import python ; | |
12 | ||
13 | if ! [ python.configured ] && ! ( --without-python in [ modules.peek : ARGV ] ) | |
14 | { | |
15 | # Attempt default configuration of python | |
16 | import toolset : using ; | |
17 | using python ; | |
18 | } | |
19 | ||
20 | if [ python.configured ] || ( --without-python in [ modules.peek : ARGV ] ) | |
21 | { | |
22 | alias config-warning ; | |
23 | } | |
24 | else | |
25 | { | |
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" | |
31 | ; | |
32 | } | |
33 | ||
b32b8144 FG |
34 | py2-version = [ py-version 2 ] ; |
35 | py3-version = [ py-version 3 ] ; | |
7c673cae FG |
36 | |
37 | project boost/python | |
38 | : source-location ../src | |
39 | ; | |
40 | ||
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) ; } } | |
b32b8144 | 43 | local rule eq ( a : b ) { if $(a) = $(b) { return 1 ; } } |
7c673cae | 44 | |
b32b8144 FG |
45 | lib_boost_python(2) = boost_python ; |
46 | lib_boost_python(3) = boost_python3 ; | |
7c673cae | 47 | |
b32b8144 FG |
48 | lib_boost_python($(py2-version)) = $(lib_boost_python(2)) ; |
49 | lib_boost_python($(py3-version)) = $(lib_boost_python(3)) ; | |
50 | ||
51 | rule lib_boost_python ( version ) | |
52 | { | |
53 | lib $(lib_boost_python($(version))) | |
7c673cae | 54 | : # sources |
7c673cae FG |
55 | list.cpp |
56 | long.cpp | |
57 | dict.cpp | |
58 | tuple.cpp | |
59 | str.cpp | |
60 | slice.cpp | |
61 | ||
62 | converter/from_python.cpp | |
63 | converter/registry.cpp | |
64 | converter/type_id.cpp | |
65 | object/enum.cpp | |
66 | object/class.cpp | |
67 | object/function.cpp | |
68 | object/inheritance.cpp | |
69 | object/life_support.cpp | |
70 | object/pickle_support.cpp | |
71 | errors.cpp | |
72 | module.cpp | |
73 | converter/builtin_converters.cpp | |
74 | converter/arg_to_python_base.cpp | |
75 | object/iterator.cpp | |
76 | object/stl_iterator.cpp | |
77 | object_protocol.cpp | |
78 | object_operators.cpp | |
79 | wrapper.cpp | |
80 | import.cpp | |
81 | exec.cpp | |
82 | object/function_doc_signature.cpp | |
83 | : # requirements | |
84 | <link>static:<define>BOOST_PYTHON_STATIC_LIB | |
85 | <define>BOOST_PYTHON_SOURCE | |
86 | ||
87 | # On Windows, all code using Python has to link to the Python | |
88 | # import library. | |
89 | # | |
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. | |
95 | # | |
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 ] | |
100 | ||
101 | # we prevent building when there is no python available | |
102 | # as it's not possible anyway, and to cause dependents to | |
103 | # fail to build | |
104 | [ unless [ python.configured ] : <build>no ] | |
105 | <dependency>config-warning | |
106 | ||
107 | <python-debugging>on:<define>BOOST_DEBUG_PYTHON | |
b32b8144 | 108 | <python>$(version) |
7c673cae FG |
109 | |
110 | -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag | |
111 | <tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag | |
112 | ||
b32b8144 FG |
113 | <conditional>@python.require-py |
114 | ||
7c673cae FG |
115 | : # default build |
116 | <link>shared | |
117 | : # usage requirements | |
118 | <link>static:<define>BOOST_PYTHON_STATIC_LIB | |
119 | <python-debugging>on:<define>BOOST_DEBUG_PYTHON | |
120 | ; | |
121 | } | |
122 | ||
b32b8144 FG |
123 | lib_boost_numpy(2) = boost_numpy ; |
124 | lib_boost_numpy(3) = boost_numpy3 ; | |
125 | ||
126 | lib_boost_numpy($(py2-version)) = $(lib_boost_numpy(2)) ; | |
127 | lib_boost_numpy($(py3-version)) = $(lib_boost_numpy(3)) ; | |
128 | ||
129 | rule lib_boost_numpy ( version ) | |
7c673cae FG |
130 | { |
131 | numpy-include = [ python.numpy-include ] ; | |
b32b8144 | 132 | lib $(lib_boost_numpy($(version))) |
7c673cae FG |
133 | : # sources |
134 | numpy/dtype.cpp | |
135 | numpy/matrix.cpp | |
136 | numpy/ndarray.cpp | |
b32b8144 FG |
137 | numpy/numpy.cpp |
138 | numpy/scalars.cpp | |
139 | numpy/ufunc.cpp | |
7c673cae | 140 | : # requirements |
b32b8144 FG |
141 | <link>static:<define>BOOST_NUMPY_STATIC_LIB |
142 | <define>BOOST_NUMPY_SOURCE | |
7c673cae FG |
143 | [ cond [ python.numpy ] : <library>/python//python_for_extensions ] |
144 | [ unless [ python.numpy ] : <build>no ] | |
b32b8144 FG |
145 | <include>$(numpy-include) |
146 | <library>$(lib_boost_python($(version))) | |
7c673cae | 147 | <python-debugging>on:<define>BOOST_DEBUG_PYTHON |
b32b8144 | 148 | <python>$(version) |
7c673cae FG |
149 | |
150 | -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag | |
151 | <tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag | |
152 | ||
b32b8144 FG |
153 | <conditional>@python.require-py |
154 | ||
7c673cae FG |
155 | : # default build |
156 | <link>shared | |
157 | : # usage requirements | |
b32b8144 | 158 | <link>static:<define>BOOST_NUMPY_STATIC_LIB |
7c673cae FG |
159 | <python-debugging>on:<define>BOOST_DEBUG_PYTHON |
160 | ; | |
161 | } | |
162 | ||
b32b8144 | 163 | libraries = ; |
7c673cae | 164 | |
b32b8144 | 165 | for local N in 2 3 |
7c673cae | 166 | { |
b32b8144 FG |
167 | if $(py$(N)-version) |
168 | { | |
169 | lib_boost_python $(py$(N)-version) ; | |
170 | libraries += $(lib_boost_python($(py$(N)-version))) ; | |
171 | } | |
172 | else | |
173 | { | |
174 | alias $(lib_boost_python($(N))) ; | |
175 | } | |
176 | if $(py$(N)-version) && [ python.numpy ] | |
177 | { | |
178 | lib_boost_numpy $(py$(N)-version) ; | |
179 | libraries += $(lib_boost_numpy($(py$(N)-version))) ; | |
180 | } | |
181 | else | |
182 | { | |
183 | alias $(lib_boost_numpy($(N))) ; | |
184 | } | |
7c673cae FG |
185 | } |
186 | ||
187 | boost-install $(libraries) ; |