📄 python.jam
字号:
{
properties += <link-format>bundle ;
}
properties += <framework>$(PYTHON_FRAMEWORK) ;
}
return $(properties) ;
}
if $(NT)
{
python-nt-sysinclude = [ GLOB $(PYTHON_ROOT) : PC ] ;
}
rule select-nt-python-includes ( toolset variant : properties * )
{
if $(toolset) in $(gcc-compilers)
{
local d = "" ;
if <define>BOOST_DEBUG_PYTHON in $(properties)
{
d = DEBUG_ ;
}
properties += <sysinclude>$(CYGWIN_PYTHON_$(d)ROOT)/include/python$(CYGWIN_PYTHON_$(d)VERSION) ;
}
else
{
properties +=
<sysinclude>$(PYTHON_INCLUDES)
<sysinclude>$(python-nt-sysinclude) # in case the user is using a source installation
;
if [ MATCH (cwpro) : $(toolset) ] && ( $(variant) = debug-python )
{
properties = [ difference $(properties) : <define>_DEBUG ] ; #it warns about redefinition otherwise.
}
else
{
properties += <debug-python><define>_DEBUG ;
}
}
return $(properties) ;
}
PYTHON_PROPERTIES +=
<sysinclude>@boost
<stlport-iostream>on
select-python-library
;
BOOST_PYTHON_V2_PROPERTIES
= $(PYTHON_PROPERTIES)
<metrowerks><*><cxxflags>"-inline deferred"
<cwpro8><*><cxxflags>"-inline deferred" # added for internal testing purposes
<cxx><*><sysinclude>@boost/boost/compatibility/cpp_c_headers
<define>BOOST_PYTHON_DYNAMIC_LIB
;
# Extends the RUN_PATH assignment for targets built under Cygwin so
# that the Python DLL can be found.
rule add-cygwin-python-run-path ( module )
{
if <define>BOOST_DEBUG_PYTHON in $(gBUILD_PROPERTIES)
{
gRUN_LD_LIBRARY_PATH($(module)) += $(CYGWIN_PYTHON_DEBUG_DLL_PATH) ;
}
else
{
gRUN_LD_LIBRARY_PATH($(module)) += $(CYGWIN_PYTHON_DLL_PATH) ;
}
}
# This is the generator function for Python modules. It deals with the
# need to change the name of modules compiled with debugging on. This
# is just a wrapper around the generator for shared libraries,
# dll-files.
rule python-files ( module implib ? : sources * )
{
dll-files $(module) $(implib) : $(sources) : PYD ;
if $(gCURRENT_TOOLSET) in $(gcc-compilers)
{
if $(PYTHON_WINDOWS)
{
add-cygwin-python-run-path $(<[-1]) ;
}
else
{
gRUN_PATH($(module)) += $(GCC_ROOT_DIRECTORY)/lib ;
}
}
}
if $(NT)
{
# Adjust the name of Python modules so that they have the _d
# suffix when compiled with python debugging enabled.
gNAME_ADJUST(PYD) = name-adjust-PYD ;
rule name-adjust-PYD ( pyd implib ? : properties * : toolset variant )
{
# Cygwin python is only happy if compiled modules have a .dll
# extension
if $(toolset) in $(gcc-compilers)
{
pyd = $(pyd:S=.dll) ;
}
else if <define>BOOST_DEBUG_PYTHON in $(properties)
{
pyd = $(pyd:S=)_d$(pyd:S) ;
}
return $(pyd) $(implib) ;
}
}
rule Link-PYD
{
if $(UNIX)
{
LINK_LIBPATH on $(<) = [ join $(gRUN_LD_LIBRARY_PATH($(<))) : $(SPLITPATH) ] ;
}
gRUN_PYTHONPATH($(<)) += $(gLOCATE($(<[1]))) ;
.do-link $(<) : $(>) : PYD ;
}
declare-target-type PYD : <shared-linkable>true ;
gGENERATOR_FUNCTION(PYD) = python-files ;
if $(NT)
{
SUFPYD = .pyd $(SUFDLL[2-]) ;
}
else if $(OS) = MACOSX
{
SUFPYD = .so $(SUFDLL[2-]) ;
}
else
{
SUFPYD = $(SUFDLL) ;
}
PYDMODE = $(DLLMODE) ;
SHARED_TYPES += PYD ;
gTARGET_TYPE_ID(pyd) = PYD ;
gIS_DEPENDENCY(PYD) = TRUE ;
# Declare a python extension.
rule extension ( name : sources + : requirements * : default-BUILD * )
{
requirements += $(BOOST_PYTHON_V2_PROPERTIES) ;
declare-local-target $(name) : $(sources) : $(requirements) : $(default-BUILD) : PYD ;
}
gGENERATOR_FUNCTION(TEST_PYD) = run-test PYD ;
SUFTEST_PYD = .run ;
declare-build-succeed-test RUN_PYD : TEST_PYD ;
# boost-python-runtest target : python-script sources : requirements : local-build : args
#
# declare a python module test $(<).test which builds when out-of-date
#
# pass --python-test-all on the command-line to force rebuilding
rule boost-python-runtest (
target : sources + : requirements * : local-build * : args * )
{
local gRUN_TEST_ARGS = $(args) ;
local pyfiles = [ MATCH ^(.*[.]py)$ : $(sources) ] ;
sources = [ difference $(sources) : $(pyfiles) ] ;
local gRUN_TEST_INPUT_FILES = [ FGristFiles $(pyfiles) ] ;
# tell Jam that the python script is relative to this directory
SEARCH on $(gRUN_TEST_INPUT_FILES) = $(SEARCH_SOURCE) ;
# The user can add additional arguments in PYTHON_TEST_ARGS.
local gRUN_TEST_ARGS2 = $(PYTHON_TEST_ARGS) ;
gRUN_TEST_ARGS2 ?= -v ;
#
# Stick the names of the python script and source files used in
# testing into $(source-files) on the main target. This is kind
# of a hack, because boost-test will be returning the name of the
# main target, but unfortunatedly dump-tests runs during the
# evaluation of boost-test and not during the build phase :(
#
local main-target = [ FGristFiles [ expand-target-names $(target) : RUN_PYD ] ] ;
source-files on $(main-target) = $(gRUN_TEST_INPUT_FILES) ;
local dependencies = [ FGristFiles [ expand-source-names $(sources) ] ] ;
source-files on $(main-target) += $(gTARGET_SOURCES($(dependencies))) ;
local result = [
boost-test $(sources)
: RUN_PYD
: $(requirements)
boost-python-disable-borland
<default>python-intel-use-gcc-stdlib # unless otherwise
# specified, assume the GCC standard
# library is needed for intel
: $(target)
: $(local-build)
] ;
}
rule boost-python-test ( name : sources + : requirements * : default-BUILD * )
{
extension $(name) : $(sources) : $(requirements) <suppress>true : $(4) ;
}
# Returns the executable to use for testing one or more Python modules
rule test-executable(PYD) ( targets-to-test + )
{
# choose the right python executable
local python = $(PYTHON) ;
if $(NT)
{
local d = "" ;
if <define>BOOST_DEBUG_PYTHON in $(gBUILD_PROPERTIES)
{
d = _D ;
}
if $(gCURRENT_TOOLSET) in $(gcc-compilers)
{
python = $(CYGWIN_PYTHON$(d)) ;
}
else
{
python = $(PYTHON$(d)) ;
}
}
return $(python) ;
}
rule check-python-config ( )
{
if --without-python in $(ARGV)
{
gNO_PYTHON_INSTALL = true ;
}
else if ! $(gPYTHON_CONFIG_CHECKED)
{
local dir ;
if $(NT) && $(TOOLS) in $(gcc-compilers)
{
dir = $(CYGWIN_PYTHON_DEBUG_ROOT) $(CYGWIN_PYTHON_ROOT) ;
v = $(CYGWIN_PYTHON_DEBUG_VERSION) $(CYGWIN_PYTHON_VERSION) ;
dir = $(dir)/include/python$(v) ;
dir = /cygwin/$(dir) $(dir) ;
}
dir += $(PYTHON_INCLUDES) ;
# This represents an improvement over the checking that was in
# Boost 1.28.0, but it is still an imperfect hack. For
# Boost.Build v2 we will clean up the rules.
if ! [ GLOB $(dir) : Python.h ]
{
gNO_PYTHON_INSTALL = true ;
ECHO "---------------------------------------------------------------------" ;
ECHO "*** If you don't need Boost.Python, you can ignore this section ***" ;
ECHO "*** pass --without-python to suppress this message in the future ***" ;
ECHO ;
ECHO skipping Boost.Python library build due to missing or incorrect configuration ;
ECHO ;
ECHO "couldn't find Python.h in" \"$(dir:J=" ")\" ;
ECHO ;
ECHO You can configure the location of your python installation by setting: ;
ECHO "PYTHON_VERSION - The 2-part python Major.Minor version number (e.g." ;
ECHO " \"2.2\", NOT \"2.2.1\") - currently" \"$(PYTHON_VERSION)\" ;
ECHO ;
if $(NT)
{
ECHO "PYTHON_ROOT - automatically configured from PYTHON_VERSION if not" ;
ECHO " otherwise set ; currently" \"$(PYTHON_ROOT:J=" ")\" ;
}
else
{
ECHO "PYTHON_ROOT - currently" \"$(PYTHON_ROOT:J=" ")\" ;
}
ECHO ;
ECHO "The following are automatically configured from PYTHON_ROOT if not" ;
ECHO "otherwise set:" ;
ECHO ;
ECHO " PYTHON_LIB_PATH - path to Python library object; currently" ;
ECHO " \""$(PYTHON_LIB_PATH:J=" ")\" ;
if ! $(NT)
{
ECHO " PYTHON_INCLUDES - path to Python #include directories; currently" ;
ECHO " \""$(PYTHON_INCLUDES:J=" ")\" ;
}
else if [ intersection $(TOOLS) : $(gcc-compilers) ]
{
ECHO ;
ECHO " For detailed configuration of Boost.Python for Cygwin GCC" ;
ECHO " under Windows NT please see" ;
ECHO " http://www.boost.org/libs/python/doc/building.html" ;
}
ECHO "---------------------------------------------------------------------" ;
}
gPYTHON_CONFIG_CHECKED = true ;
}
if ! $(gNO_PYTHON_INSTALL)
{
return true ;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -