예제 #1
0
def register():

    if not type.registered('LIB'):
        type.register('LIB')

    type.register_type('STATIC_LIB', ['lib', 'a'], 'LIB', ['NT', 'CYGWIN'])
    type.register_type('STATIC_LIB', ['a'], 'LIB')

    type.register_type('IMPORT_LIB', [], 'STATIC_LIB')
    type.set_generated_target_suffix('IMPORT_LIB', [], 'lib')

    type.register_type('SHARED_LIB', ['dll'], 'LIB', ['NT', 'CYGWIN'])
    type.register_type('SHARED_LIB', ['so'], 'LIB')

    type.register_type('SEARCHED_LIB', [], 'LIB')
예제 #2
0
def register ():
    
    if not type.registered ('LIB'):
        type.register ('LIB')
    
    type.register_type ('STATIC_LIB', ['lib', 'a'], 'LIB', ['NT', 'CYGWIN'])
    type.register_type ('STATIC_LIB', ['a'], 'LIB')
    
    type.register_type ('IMPORT_LIB', [], 'STATIC_LIB')
    type.set_generated_target_suffix ('IMPORT_LIB', [], 'lib')
    
    type.register_type ('SHARED_LIB', ['dll'], 'LIB', ['NT', 'CYGWIN'])
    type.register_type ('SHARED_LIB', ['so'], 'LIB')
    
    type.register_type ('SEARCHED_LIB', [], 'LIB')
예제 #3
0
# Copyright 2010 Vladimir Prus 
# Distributed under the Boost Software License, Version 1.0. 
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 

# This file is only used with Python port of Boost.Build

#  This file shows some of the primary customization mechanisms in Boost.Build V2
#  and should serve as a basic for your own customization.
#  Each part has a comment describing its purpose, and you can pick the parts
#  which are relevant to your case, remove everything else, and then change names
#  and actions to taste.

#  Declare a new target type. This allows Boost.Build to do something sensible
#  when targets with the .verbatim extension are found in sources.
import b2.build.type as type
type.register("VERBATIM", ["verbatim"])

#  Declare a dependency scanner for the new target type. The
#  'inline-file.py' script does not handle includes, so this is
#  only for illustraction.
import b2.build.scanner as scanner;
#  First, define a new class, derived from 'common-scanner',
#  that class has all the interesting logic, and we only need
#  to override the 'pattern' method which return regular
#  expression to use when scanning.
class VerbatimScanner(scanner.CommonScanner):

    def pattern(self):
        return "//###include[ ]*\"([^\"]*)\""

scanner.register(VerbatimScanner, ["include"])
예제 #4
0
파일: pch.py 프로젝트: 0xDEC0DE8/mcsema
#      : # sources
#        mypch.hpp
#      : # requiremnts
#        <toolset>msvc:<source>mypch.cpp
#      ;
#
# Add cpp-pch to sources:
#
#    exe hello
#      : main.cpp hello.cpp mypch
#      ;

from b2.build import type, feature, generators
from b2.tools import builtin

type.register('PCH', ['pch'])
type.register('C_PCH', [], 'PCH')
type.register('CPP_PCH', [], 'PCH')

# Control precompiled header (PCH) generation.
feature.feature('pch',
                ['on', 'off'],
                ['propagated'])

feature.feature('pch-header', [], ['free', 'dependency'])
feature.feature('pch-file', [], ['free', 'dependency'])

