⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 python.jam

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 JAM
📖 第 1 页 / 共 3 页
字号:
        {            interpreter-cmd = $(fallback-cmd) ;            debug-message falling back to \"$(interpreter-cmd)\" ;        }    }    includes = [ path-to-native $(includes) ] ;    libraries = [ path-to-native $(libraries) ] ;    debug-message "Details of this Python configuration:" ;    debug-message "  interpreter command:" \"$(interpreter-cmd:E=<empty>)\" ;    debug-message "  include path:" \"$(includes:E=<empty>)\" ;    debug-message "  library path:" \"$(libraries:E=<empty>)\" ;    if $(target-os) = windows    {        debug-message "  DLL search path:" \"$(exec-prefix:E=<empty>)\" ;    }    #    # End autoconfiguration sequence.    #    local target-requirements = $(condition) ;    # Add the version, if any, to the target requirements.    if $(version)    {        if ! $(version) in [ feature.values python ]        {            feature.extend python : $(version) ;        }        target-requirements += <python>$(version:E=default) ;    }    target-requirements += <target-os>$(target-os) ;    # See if we can find a framework directory on darwin.    local framework-directory ;    if $(target-os) = darwin    {        # Search upward for the framework directory.        local framework-directory = $(libraries[-1]) ;        while $(framework-directory:D=) && $(framework-directory:D=) != Python.framework        {            framework-directory = $(framework-directory:D) ;        }        if $(framework-directory:D=) = Python.framework        {            debug-message framework directory is \"$(framework-directory)\" ;        }        else        {            debug-message no framework directory found; using library path ;            framework-directory = ;        }    }    local dll-path = $(libraries) ;    # Make sure that we can find the Python DLL on Windows.    if ( $(target-os) = windows ) && $(exec-prefix)    {        dll-path += $(exec-prefix) ;    }    #    # Prepare usage requirements.    #    local usage-requirements = [ system-library-dependencies $(target-os) ] ;    usage-requirements += <include>$(includes) <python.interpreter>$(interpreter-cmd) ;    if <python-debugging>on in $(condition)    {        if $(target-os) = windows        {            # In pyconfig.h, Py_DEBUG is set if _DEBUG is set. If we define            # Py_DEBUG we will get multiple definition warnings.            usage-requirements += <define>_DEBUG ;        }        else        {            usage-requirements += <define>Py_DEBUG ;        }    }    # Global, but conditional, requirements to give access to the interpreter    # for general utilities, like other toolsets, that run Python scripts.    toolset.add-requirements        $(target-requirements:J=,):<python.interpreter>$(interpreter-cmd) ;    # Register the right suffix for extensions.    register-extension-suffix $(extension-suffix) : $(target-requirements) ;    #    # Declare the "python" target. This should really be called    # python_for_embedding.    #    if $(framework-directory)    {        alias python          :          : $(target-requirements)          :          : $(usage-requirements) <framework>$(framework-directory)          ;    }    else    {        declare-libpython-target $(version) : $(target-requirements) ;        # This is an evil hack.  On, Windows, when Python is embedded, nothing        # seems to set up sys.path to include Python's standard library        # (http://article.gmane.org/gmane.comp.python.general/544986). The evil        # here, aside from the workaround necessitated by Python's bug, is that:        #        # a. we're guessing the location of the python standard library from the        #    location of pythonXX.lib        #        # b. we're hijacking the <testing.launcher> property to get the        #    environment variable set up, and the user may want to use it for        #    something else (e.g. launch the debugger).        local set-PYTHONPATH ;        if $(target-os) = windows        {            set-PYTHONPATH = [ common.prepend-path-variable-command PYTHONPATH :                $(libraries:D)/Lib ] ;        }        alias python          :          : $(target-requirements)          :            # Why python.lib must be listed here instead of along with the            # system libs is a mystery, but if we do not do it, on cygwin,            # -lpythonX.Y never appears in the command line (although it does on            # linux).          : $(usage-requirements)            <testing.launcher>$(set-PYTHONPATH)              <library-path>$(libraries) <dll-path>$(dll-path) <library>python.lib          ;    }    # On *nix, we do not want to link either Boost.Python or Python extensions    # to libpython, because the Python interpreter itself provides all those    # symbols. If we linked to libpython, we would get duplicate symbols. So    # declare two targets -- one for building extensions and another for    # embedding.    #    # Unlike most *nix systems, Mac OS X's linker does not permit undefined    # symbols when linking a shared library. So, we still need to link against    # the Python framework, even when building extensions. Note that framework    # builds of Python always use shared libraries, so we do not need to worry    # about duplicate Python symbols.    if $(target-os) in windows cygwin darwin    {        alias python_for_extensions : python : $(target-requirements) ;    }    # On AIX we need Python extensions and Boost.Python to import symbols from    # the Python interpreter. Dynamic libraries opened with dlopen() do not    # inherit the symbols from the Python interpreter.    else if $(target-os) = aix    {        alias python_for_extensions            :            : $(target-requirements)            :            : $(usage-requirements) <linkflags>-Wl,-bI:$(libraries[1])/python.exp            ;    }    else    {        alias python_for_extensions            :            : $(target-requirements)            :            : $(usage-requirements)            ;    }}rule configured ( ){     return $(.configured) ;}type.register PYTHON_EXTENSION : : SHARED_LIB ;local rule register-extension-suffix ( root : condition * ){    local suffix ;    switch [ feature.get-values target-os : $(condition) ]    {        case windows : suffix = pyd ;        case cygwin : suffix = dll ;        case hpux :        {            if [ feature.get-values python : $(condition) ] in 1.5 1.6 2.0 2.1 2.2 2.3 2.4            {                suffix = sl ;            }            else            {                suffix = so ;            }        }        case * : suffix = so ;    }    type.set-generated-target-suffix PYTHON_EXTENSION : $(condition) : <$(root).$(suffix)> ;}# Unset 'lib' prefix for PYTHON_EXTENSIONtype.set-generated-target-prefix PYTHON_EXTENSION : : "" ;rule python-extension ( name : sources * : requirements * : default-build * :                        usage-requirements * ){    if [ configured ]    {        requirements += <use>/python//python_for_extensions ;    }    requirements += <suppress-import-lib>true ;    local project = [ project.current ] ;    targets.main-target-alternative        [ new typed-target $(name) : $(project) : PYTHON_EXTENSION            : [ targets.main-target-sources $(sources) : $(name) ]            : [ targets.main-target-requirements $(requirements) : $(project) ]            : [ targets.main-target-default-build $(default-build) : $(project) ]        ] ;}IMPORT python : python-extension : : python-extension ;# Support for testing.type.register PY : py ;type.register RUN_PYD_OUTPUT ;type.register RUN_PYD : : TEST ;class python-test-generator : generator{    import set ;    rule __init__ ( * : * )    {        generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;        self.composing = true ;    }    rule run ( project name ? : property-set : sources * : multiple ? )    {        local python ;        local other-pythons ;        for local s in $(sources)        {            if [ $(s).type ] = PY            {                if ! $(python)                {                    # First Python source ends up on command line.                    python = $(s) ;                }                else                {                    # Other Python sources become dependencies.                    other-pythons += $(s) ;                }            }        }        local extensions ;        for local s in $(sources)        {            if [ $(s).type ] = PYTHON_EXTENSION            {                extensions += $(s) ;            }        }        local libs ;        for local s in $(sources)        {            if [ type.is-derived [ $(s).type ] LIB ]              && ! $(s) in $(extensions)            {                libs += $(s) ;            }        }        local new-sources ;        for local s in $(sources)        {            if [ type.is-derived [ $(s).type ] CPP ]            {                local name = [ utility.basename [ $(s).name ] ] ;                if $(name) = [ utility.basename [ $(python).name ] ]                {                    name = $(name)_ext ;                }                local extension = [ generators.construct $(project) $(name) :                  PYTHON_EXTENSION : $(property-set) : $(s) $(libs) ] ;                # The important part of usage requirements returned from                # PYTHON_EXTENSION generator are xdll-path properties that will                # allow us to find the python extension at runtime.                property-set = [ $(property-set).add $(extension[1]) ] ;                # Ignore usage requirements. We're a top-level generator and                # nobody is going to use what we generate.                new-sources += $(extension[2-]) ;            }        }        property-set = [ $(property-set).add-raw <dependency>$(other-pythons) ] ;        result = [ construct-result $(python) $(extensions) $(new-sources) :            $(project) $(name) : $(property-set) ] ;    }}generators.register  [ new python-test-generator python.capture-output : : RUN_PYD_OUTPUT ] ;generators.register-standard testing.expect-success  : RUN_PYD_OUTPUT : RUN_PYD ;# There are two different ways of spelling OS names. One is used for [ os.name ]# and the other is used for the <host-os> and <target-os> properties. Until that# is remedied, this sets up a crude mapping from the latter to the former, that# will work *for the purposes of cygwin/NT cross-builds only*. Could not think# of a better name than "translate".#.translate-os-windows = NT ;.translate-os-cygwin = CYGWIN ;local rule translate-os ( src-os ){    local x = $(.translate-os-$(src-os)) [ os.name ] ;    return $(x[1]) ;}# Extract the path to a single ".pyd" source. This is used to build the# PYTHONPATH for running bpl tests.#local rule pyd-pythonpath ( source ){    return [ on $(source) return $(LOCATE) $(SEARCH) ] ;}# The flag settings on testing.capture-output do not apply to python.capture# output at the moment. Redo this explicitly.toolset.flags python.capture-output ARGS <testing.arg> ;rule capture-output ( target : sources * : properties * ){    # Setup up a proper DLL search path. Here, $(sources[1]) is a python module    # and $(sources[2]) is a DLL. Only $(sources[1]) is passed to    # testing.capture-output, so RUN_PATH variable on $(sources[2]) is not    # consulted. Move it over explicitly.    RUN_PATH on $(sources[1]) = [ on $(sources[2-]) return $(RUN_PATH) ] ;    PYTHONPATH  = [ sequence.transform pyd-pythonpath : $(sources[2-]) ] ;    PYTHONPATH += [ feature.get-values pythonpath : $(properties) ] ;    # After test is run, we remove the Python module, but not the Python script.    testing.capture-output $(target) : $(sources[1]) : $(properties) :        $(sources[2-]) ;    # PYTHONPATH is different; it will be interpreted by whichever Python is    # invoked and so must follow path rules for the target os. The only OSes    # where we can run python for other OSes currently are NT and CYGWIN so we    # only need to handle those cases.    local target-os = [ feature.get-values target-os : $(properties) ] ;    # Oddly, host-os is not in properties, so grab the default value.    local host-os = [ feature.defaults host-os ] ;    host-os = $(host-os:G=) ;    if $(target-os) != $(host-os)    {        PYTHONPATH = [ sequence.transform $(host-os)-to-$(target-os)-path :            $(PYTHONPATH) ] ;    }    local path-separator = [ os.path-separator [ translate-os $(target-os) ] ] ;    local set-PYTHONPATH = [ common.variable-setting-command PYTHONPATH :        $(PYTHONPATH:J=$(path-separator)) ] ;    LAUNCHER on $(target) = $(set-PYTHONPATH) [ on $(target) return \"$(PYTHON)\" ] ;}rule bpl-test ( name : sources * : requirements * ){    sources ?= $(name).py $(name).cpp ;    return [ testing.make-test run-pyd : $(sources) /boost/python//boost_python        : $(requirements) : $(name) ] ;}IMPORT $(__name__) : bpl-test : : bpl-test ;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -