Skip to content

Commit 84c9644

Browse files
committed
Add NumPy support to the BB-based build logic.
1 parent dc8d68d commit 84c9644

9 files changed

Lines changed: 73 additions & 18 deletions

File tree

build/Jamfile

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,49 @@ rule lib_boost_python ( is-py3 ? )
138138
<link>static:<define>BOOST_PYTHON_STATIC_LIB
139139
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
140140
;
141+
}
141142

143+
rule lib_boost_numpy ( is-py3 ? )
144+
{
145+
lib [ cond $(is-py3) : boost_numpy3 : boost_numpy ]
146+
: # sources
147+
numpy/dtype.cpp
148+
numpy/matrix.cpp
149+
numpy/ndarray.cpp
150+
numpy/numpy.cpp
151+
numpy/scalars.cpp
152+
numpy/ufunc.cpp
153+
: # requirements
154+
[ cond [ python.numpy ] : <library>/python//python_for_extensions ]
155+
[ unless [ python.numpy ] : <build>no ]
156+
<library>boost_python
157+
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
158+
[ cond $(is-py3) : <python>$(py3-version) ]
159+
: # default build
160+
<link>shared
161+
: # usage requirements
162+
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
163+
;
142164
}
143165

144166
lib_boost_python ;
145-
boost-install boost_python ;
146-
167+
lib_boost_numpy ;
147168
if $(py3-version)
148169
{
149170
lib_boost_python yes ;
150-
boost-install boost_python3 ;
171+
lib_boost_numpy yes ;
172+
}
173+
174+
libraries = boost_python ;
175+
libraries3 = boost_python3 ;
176+
if [ python.numpy ]
177+
{
178+
libraries += boost_numpy ;
179+
libraries3 += boost_numpy3 ;
180+
}
181+
182+
boost-install $(libraries) ;
183+
if $(py3-version)
184+
{
185+
boost-install $(libraries3) ;
151186
}

doc/Jamfile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44
# Distributed under the Boost Software License, Version 1.0. (See accompanying
55
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
66

7+
import boostbook ;
8+
import quickbook ;
9+
import docutils ;
10+
import os ;
11+
712
path-constant here : . ;
813
path-constant images : html/images ;
914

10-
1115
project python/doc
1216
: requirements
1317
-<xsl:param>boost.defaults=Boost
@@ -17,9 +21,16 @@ project python/doc
1721
<format>html:<xsl:param>chunk.section.depth=1
1822
;
1923

20-
import boostbook ;
21-
import quickbook ;
22-
import docutils ;
24+
make numpy : numpy/index.rst : @sphinx-build ;
25+
26+
if [ os.name ] = NT
27+
{
28+
actions sphinx-build { chdir numpy && make clean && make html}
29+
}
30+
else
31+
{
32+
actions sphinx-build { make -C numpy clean html}
33+
}
2334

2435
boostbook python : python.qbk
2536
: <format>html:<name>$(here)/html
@@ -51,5 +62,5 @@ html article : article.rst
5162
###############################################################################
5263
alias boostdoc ;
5364
explicit boostdoc ;
54-
alias boostrelease : python tutorial reference article ;
65+
alias boostrelease : python tutorial reference numpy article ;
5566
explicit boostrelease ;

doc/numpy/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = _build
9+
HTMLDIR = ../numpy/html
910

1011
# Internal variables.
1112
PAPEROPT_a4 = -D latex_paper_size=a4
@@ -39,9 +40,9 @@ clean:
3940
-rm -rf $(BUILDDIR)/*
4041

4142
html:
42-
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
43+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(HTMLDIR)
4344
@echo
44-
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
45+
@echo "Build finished. The HTML pages are in $(HTMLDIR)."
4546

4647
dirhtml:
4748
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml

doc/numpy/_static/style.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
}
2828

2929
.admonition-title { font-weight: bold;}
30-
#table-of-contents
30+
.toctree-wrapper
3131
{
3232
border: 1px solid #dcdcdc;
3333
padding: 1em;
3434
margin: 0 2em;
3535
}
36-
#table-of-contents .caption,
37-
#table-of-contents .topic-title { font-weight: bold;}
36+
.toctree-wrapper .caption,
37+
.toctree-wrapper .topic-title { font-weight: bold;}
3838

doc/numpy/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Welcome to the documentation of the Boost.Python NumPy extension!
77
=================================================================
88

99
.. toctree::
10-
:caption: Table of Contents
1110
:name: mastertoc
1211
:maxdepth: 2
1312

doc/numpy/make.bat

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ if "%SPHINXBUILD%" == "" (
66
set SPHINXBUILD=sphinx-build
77
)
88
set BUILDDIR=_build
9+
set HTMLDIR=../html/numpy
910
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
1011
if NOT "%PAPER%" == "" (
1112
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
@@ -41,10 +42,10 @@ if "%1" == "clean" (
4142
)
4243

4344
if "%1" == "html" (
44-
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
45+
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %HTMLDIR%
4546
if errorlevel 1 exit /b 1
4647
echo.
47-
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
48+
echo.Build finished. The HTML pages are in %HTMLDIR%.
4849
goto end
4950
)
5051

doc/numpy/reference/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ Boost.Python NumPy extension Reference
22
======================================
33

44
.. toctree::
5-
:caption: Table of Contents
65
:name: reftoc
76
:maxdepth: 2
87

doc/numpy/tutorial/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ Boost.Python NumPy extension Tutorial
22
=====================================
33

44
.. toctree::
5-
:caption: Table of Contents
65
:name: tuttoc
76
:maxdepth: 2
87

test/Jamfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,4 +237,14 @@ bpl-test crossmod_opaque
237237
[ py-compile-fail ./as_to_python_function.cpp ]
238238
[ py-compile-fail ./object_fail1.cpp ]
239239

240+
# --- NumPy tests ---
241+
242+
[ numpy-test numpy/dtype ]
243+
[ numpy-test numpy/ufunc ]
244+
[ numpy-test numpy/templates ]
245+
[ numpy-test numpy/ndarray ]
246+
[ numpy-test numpy/indexing ]
247+
[ numpy-test numpy/shapes ]
248+
249+
240250
;

0 commit comments

Comments
 (0)