class PchGenerator(generators.Generator):
    """
        Base PCH generator. The 'run' method has the logic to prevent this generator
        from being run unless it's being used for a top-level PCH target.
예제 #5
0
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
# http://www.boost.org/LICENSE_1_0.txt)

# Microsoft Interface Definition Language (MIDL) related routines
from b2.build import scanner, type
from b2.build.toolset import flags
from b2.build.feature import feature
from b2.manager import get_manager
from b2.tools import builtin, common
from b2.util import regex, utility

def init():
    pass

type.register('IDL', ['idl'])

# A type library (.tlb) is generated by MIDL compiler and can be included
# to resources of an application (.rc). In order to be found by a resource 
# compiler its target type should be derived from 'H' - otherwise
# the property '<implicit-dependency>' will be ignored.
type.register('MSTYPELIB', ['tlb'], 'H')

# Register scanner for MIDL files
class MidlScanner(scanner.Scanner):
    def __init__ (self, includes=[]):
        scanner.Scanner.__init__(self)
        self.includes = includes

        # List of quoted strings 
        re_strings = "[ \t]*\"([^\"]*)\"([ \t]*,[ \t]*\"([^\"]*)\")*[ \t]*" ;
예제 #6
0
# Copyright 2010 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

# This file is only used with Python port of Boost.Build

#  This file shows some of the primary customization mechanisms in Boost.Build V2
#  and should serve as a basic for your own customization.
#  Each part has a comment describing its purpose, and you can pick the parts
#  which are relevant to your case, remove everything else, and then change names
#  and actions to taste.

#  Declare a new target type. This allows Boost.Build to do something sensible
#  when targets with the .verbatim extension are found in sources.
import b2.build.type as type
type.register("VERBATIM", ["verbatim"])

#  Declare a dependency scanner for the new target type. The
#  'inline-file.py' script does not handle includes, so this is
#  only for illustraction.
import b2.build.scanner as scanner


#  First, define a new class, derived from 'common-scanner',
#  that class has all the interesting logic, and we only need
#  to override the 'pattern' method which return regular
#  expression to use when scanning.
class VerbatimScanner(scanner.CommonScanner):
    def pattern(self):
        return "//###include[ ]*\"([^\"]*)\""
예제 #7
0
#    cpp-pch mypch
#      : # sources
#        mypch.hpp
#      : # requiremnts
#        <toolset>msvc:<source>mypch.cpp
#      ;
#
# Add cpp-pch to sources:
#
#    exe hello
#      : main.cpp hello.cpp mypch
#      ;

from b2.build import type, feature, generators

type.register("PCH", ["pch"])
type.register("C_PCH", [], "PCH")
type.register("CPP_PCH", [], "PCH")

# Control precompiled header (PCH) generation.
feature.feature("pch", ["on", "off"], ["propagated"])

feature.feature("pch-header", [], ["free", "dependency"])
feature.feature("pch-file", [], ["free", "dependency"])


class PchGenerator(generators.Generator):
    """
        Base PCH generator. The 'run' method has the logic to prevent this generator
        from being run unless it's being used for a top-level PCH target.
    """
예제 #8
0
# http://www.boost.org/LICENSE_1_0.txt)

# Microsoft Interface Definition Language (MIDL) related routines
from b2.build import scanner, type
from b2.build.feature import feature
from b2.build.toolset import flags
from b2.manager import get_manager
from b2.tools import builtin, common
from b2.util import regex, utility


def init():
    pass


type.register('IDL', ['idl'])

# A type library (.tlb) is generated by MIDL compiler and can be included
# to resources of an application (.rc). In order to be found by a resource
# compiler its target type should be derived from 'H' - otherwise
# the property '<implicit-dependency>' will be ignored.
type.register('MSTYPELIB', ['tlb'], 'H')


# Register scanner for MIDL files
class MidlScanner(scanner.Scanner):
    def __init__(self, includes=[]):
        scanner.Scanner.__init__(self)
        self.includes = includes

        # List of quoted strings
예제 #9
0
#     libxxx.lib     static library
#     xxx.dll        DLL
#     xxx.lib        import library
#
# On windows (mingw):
#     libxxx.a       static library
#     libxxx.dll     DLL
#     libxxx.dll.a   import library
#
# On cygwin i.e. <target-os>cygwin
#     libxxx.a       static library
#     cygxxx.dll     DLL
#     libxxx.dll.a   import library
#

type.register('LIB')

# FIXME: should not register both extensions on both platforms.
type.register('STATIC_LIB', ['a', 'lib'], 'LIB')

# The 'lib' prefix is used everywhere
type.set_generated_target_prefix('STATIC_LIB', [], 'lib')

# Use '.lib' suffix for windows
type.set_generated_target_suffix('STATIC_LIB', ['<target-os>windows'], 'lib')

# Except with gcc.
type.set_generated_target_suffix('STATIC_LIB', ['<toolset>gcc', '<target-os>windows'], 'a')

# Use xxx.lib for import libs
type.register('IMPORT_LIB', [], 'STATIC_LIB')
예제 #10
0
import sys

def init():
    pass

# Feature controling the command used to lanch test programs.
feature.feature("testing.launcher", [], ["free", "optional"])

feature.feature("test-info", [], ["free", "incidental"])
feature.feature("testing.arg", [], ["free", "incidental"])
feature.feature("testing.input-file", [], ["free", "dependency"])

feature.feature("preserve-test-targets", ["on", "off"], ["incidental", "propagated"])

# Register target types.
type.register("TEST", ["test"])
type.register("COMPILE", [], "TEST")
type.register("COMPILE_FAIL", [], "TEST")

type.register("RUN_OUTPUT", ["run"])
type.register("RUN", [], "TEST")
type.register("RUN_FAIL", [], "TEST")

type.register("LINK", [], "TEST")
type.register("LINK_FAIL", [], "TEST")
type.register("UNIT_TEST", ["passed"], "TEST")

__all_tests = []

# Declare the rules which create main targets. While the 'type' module already
# creates rules with the same names for us, we need extra convenience: default
예제 #11
0
파일: midl.py 프로젝트: kjedruczyk/build
# http://www.boost.org/LICENSE_1_0.txt)

# Microsoft Interface Definition Language (MIDL) related routines
from b2.build import scanner, type
from b2.build.toolset import flags
from b2.build.feature import feature
from b2.manager import get_manager
from b2.tools import builtin, common
from b2.util import regex, utility


def init():
    pass


type.register("IDL", ["idl"])

# A type library (.tlb) is generated by MIDL compiler and can be included
# to resources of an application (.rc). In order to be found by a resource
# compiler its target type should be derived from 'H' - otherwise
# the property '<implicit-dependency>' will be ignored.
type.register("MSTYPELIB", "tlb", "H")

# Register scanner for MIDL files
class MidlScanner(scanner.Scanner):
    def __init__(self, includes=[]):
        scanner.Scanner.__init__(self)
        self.includes = includes

        # List of quoted strings
        re_strings = '[ \t]*"([^"]*)"([ \t]*,[ \t]*"([^"]*)")*[ \t]*'
예제 #12
0
파일: mc.py 프로젝트: zjutjsj1004/third
#  - This file allows to use Microsoft message compiler
#    with any toolset. In msvc.jam, there's more specific
#    message compiling action.

import bjam

from b2.tools import common, rc
from b2.build import generators, type
from b2.build.toolset import flags
from b2.build.feature import feature
from b2.manager import get_manager

def init():
    pass

type.register('MC', ['mc'])


# Command line options
feature('mc-input-encoding', ['ansi', 'unicode'], ['free'])
feature('mc-output-encoding', ['unicode', 'ansi'], ['free'])
feature('mc-set-customer-bit', ['no', 'yes'], ['free'])

flags('mc.compile', 'MCFLAGS', ['<mc-input-encoding>ansi'], ['-a'])
flags('mc.compile', 'MCFLAGS', ['<mc-input-encoding>unicode'], ['-u'])
flags('mc.compile', 'MCFLAGS', ['<mc-output-encoding>ansi'], '-A')
flags('mc.compile', 'MCFLAGS', ['<mc-output-encoding>unicode'], ['-U'])
flags('mc.compile', 'MCFLAGS', ['<mc-set-customer-bit>no'], [])
flags('mc.compile', 'MCFLAGS', ['<mc-set-customer-bit>yes'], ['-c'])

generators.register_standard('mc.compile', ['MC'], ['H', 'RC'])
예제 #13
0
def register_globals ():
    """ Registers all features and variants declared by this module.
    """

    # This feature is used to determine which OS we're on.
    # In future, this may become <target-os> and <host-os>
    # TODO: check this. Compatibility with bjam names? Subfeature for version?
    os = sys.platform
    feature.feature ('os', [os], ['propagated', 'link-incompatible'])


    # The two OS features define a known set of abstract OS names. The host-os is
    # the OS under which bjam is running. Even though this should really be a fixed
    # property we need to list all the values to prevent unknown value errors. Both
    # set the default value to the current OS to account for the default use case of
    # building on the target OS.
    feature.feature('host-os', __os_names)
    feature.set_default('host-os', default_host_os())

    feature.feature('target-os', __os_names, ['propagated', 'link-incompatible'])
    feature.set_default('target-os', default_host_os())
    
    feature.feature ('toolset', [], ['implicit', 'propagated' ,'symmetric'])
    
    feature.feature ('stdlib', ['native'], ['propagated', 'composite'])
    
    feature.feature ('link', ['shared', 'static'], ['propagated'])
    feature.feature ('runtime-link', ['shared', 'static'], ['propagated'])
    feature.feature ('runtime-debugging', ['on', 'off'], ['propagated'])
    
    
    feature.feature ('optimization',  ['off', 'speed', 'space'], ['propagated'])
    feature.feature ('profiling', ['off', 'on'], ['propagated'])
    feature.feature ('inlining', ['off', 'on', 'full'], ['propagated'])
    
    feature.feature ('threading', ['single', 'multi'], ['propagated'])
    feature.feature ('rtti', ['on', 'off'], ['propagated'])
    feature.feature ('exception-handling', ['on', 'off'], ['propagated'])
    feature.feature ('debug-symbols', ['on', 'off'], ['propagated'])
    feature.feature ('define', [], ['free'])
    feature.feature ('include', [], ['free', 'path']) #order-sensitive
    feature.feature ('cflags', [], ['free'])
    feature.feature ('cxxflags', [], ['free'])
    feature.feature ('linkflags', [], ['free'])
    feature.feature ('archiveflags', [], ['free'])
    feature.feature ('version', [], ['free'])
    
    feature.feature ('location-prefix', [], ['free'])

    feature.feature ('action', [], ['free'])

    
    # The following features are incidental, since
    # in themself they have no effect on build products.
    # Not making them incidental will result in problems in corner
    # cases, for example:
    # 
    #    unit-test a : a.cpp : <use>b ;
    #    lib b : a.cpp b ;
    # 
    # Here, if <use> is not incidental, we'll decide we have two 
    # targets for a.obj with different properties, and will complain.
    #
    # Note that making feature incidental does not mean it's ignored. It may
    # be ignored when creating the virtual target, but the rest of build process
    # will use them.
    feature.feature ('use', [], ['free', 'dependency', 'incidental'])
    feature.feature ('dependency', [], ['free', 'dependency', 'incidental'])
    feature.feature ('implicit-dependency', [], ['free', 'dependency', 'incidental'])

    feature.feature('warnings', [
        'on',         # Enable default/"reasonable" warning level for the tool.
        'all',        # Enable all possible warnings issued by the tool.
        'off'],       # Disable all warnings issued by the tool.
        ['incidental', 'propagated'])

    feature.feature('warnings-as-errors', [
        'off',        # Do not fail the compilation if there are warnings.
        'on'],        # Fail the compilation if there are warnings.
        ['incidental', 'propagated'])
    
    feature.feature ('source', [], ['free', 'dependency', 'incidental'])
    feature.feature ('library', [], ['free', 'dependency', 'incidental'])
    feature.feature ('file', [], ['free', 'dependency', 'incidental'])
    feature.feature ('find-shared-library', [], ['free']) #order-sensitive ;
    feature.feature ('find-static-library', [], ['free']) #order-sensitive ;
    feature.feature ('library-path', [], ['free', 'path']) #order-sensitive ;
    # Internal feature.
    feature.feature ('library-file', [], ['free', 'dependency'])
    
    feature.feature ('name', [], ['free'])
    feature.feature ('tag', [], ['free'])
    feature.feature ('search', [], ['free', 'path']) #order-sensitive ;
    feature.feature ('location', [], ['free', 'path'])
    
    feature.feature ('dll-path', [], ['free', 'path'])
    feature.feature ('hardcode-dll-paths', ['true', 'false'], ['incidental'])
    
    
    # This is internal feature which holds the paths of all dependency
    # dynamic libraries. On Windows, it's needed so that we can all
    # those paths to PATH, when running applications.
    # On Linux, it's needed to add proper -rpath-link command line options.
    feature.feature ('xdll-path', [], ['free', 'path'])
    
    #provides means to specify def-file for windows dlls.
    feature.feature ('def-file', [], ['free', 'dependency'])
    
    # This feature is used to allow specific generators to run.
    # For example, QT tools can only be invoked when QT library
    # is used. In that case, <allow>qt will be in usage requirement
    # of the library.
    feature.feature ('allow', [], ['free'])
    
    # The addressing model to generate code for. Currently a limited set only
    # specifying the bit size of pointers.
    feature.feature('address-model', ['16', '32', '64'], ['propagated', 'optional'])

    # Type of CPU architecture to compile for.
    feature.feature('architecture', [
        # x86 and x86-64
        'x86',

        # ia64
        'ia64',

        # Sparc
        'sparc',

        # RS/6000 & PowerPC
        'power',

        # MIPS/SGI
        'mips1', 'mips2', 'mips3', 'mips4', 'mips32', 'mips32r2', 'mips64',

        # HP/PA-RISC
        'parisc',
        
        # Advanced RISC Machines
        'arm',

        # Combined architectures for platforms/toolsets that support building for
        # multiple architectures at once. "combined" would be the default multi-arch
        # for the toolset.
        'combined',
        'combined-x86-power'],

        ['propagated', 'optional'])

    # The specific instruction set in an architecture to compile.
    feature.feature('instruction-set', [
        # x86 and x86-64
        'i386', 'i486', 'i586', 'i686', 'pentium', 'pentium-mmx', 'pentiumpro', 'pentium2', 'pentium3',
        'pentium3m', 'pentium-m', 'pentium4', 'pentium4m', 'prescott', 'nocona', 'conroe', 'conroe-xe',
        'conroe-l', 'allendale', 'mermon', 'mermon-xe', 'kentsfield', 'kentsfield-xe', 'penryn', 'wolfdale',
        'yorksfield', 'nehalem', 'k6', 'k6-2', 'k6-3', 'athlon', 'athlon-tbird', 'athlon-4', 'athlon-xp',
        'athlon-mp', 'k8', 'opteron', 'athlon64', 'athlon-fx', 'winchip-c6', 'winchip2', 'c3', 'c3-2',

        # ia64
        'itanium', 'itanium1', 'merced', 'itanium2', 'mckinley',

        # Sparc
        'v7', 'cypress', 'v8', 'supersparc', 'sparclite', 'hypersparc', 'sparclite86x', 'f930', 'f934',
        'sparclet', 'tsc701', 'v9', 'ultrasparc', 'ultrasparc3',

        # RS/6000 & PowerPC
        '401', '403', '405', '405fp', '440', '440fp', '505', '601', '602',
        '603', '603e', '604', '604e', '620', '630', '740', '7400',
        '7450', '750', '801', '821', '823', '860', '970', '8540',
        'power-common', 'ec603e', 'g3', 'g4', 'g5', 'power', 'power2',
        'power3', 'power4', 'power5', 'powerpc', 'powerpc64', 'rios',
        'rios1', 'rsc', 'rios2', 'rs64a',

        # MIPS
        '4kc', '4kp', '5kc', '20kc', 'm4k', 'r2000', 'r3000', 'r3900', 'r4000',
        'r4100', 'r4300', 'r4400', 'r4600', 'r4650',
        'r6000', 'r8000', 'rm7000', 'rm9000', 'orion', 'sb1', 'vr4100',
        'vr4111', 'vr4120', 'vr4130', 'vr4300',
        'vr5000', 'vr5400', 'vr5500',

        # HP/PA-RISC
        '700', '7100', '7100lc', '7200', '7300', '8000',
        
        # Advanced RISC Machines
        'armv2', 'armv2a', 'armv3', 'armv3m', 'armv4', 'armv4t', 'armv5',
        'armv5t', 'armv5te', 'armv6', 'armv6j', 'iwmmxt', 'ep9312'],

        ['propagated', 'optional'])

    feature.feature('conditional', [], ['incidental', 'free'])

    # The value of 'no' prevents building of a target.
    feature.feature('build', ['yes', 'no'], ['optional'])
    
    # Windows-specific features
    feature.feature ('user-interface', ['console', 'gui', 'wince', 'native', 'auto'], [])
    feature.feature ('variant', [], ['implicit', 'composite', 'propagated', 'symmetric'])


    variant ('debug', ['<optimization>off', '<debug-symbols>on', '<inlining>off', '<runtime-debugging>on'])
    variant ('release', ['<optimization>speed', '<debug-symbols>off', '<inlining>full', 
                         '<runtime-debugging>off', '<define>NDEBUG'])
    variant ('profile', ['release'], ['<profiling>on', '<debug-symbols>on'])

    type.register ('H', ['h'])
    type.register ('HPP', ['hpp'], 'H')
    type.register ('C', ['c'])
예제 #14
0
# Copyright 2003 Dave Abrahams 
# Copyright 2002, 2003, 2005, 2010 Vladimir Prus 
# Distributed under the Boost Software License, Version 1.0. 
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 

import bjam
import b2.build.type as type
import b2.build.generators as generators

from b2.manager import get_manager

type.register("FOO", ["foo"])
generators.register_standard("foo.foo", ["FOO"], ["CPP", "H"])

def prepare_foo(targets, sources, properties):

    if properties.get('os') in ['windows', 'cygwin']:
        bjam.call('set-target-variable', targets, "DECL", 
                  "void __declspec(dllexport) foo(){}")
    
    pass

get_manager().engine().register_action("foo.foo",\
"""echo -e $(DECL:E="//")\\n > $(<[1])
echo -e "#include <z.h>\\n" > $(<[2])
""", function=prepare_foo)
예제 #15
0
파일: pch.py 프로젝트: malinost/boost
#    cpp-pch mypch
#      : # sources
#        mypch.hpp
#      : # requiremnts
#        <toolset>msvc:<source>mypch.cpp
#      ;
#
# Add cpp-pch to sources:
#
#    exe hello
#      : main.cpp hello.cpp mypch
#      ;

from b2.build import type, feature, generators

type.register('PCH', ['pch'])
type.register('C_PCH', [], 'PCH')
type.register('CPP_PCH', [], 'PCH')

# Control precompiled header (PCH) generation.
feature.feature('pch', ['on', 'off'], ['propagated'])

feature.feature('pch-header', [], ['free', 'dependency'])
feature.feature('pch-file', [], ['free', 'dependency'])


class PchGenerator(generators.Generator):
    """
        Base PCH generator. The 'run' method has the logic to prevent this generator
        from being run unless it's being used for a top-level PCH target.
    """
#
#  Copyright (c) 2005-2010 Vladimir Prus.
#
#  Use, modification and distribution is subject to the Boost Software
#  License Version 1.0. (See accompanying file LICENSE_1_0.txt or
#  http://www.boost.org/LICENSE_1_0.txt)

import b2.build.generators as generators
import b2.build.targets as targets
import b2.build.toolset as toolset
import b2.build.type as type
import b2.build.virtual_target as virtual_target
from b2.manager import get_manager
from b2.util import bjam_signature

type.register("NOTFILE_MAIN")


class NotfileGenerator(generators.Generator):
    def run(self, project, name, ps, sources):
        pass
        action_name = ps.get('action')[0]
        if action_name[0] == '@':
            action = virtual_target.Action(get_manager(), sources,
                                           action_name[1:], ps)
        else:
            action = virtual_target.Action(get_manager(), sources,
                                           "notfile.run", ps)

        return [
            get_manager().virtual_targets().register(
예제 #17
0
파일: rc.py 프로젝트: wzssyqa/build
from b2.exceptions import AlreadyDefined
from b2.tools import builtin
from b2.util import regex
from b2.build.toolset import flags
from b2.manager import get_manager
from b2.util import utility

__debug = None

def debug():
    global __debug
    if __debug is None:
        __debug = "--debug-configuration" in bjam.variable("ARGV")
    return __debug

type.register('RC', ['rc'])

def init():
    pass

def configure (command = None, condition = None, options = None):
    """
        Configures a new resource compilation command specific to a condition,
        usually a toolset selection condition. The possible options are:

            * <rc-type>(rc|windres) - Indicates the type of options the command
              accepts.

        Even though the arguments are all optional, only when a command, condition,
        and at minimum the rc-type option are given will the command be configured.
        This is so that callers don't have to check auto-configuration values
