2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-26 18:52:26 +00:00

Add NumPy support to the BB-based build logic.

This commit is contained in:
Stefan Seefeld
2016-10-18 16:32:05 -04:00
parent dc8d68d3fc
commit 84c96447e2
9 changed files with 73 additions and 18 deletions

View File

@@ -138,14 +138,49 @@ rule lib_boost_python ( is-py3 ? )
<link>static:<define>BOOST_PYTHON_STATIC_LIB
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
;
}
rule lib_boost_numpy ( is-py3 ? )
{
lib [ cond $(is-py3) : boost_numpy3 : boost_numpy ]
: # sources
numpy/dtype.cpp
numpy/matrix.cpp
numpy/ndarray.cpp
numpy/numpy.cpp
numpy/scalars.cpp
numpy/ufunc.cpp
: # requirements
[ cond [ python.numpy ] : <library>/python//python_for_extensions ]
[ unless [ python.numpy ] : <build>no ]
<library>boost_python
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
[ cond $(is-py3) : <python>$(py3-version) ]
: # default build
<link>shared
: # usage requirements
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
;
}
lib_boost_python ;
boost-install boost_python ;
lib_boost_numpy ;
if $(py3-version)
{
lib_boost_python yes ;
boost-install boost_python3 ;
lib_boost_numpy yes ;
}
libraries = boost_python ;
libraries3 = boost_python3 ;
if [ python.numpy ]
{
libraries += boost_numpy ;
libraries3 += boost_numpy3 ;
}
boost-install $(libraries) ;
if $(py3-version)
{
boost-install $(libraries3) ;
}

View File

@@ -4,10 +4,14 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import boostbook ;
import quickbook ;
import docutils ;
import os ;
path-constant here : . ;
path-constant images : html/images ;
project python/doc
: requirements
-<xsl:param>boost.defaults=Boost
@@ -17,9 +21,16 @@ project python/doc
<format>html:<xsl:param>chunk.section.depth=1
;
import boostbook ;
import quickbook ;
import docutils ;
make numpy : numpy/index.rst : @sphinx-build ;
if [ os.name ] = NT
{
actions sphinx-build { chdir numpy && make clean && make html}
}
else
{
actions sphinx-build { make -C numpy clean html}
}
boostbook python : python.qbk
: <format>html:<name>$(here)/html
@@ -51,5 +62,5 @@ html article : article.rst
###############################################################################
alias boostdoc ;
explicit boostdoc ;
alias boostrelease : python tutorial reference article ;
alias boostrelease : python tutorial reference numpy article ;
explicit boostrelease ;

View File

@@ -6,6 +6,7 @@ SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
HTMLDIR = ../numpy/html
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
@@ -39,9 +40,9 @@ clean:
-rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(HTMLDIR)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
@echo "Build finished. The HTML pages are in $(HTMLDIR)."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml

View File

@@ -27,12 +27,12 @@
}
.admonition-title { font-weight: bold;}
#table-of-contents
.toctree-wrapper
{
border: 1px solid #dcdcdc;
padding: 1em;
margin: 0 2em;
}
#table-of-contents .caption,
#table-of-contents .topic-title { font-weight: bold;}
.toctree-wrapper .caption,
.toctree-wrapper .topic-title { font-weight: bold;}

View File

@@ -7,7 +7,6 @@ Welcome to the documentation of the Boost.Python NumPy extension!
=================================================================
.. toctree::
:caption: Table of Contents
:name: mastertoc
:maxdepth: 2

View File

@@ -6,6 +6,7 @@ if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set HTMLDIR=../html/numpy
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
@@ -41,10 +42,10 @@ if "%1" == "clean" (
)
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %HTMLDIR%
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
echo.Build finished. The HTML pages are in %HTMLDIR%.
goto end
)

View File

@@ -2,7 +2,6 @@ Boost.Python NumPy extension Reference
======================================
.. toctree::
:caption: Table of Contents
:name: reftoc
:maxdepth: 2

View File

@@ -2,7 +2,6 @@ Boost.Python NumPy extension Tutorial
=====================================
.. toctree::
:caption: Table of Contents
:name: tuttoc
:maxdepth: 2

View File

@@ -237,4 +237,14 @@ bpl-test crossmod_opaque
[ py-compile-fail ./as_to_python_function.cpp ]
[ py-compile-fail ./object_fail1.cpp ]
# --- NumPy tests ---
[ numpy-test numpy/dtype ]
[ numpy-test numpy/ufunc ]
[ numpy-test numpy/templates ]
[ numpy-test numpy/ndarray ]
[ numpy-test numpy/indexing ]
[ numpy-test numpy/shapes ]
;