]>
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 | import python ; |
11 | ||
12 | if ! [ python.configured ] && ! ( --without-python in [ modules.peek : ARGV ] ) | |
13 | { | |
14 | # Attempt default configuration of python | |
15 | import toolset : using ; | |
16 | using python ; | |
17 | } | |
18 | ||
19 | if [ python.configured ] || ( --without-python in [ modules.peek : ARGV ] ) | |
20 | { | |
21 | alias config-warning ; | |
22 | } | |
23 | else | |
24 | { | |
25 | message config-warning | |
26 | : "warning: No python installation configured and autoconfiguration" | |
27 | : "note: failed. See http://www.boost.org/libs/python/doc/building.html" | |
28 | : "note: for configuration instructions or pass --without-python to" | |
29 | : "note: suppress this message and silently skip all Boost.Python targets" | |
30 | ; | |
31 | } | |
32 | ||
7c673cae FG |
33 | project boost/python |
34 | : source-location ../src | |
35 | ; | |
36 | ||
37 | rule cond ( test ? : yes * : no * ) { if $(test) { return $(yes) ; } else { return $(no) ; } } | |
38 | rule unless ( test ? : yes * : no * ) { if ! $(test) { return $(yes) ; } else { return $(no) ; } } | |
b32b8144 | 39 | local rule eq ( a : b ) { if $(a) = $(b) { return 1 ; } } |
7c673cae | 40 | |
11fdf7f2 TL |
41 | lib boost_python |
42 | : # sources | |
43 | list.cpp | |
44 | long.cpp | |
45 | dict.cpp | |
46 | tuple.cpp | |
47 | str.cpp | |
48 | slice.cpp | |
49 | ||
50 | converter/from_python.cpp | |
51 | converter/registry.cpp | |
52 | converter/type_id.cpp | |
53 | object/enum.cpp | |
54 | object/class.cpp | |
55 | object/function.cpp | |
56 | object/inheritance.cpp | |
57 | object/life_support.cpp | |
58 | object/pickle_support.cpp | |
59 | errors.cpp | |
60 | module.cpp | |
61 | converter/builtin_converters.cpp | |
62 | converter/arg_to_python_base.cpp | |
63 | object/iterator.cpp | |
64 | object/stl_iterator.cpp | |
65 | object_protocol.cpp | |
66 | object_operators.cpp | |
67 | wrapper.cpp | |
68 | import.cpp | |
69 | exec.cpp | |
70 | object/function_doc_signature.cpp | |
71 | : # requirements | |
72 | <link>static:<define>BOOST_PYTHON_STATIC_LIB | |
73 | <define>BOOST_PYTHON_SOURCE | |
74 | ||
75 | # On Windows, all code using Python has to link to the Python | |
76 | # import library. | |
77 | # | |
78 | # On *nix we never link libboost_python to libpython. When | |
79 | # extending Python, all Python symbols are provided by the | |
80 | # Python interpreter executable. When embedding Python, the | |
81 | # client executable is expected to explicitly link to | |
82 | # /python//python (the target representing libpython) itself. | |
83 | # | |
84 | # python_for_extensions is a target defined by Boost.Build to | |
85 | # provide the Python include paths, and on Windows, the Python | |
86 | # import library, as usage requirements. | |
87 | [ cond [ python.configured ] : <library>/python//python_for_extensions ] | |
88 | ||
89 | # we prevent building when there is no python available | |
90 | # as it's not possible anyway, and to cause dependents to | |
91 | # fail to build | |
92 | [ unless [ python.configured ] : <build>no ] | |
93 | <dependency>config-warning | |
94 | <python-debugging>on:<define>BOOST_DEBUG_PYTHON | |
95 | -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag | |
20effc67 | 96 | <tag>@python-tag |
11fdf7f2 TL |
97 | <conditional>@python.require-py |
98 | ||
99 | : # default build | |
100 | <link>shared | |
101 | : # usage requirements | |
102 | <link>static:<define>BOOST_PYTHON_STATIC_LIB | |
103 | <python-debugging>on:<define>BOOST_DEBUG_PYTHON | |
104 | ; | |
105 | ||
106 | numpy-include = [ python.numpy-include ] ; | |
107 | lib boost_numpy | |
108 | : # sources | |
109 | numpy/dtype.cpp | |
110 | numpy/matrix.cpp | |
111 | numpy/ndarray.cpp | |
112 | numpy/numpy.cpp | |
113 | numpy/scalars.cpp | |
114 | numpy/ufunc.cpp | |
115 | : # requirements | |
116 | <link>static:<define>BOOST_NUMPY_STATIC_LIB | |
117 | <define>BOOST_NUMPY_SOURCE | |
118 | [ cond [ python.numpy ] : <library>/python//python_for_extensions ] | |
119 | [ unless [ python.numpy ] : <build>no ] | |
1e59de90 | 120 | <library>/python//numpy |
11fdf7f2 TL |
121 | <library>boost_python |
122 | <python-debugging>on:<define>BOOST_DEBUG_PYTHON | |
123 | -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag | |
20effc67 | 124 | <tag>@python-tag |
11fdf7f2 TL |
125 | <conditional>@python.require-py |
126 | ||
127 | : # default build | |
128 | <link>shared | |
129 | : # usage requirements | |
130 | <link>static:<define>BOOST_NUMPY_STATIC_LIB | |
131 | <python-debugging>on:<define>BOOST_DEBUG_PYTHON | |
132 | ; | |
92f5a8d4 TL |
133 | |
134 | # boost-install creates `stage` and `install` targets | |
135 | # | |
136 | # `stage` stages (builds and copies into `stage/lib`) the given libraries | |
137 | # `boost_python` and `boost_numpy` and their dependencies and is similar | |
138 | # to issuing `b2 --with-python stage` from top level | |
139 | # | |
140 | # `install` installs the two libraries and their dependencies and is similar | |
141 | # to issuing `b2 --with-python install` from top level | |
142 | ||
20effc67 TL |
143 | if [ python.configured ] |
144 | { | |
145 | if [ python.numpy ] | |
146 | { | |
147 | boost-install boost_python boost_numpy ; | |
148 | } | |
149 | else | |
150 | { | |
151 | boost-install boost_python ; | |
152 | } | |
92f5a8d4 TL |
153 | } |
154 | else | |
155 | { | |
156 | ||
157 | # When Python isn't configured, the above `boost-install` is not executed, | |
158 | # so we create empty `stage` and `install` targets that do nothing but issue | |
159 | # a warning message unless `--without-python` is given | |
160 | ||
161 | alias stage : config-warning ; | |
162 | explicit stage ; | |
163 | ||
164 | alias install : config-warning ; | |
165 | explicit install ; | |
166 | ||
167 | } |