예제 #18
0
파일: notfile.py 프로젝트: 0xDEC0DE8/mcsema
#
#  Use, modification and distribution is subject to the Boost Software
#  License Version 1.0. (See accompanying file LICENSE_1_0.txt or
#  http://www.boost.org/LICENSE_1_0.txt)


import b2.build.type as type
import b2.build.generators as generators
import b2.build.virtual_target as virtual_target
import b2.build.toolset as toolset
import b2.build.targets as targets

from b2.manager import get_manager
from b2.util import bjam_signature

type.register("NOTFILE_MAIN")

class NotfileGenerator(generators.Generator):

    def run(self, project, name, ps, sources):
        pass
        action_name = ps.get('action')[0]
        if action_name[0] == '@':
            action = virtual_target.Action(get_manager(), sources, action_name[1:], ps)
        else:
            action = virtual_target.Action(get_manager(), sources, "notfile.run", ps)

        return [get_manager().virtual_targets().register(
            virtual_target.NotFileTarget(name, project, action))]

generators.register(NotfileGenerator("notfile.main", False, [], ["NOTFILE_MAIN"]))
예제 #19
0
def register_globals():
    """ Registers all features and variants declared by this module.
    """

    # This feature is used to determine which OS we're on.
    # In future, this may become <target-os> and <host-os>
    # TODO: check this. Compatibility with bjam names? Subfeature for version?
    os = sys.platform
    feature.feature('os', [os], ['propagated', 'link-incompatible'])

    # The two OS features define a known set of abstract OS names. The host-os is
    # the OS under which bjam is running. Even though this should really be a fixed
    # property we need to list all the values to prevent unknown value errors. Both
    # set the default value to the current OS to account for the default use case of
    # building on the target OS.
    feature.feature('host-os', __os_names)
    feature.set_default('host-os', default_host_os())

    feature.feature('target-os', __os_names,
                    ['propagated', 'link-incompatible'])
    feature.set_default('target-os', default_host_os())

    feature.feature('toolset', [], ['implicit', 'propagated', 'symmetric'])

    feature.feature('stdlib', ['native'], ['propagated', 'composite'])

    feature.feature('link', ['shared', 'static'], ['propagated'])
    feature.feature('runtime-link', ['shared', 'static'], ['propagated'])
    feature.feature('runtime-debugging', ['on', 'off'], ['propagated'])

    feature.feature('optimization', ['off', 'speed', 'space'], ['propagated'])
    feature.feature('profiling', ['off', 'on'], ['propagated'])
    feature.feature('inlining', ['off', 'on', 'full'], ['propagated'])

    feature.feature('threading', ['single', 'multi'], ['propagated'])
    feature.feature('rtti', ['on', 'off'], ['propagated'])
    feature.feature('exception-handling', ['on', 'off'], ['propagated'])
    feature.feature('debug-symbols', ['on', 'off'], ['propagated'])
    feature.feature('define', [], ['free'])
    feature.feature('include', [], ['free', 'path'])  #order-sensitive
    feature.feature('cflags', [], ['free'])
    feature.feature('cxxflags', [], ['free'])
    feature.feature('linkflags', [], ['free'])
    feature.feature('archiveflags', [], ['free'])
    feature.feature('version', [], ['free'])

    feature.feature('location-prefix', [], ['free'])

    feature.feature('action', [], ['free'])

    # The following features are incidental, since
    # in themself they have no effect on build products.
    # Not making them incidental will result in problems in corner
    # cases, for example:
    #
    #    unit-test a : a.cpp : <use>b ;
    #    lib b : a.cpp b ;
    #
    # Here, if <use> is not incidental, we'll decide we have two
    # targets for a.obj with different properties, and will complain.
    #
    # Note that making feature incidental does not mean it's ignored. It may
    # be ignored when creating the virtual target, but the rest of build process
    # will use them.
    feature.feature('use', [], ['free', 'dependency', 'incidental'])
    feature.feature('dependency', [], ['free', 'dependency', 'incidental'])
    feature.feature('implicit-dependency', [],
                    ['free', 'dependency', 'incidental'])

    feature.feature(
        'warnings',
        [
            'on',  # Enable default/"reasonable" warning level for the tool.
            'all',  # Enable all possible warnings issued by the tool.
            'off'
        ],  # Disable all warnings issued by the tool.
        ['incidental', 'propagated'])

    feature.feature(
        'warnings-as-errors',
        [
            'off',  # Do not fail the compilation if there are warnings.
            'on'
        ],  # Fail the compilation if there are warnings.
        ['incidental', 'propagated'])

    feature.feature('source', [], ['free', 'dependency', 'incidental'])
    feature.feature('library', [], ['free', 'dependency', 'incidental'])
    feature.feature('file', [], ['free', 'dependency', 'incidental'])
    feature.feature('find-shared-library', [], ['free'])  #order-sensitive ;
    feature.feature('find-static-library', [], ['free'])  #order-sensitive ;
    feature.feature('library-path', [], ['free', 'path'])  #order-sensitive ;
    # Internal feature.
    feature.feature('library-file', [], ['free', 'dependency'])

    feature.feature('name', [], ['free'])
    feature.feature('tag', [], ['free'])
    feature.feature('search', [], ['free', 'path'])  #order-sensitive ;
    feature.feature('location', [], ['free', 'path'])

    feature.feature('dll-path', [], ['free', 'path'])
    feature.feature('hardcode-dll-paths', ['true', 'false'], ['incidental'])

    # This is internal feature which holds the paths of all dependency
    # dynamic libraries. On Windows, it's needed so that we can all
    # those paths to PATH, when running applications.
    # On Linux, it's needed to add proper -rpath-link command line options.
    feature.feature('xdll-path', [], ['free', 'path'])

    #provides means to specify def-file for windows dlls.
    feature.feature('def-file', [], ['free', 'dependency'])

    # This feature is used to allow specific generators to run.
    # For example, QT tools can only be invoked when QT library
    # is used. In that case, <allow>qt will be in usage requirement
    # of the library.
    feature.feature('allow', [], ['free'])

    # The addressing model to generate code for. Currently a limited set only
    # specifying the bit size of pointers.
    feature.feature('address-model', ['16', '32', '64'],
                    ['propagated', 'optional'])

    # Type of CPU architecture to compile for.
    feature.feature(
        'architecture',
        [
            # x86 and x86-64
            'x86',

            # ia64
            'ia64',

            # Sparc
            'sparc',

            # RS/6000 & PowerPC
            'power',

            # MIPS/SGI
            'mips1',
            'mips2',
            'mips3',
            'mips4',
            'mips32',
            'mips32r2',
            'mips64',

            # HP/PA-RISC
            'parisc',

            # Advanced RISC Machines
            'arm',

            # Combined architectures for platforms/toolsets that support building for
            # multiple architectures at once. "combined" would be the default multi-arch
            # for the toolset.
            'combined',
            'combined-x86-power'
        ],
        ['propagated', 'optional'])

    # The specific instruction set in an architecture to compile.
    feature.feature(
        'instruction-set',
        [
            # x86 and x86-64
            'i386',
            'i486',
            'i586',
            'i686',
            'pentium',
            'pentium-mmx',
            'pentiumpro',
            'pentium2',
            'pentium3',
            'pentium3m',
            'pentium-m',
            'pentium4',
            'pentium4m',
            'prescott',
            'nocona',
            'conroe',
            'conroe-xe',
            'conroe-l',
            'allendale',
            'mermon',
            'mermon-xe',
            'kentsfield',
            'kentsfield-xe',
            'penryn',
            'wolfdale',
            'yorksfield',
            'nehalem',
            'k6',
            'k6-2',
            'k6-3',
            'athlon',
            'athlon-tbird',
            'athlon-4',
            'athlon-xp',
            'athlon-mp',
            'k8',
            'opteron',
            'athlon64',
            'athlon-fx',
            'winchip-c6',
            'winchip2',
            'c3',
            'c3-2',

            # ia64
            'itanium',
            'itanium1',
            'merced',
            'itanium2',
            'mckinley',

            # Sparc
            'v7',
            'cypress',
            'v8',
            'supersparc',
            'sparclite',
            'hypersparc',
            'sparclite86x',
            'f930',
            'f934',
            'sparclet',
            'tsc701',
            'v9',
            'ultrasparc',
            'ultrasparc3',

            # RS/6000 & PowerPC
            '401',
            '403',
            '405',
            '405fp',
            '440',
            '440fp',
            '505',
            '601',
            '602',
            '603',
            '603e',
            '604',
            '604e',
            '620',
            '630',
            '740',
            '7400',
            '7450',
            '750',
            '801',
            '821',
            '823',
            '860',
            '970',
            '8540',
            'power-common',
            'ec603e',
            'g3',
            'g4',
            'g5',
            'power',
            'power2',
            'power3',
            'power4',
            'power5',
            'powerpc',
            'powerpc64',
            'rios',
            'rios1',
            'rsc',
            'rios2',
            'rs64a',

            # MIPS
            '4kc',
            '4kp',
            '5kc',
            '20kc',
            'm4k',
            'r2000',
            'r3000',
            'r3900',
            'r4000',
            'r4100',
            'r4300',
            'r4400',
            'r4600',
            'r4650',
            'r6000',
            'r8000',
            'rm7000',
            'rm9000',
            'orion',
            'sb1',
            'vr4100',
            'vr4111',
            'vr4120',
            'vr4130',
            'vr4300',
            'vr5000',
            'vr5400',
            'vr5500',

            # HP/PA-RISC
            '700',
            '7100',
            '7100lc',
            '7200',
            '7300',
            '8000',

            # Advanced RISC Machines
            'armv2',
            'armv2a',
            'armv3',
            'armv3m',
            'armv4',
            'armv4t',
            'armv5',
            'armv5t',
            'armv5te',
            'armv6',
            'armv6j',
            'iwmmxt',
            'ep9312'
        ],
        ['propagated', 'optional'])

    feature.feature('conditional', [], ['incidental', 'free'])

    # The value of 'no' prevents building of a target.
    feature.feature('build', ['yes', 'no'], ['optional'])

    # Windows-specific features
    feature.feature('user-interface',
                    ['console', 'gui', 'wince', 'native', 'auto'], [])
    feature.feature('variant', [],
                    ['implicit', 'composite', 'propagated', 'symmetric'])

    variant('debug', [
        '<optimization>off', '<debug-symbols>on', '<inlining>off',
        '<runtime-debugging>on'
    ])
    variant('release', [
        '<optimization>speed', '<debug-symbols>off', '<inlining>full',
        '<runtime-debugging>off', '<define>NDEBUG'
    ])
    variant('profile', ['release'], ['<profiling>on', '<debug-symbols>on'])

    type.register('H', ['h'])
    type.register('HPP', ['hpp'], 'H')
    type.register('C', ['c'])
