2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-19 16:32:16 +00:00

Make the library modular usable.

This commit is contained in:
Rene Rivera
2024-03-11 08:38:16 -05:00
committed by Stefan Seefeld
parent 99a5352b5c
commit f6d20e1099
4 changed files with 76 additions and 37 deletions

42
build.jam Normal file
View File

@@ -0,0 +1,42 @@
# Copyright René Ferdinand Rivera Morell 2024
# 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 project ;
project /boost/python
: common-requirements
<source>/boost/align//boost_align
<source>/boost/bind//boost_bind
<source>/boost/config//boost_config
<source>/boost/conversion//boost_conversion
<source>/boost/core//boost_core
<source>/boost/detail//boost_detail
<source>/boost/foreach//boost_foreach
<source>/boost/function//boost_function
<source>/boost/graph//boost_graph
<source>/boost/integer//boost_integer
<source>/boost/iterator//boost_iterator
<source>/boost/lexical_cast//boost_lexical_cast
<source>/boost/mpl//boost_mpl
<source>/boost/numeric_conversion//boost_numeric_conversion
<source>/boost/preprocessor//boost_preprocessor
<source>/boost/property_map//boost_property_map
<source>/boost/smart_ptr//boost_smart_ptr
<source>/boost/static_assert//boost_static_assert
<source>/boost/tuple//boost_tuple
<source>/boost/type_traits//boost_type_traits
<source>/boost/utility//boost_utility
<include>include
;
explicit
[ alias boost_python : build//boost_python ]
[ alias boost_numpy : build//boost_numpy ]
[ alias all : boost_python boost_numpy test ]
;
call-if : boost-library python
: install boost_python boost_numpy
;

View File

@@ -30,7 +30,7 @@ else
;
}
project boost/python
project
: source-location ../src
;
@@ -38,6 +38,17 @@ rule cond ( test ? : yes * : no * ) { if $(test) { return $(yes) ; } else { retu
rule unless ( test ? : yes * : no * ) { if ! $(test) { return $(yes) ; } else { return $(no) ; } }
local rule eq ( a : b ) { if $(a) = $(b) { return 1 ; } }
rule tag ( name : type ? : property-set )
{
if python-tag in [ RULENAMES $(__name__) ]
{
return [ $(__name__).python-tag $(name) : $(type) : $(property-set) ] ;
}
}
if [ python.configured ]
{
lib boost_python
: # sources
list.cpp
@@ -92,8 +103,8 @@ lib boost_python
[ unless [ python.configured ] : <build>no ]
<dependency>config-warning
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
-<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
<tag>@python-tag
-<tag>@%boostcpp.tag
<tag>@tag
<conditional>@python.require-py
: # default build
@@ -103,6 +114,17 @@ lib boost_python
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
;
}
else
{
alias boost_python : config-warning ;
}
if [ python.configured ] && [ python.numpy ]
{
numpy-include = [ python.numpy-include ] ;
lib boost_numpy
: # sources
@@ -120,8 +142,8 @@ lib boost_numpy
<library>/python//numpy
<library>boost_python
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
-<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
<tag>@python-tag
-<tag>@%boostcpp.tag
<tag>@tag
<conditional>@python.require-py
: # default build
@@ -131,37 +153,10 @@ lib boost_numpy
<python-debugging>on:<define>BOOST_DEBUG_PYTHON
;
# boost-install creates `stage` and `install` targets
#
# `stage` stages (builds and copies into `stage/lib`) the given libraries
# `boost_python` and `boost_numpy` and their dependencies and is similar
# to issuing `b2 --with-python stage` from top level
#
# `install` installs the two libraries and their dependencies and is similar
# to issuing `b2 --with-python install` from top level
if [ python.configured ]
{
if [ python.numpy ]
{
boost-install boost_python boost_numpy ;
}
else
{
boost-install boost_python ;
}
}
else
{
# When Python isn't configured, the above `boost-install` is not executed,
# so we create empty `stage` and `install` targets that do nothing but issue
# a warning message unless `--without-python` is given
alias stage : config-warning ;
explicit stage ;
alias install : config-warning ;
explicit install ;
alias boost_numpy : config-warning ;
}

View File

@@ -3,7 +3,7 @@
# Examples
This directory contains various examples using Boost.Python.
You may compile these using the `bjam` command either in this directory
You may compile these using the `b2` command either in this directory
or in any of the subdirectories.
You may need to adjust the paths in the Jamroot file if Boost.Python
is not installed in a default location.

View File

@@ -2,14 +2,16 @@
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.0.1 ;
import-search /boost/config/checks ;
import python ;
import os ;
import ../../config/checks/config : requires ;
import config : requires ;
lib socket ;
use-project /boost/python : ../build ;
project /boost/python/test
project
: requirements
<toolset>gcc:<cxxflags>-Wextra
<target-os>qnxnto:<library>socket