44
55import os ;
66import modules ;
7+ import feature ;
78
89import python ;
910
@@ -22,73 +23,102 @@ if ! [ python.configured ] && ! ( --without-python in [ modules.peek : ARGV ] )
2223 }
2324}
2425
26+ rule find-py3-version
27+ {
28+ local versions = [ feature.values python ] ;
29+ local py3ver ;
30+ for local v in $(versions)
31+ {
32+ if $(v) >= 3.0
33+ {
34+ py3ver = $(v) ;
35+ }
36+ }
37+ return $(py3ver) ;
38+ }
39+
40+ py3-version = [ find-py3-version ] ;
41+
2542project boost/python
2643 : source-location ../src
2744 ;
2845
2946rule cond ( test ? : yes * : no * ) { if $(test) { return $(yes) ; } else { return $(no) ; } }
3047rule unless ( test ? : yes * : no * ) { if ! $(test) { return $(yes) ; } else { return $(no) ; } }
3148
32- lib boost_python
33- : # sources
34- numeric.cpp
35- list.cpp
36- long.cpp
37- dict.cpp
38- tuple.cpp
39- str.cpp
40- slice.cpp
49+ rule lib_boost_python ( is-py3 ? )
50+ {
4151
42- converter/from_python.cpp
43- converter/registry.cpp
44- converter/type_id.cpp
45- object/enum.cpp
46- object/class.cpp
47- object/function.cpp
48- object/inheritance.cpp
49- object/life_support.cpp
50- object/pickle_support.cpp
51- errors.cpp
52- module.cpp
53- converter/builtin_converters.cpp
54- converter/arg_to_python_base.cpp
55- object/iterator.cpp
56- object/stl_iterator.cpp
57- object_protocol.cpp
58- object_operators.cpp
59- wrapper.cpp
60- import.cpp
61- exec.cpp
62- object/function_doc_signature.cpp
63- : # requirements
64- <link>static:<define>BOOST_PYTHON_STATIC_LIB
65- <define>BOOST_PYTHON_SOURCE
66-
67- # On Windows, all code using Python has to link to the Python
68- # import library.
69- #
70- # On *nix we never link libboost_python to libpython. When
71- # extending Python, all Python symbols are provided by the
72- # Python interpreter executable. When embedding Python, the
73- # client executable is expected to explicitly link to
74- # /python//python (the target representing libpython) itself.
75- #
76- # python_for_extensions is a target defined by Boost.Build to
77- # provide the Python include paths, and on Windows, the Python
78- # import library, as usage requirements.
79- [ cond [ python.configured ] : <library>/python//python_for_extensions ]
80-
81- # we prevent building when there is no python available
82- # as it's not possible anyway, and to cause dependents to
83- # fail to build
84- [ unless [ python.configured ] : <build>no ]
52+ lib [ cond $(is-py3) : boost_python3 : boost_python ]
53+ : # sources
54+ numeric.cpp
55+ list.cpp
56+ long.cpp
57+ dict.cpp
58+ tuple.cpp
59+ str.cpp
60+ slice.cpp
8561
86- <python-debugging>on:<define>BOOST_DEBUG_PYTHON
87- : # default build
88- <link>shared
89- : # usage requirements
90- <link>static:<define>BOOST_PYTHON_STATIC_LIB
91- <python-debugging>on:<define>BOOST_DEBUG_PYTHON
92- ;
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 ]
93105
106+ <python-debugging>on:<define>BOOST_DEBUG_PYTHON
107+ [ cond $(is-py3) : <python>$(py3-version) ]
108+ : # default build
109+ <link>shared
110+ : # usage requirements
111+ <link>static:<define>BOOST_PYTHON_STATIC_LIB
112+ <python-debugging>on:<define>BOOST_DEBUG_PYTHON
113+ ;
114+
115+ }
116+
117+ lib_boost_python ;
94118boost-install boost_python ;
119+
120+ if $(py3-version)
121+ {
122+ lib_boost_python yes ;
123+ boost-install boost_python3 ;
124+ }
0 commit comments