#    extracting message strings from sources
#  - This file allows to use Microsoft message compiler
#    with any toolset. In msvc.jam, there's more specific
#    message compiling action.

from b2.build import generators, type
from b2.build.feature import feature
from b2.build.toolset import flags
from b2.manager import get_manager


def init():
    pass


type.register('MC', ['mc'])

# Command line options
feature('mc-input-encoding', ['ansi', 'unicode'], ['free'])
feature('mc-output-encoding', ['unicode', 'ansi'], ['free'])
feature('mc-set-customer-bit', ['no', 'yes'], ['free'])

flags('mc.compile', 'MCFLAGS', ['<mc-input-encoding>ansi'], ['-a'])
flags('mc.compile', 'MCFLAGS', ['<mc-input-encoding>unicode'], ['-u'])
flags('mc.compile', 'MCFLAGS', ['<mc-output-encoding>ansi'], '-A')
flags('mc.compile', 'MCFLAGS', ['<mc-output-encoding>unicode'], ['-U'])
flags('mc.compile', 'MCFLAGS', ['<mc-set-customer-bit>no'], [])
flags('mc.compile', 'MCFLAGS', ['<mc-set-customer-bit>yes'], ['-c'])

generators.register_standard('mc.compile', ['MC'], ['H', 'RC'])
예제 #21
0
파일: rc.py 프로젝트: Cabriter/abelkhan
from b2.exceptions import AlreadyDefined
from b2.tools import builtin
from b2.util import regex
from b2.build.toolset import flags
from b2.manager import get_manager
from b2.util import utility

__debug = None

def debug():
    global __debug
    if __debug is None:
        __debug = "--debug-configuration" in bjam.variable("ARGV")
    return __debug

type.register('RC', ['rc'])

def init():
    pass

def configure (command = None, condition = None, options = None):
    """
        Configures a new resource compilation command specific to a condition,
        usually a toolset selection condition. The possible options are:

            * <rc-type>(rc|windres) - Indicates the type of options the command
              accepts.

        Even though the arguments are all optional, only when a command, condition,
        and at minimum the rc-type option are given will the command be configured.
        This is so that callers don't have to check auto-configuration values
예제 #22
0
def init():
    pass


# Feature controling the command used to lanch test programs.
feature.feature("testing.launcher", [], ["free", "optional"])

feature.feature("test-info", [], ["free", "incidental"])
feature.feature("testing.arg", [], ["free", "incidental"])
feature.feature("testing.input-file", [], ["free", "dependency"])

feature.feature("preserve-test-targets", ["on", "off"],
                ["incidental", "propagated"])

# Register target types.
type.register("TEST", ["test"])
type.register("COMPILE", [], "TEST")
type.register("COMPILE_FAIL", [], "TEST")

type.register("RUN_OUTPUT", ["run"])
type.register("RUN", [], "TEST")
type.register("RUN_FAIL", [], "TEST")

type.register("LINK", [], "TEST")
type.register("LINK_FAIL", [], "TEST")
type.register("UNIT_TEST", ["passed"], "TEST")

__all_tests = []

# Declare the rules which create main targets. While the 'type' module already
# creates rules with the same names for us, we need extra convenience: default