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"]) type.set_scanner("VERBATIM", VerbatimScanner) import b2.build.generators as generators generators.register_standard("verbatim.inline-file", ["VERBATIM"], ["CPP"]) from b2.manager import get_manager get_manager().engine().register_action("verbatim.inline-file", """ ./inline_file.py $(<) $(>) """)
# 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"]) type.set_scanner("VERBATIM", VerbatimScanner) import b2.build.generators as generators generators.register_standard("verbatim.inline-file", ["VERBATIM"], ["CPP"]) from b2.manager import get_manager get_manager().engine().register_action("verbatim.inline-file", """ ./inline_file.py $(<) $(>) """)
# "$(nl) </test>" # ; # } # else source_files = " ".join('"' + s + '"' for s in source_files) if test_info: print 'boost-test(%s) "%s" [%s] : %s' % (type, name, test_info, source_files) else: print 'boost-test(%s) "%s" : %s' % (type, name, source_files) # Register generators. Depending on target type, either 'expect-success' or # 'expect-failure' rule will be used. generators.register_standard("testing.expect-success", ["OBJ"], ["COMPILE"]) generators.register_standard("testing.expect-failure", ["OBJ"], ["COMPILE_FAIL"]) generators.register_standard("testing.expect-success", ["RUN_OUTPUT"], ["RUN"]) generators.register_standard("testing.expect-failure", ["RUN_OUTPUT"], ["RUN_FAIL"]) generators.register_standard("testing.expect-success", ["EXE"], ["LINK"]) generators.register_standard("testing.expect-failure", ["EXE"], ["LINK_FAIL"]) # Generator which runs an EXE and captures output. generators.register_standard("testing.capture-output", ["EXE"], ["RUN_OUTPUT"]) # Generator which creates a target if sources run successfully. Differs from RUN # in that run output is not captured. The reason why it exists is that the 'run' # rule is much better for automated testing, but is not user-friendly (see # http://article.gmane.org/gmane.comp.lib.boost.build/6353).
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']) get_manager().engine().register_action( 'mc.compile', 'mc $(MCFLAGS) -h "$(<[1]:DW)" -r "$(<[2]:DW)" "$(>:W)"')
# "$(nl) <info><![CDATA[$(test-info)]]></info>" # "$(nl) <source><![CDATA[$(source-files)]]></source>" # "$(nl) </test>" # ; # } # else source_files = " ".join('"' + s + '"' for s in source_files) if test_info: print 'boost-test(%s) "%s" [%s] : %s' % (type, name, test_info, source_files) else: print 'boost-test(%s) "%s" : %s' % (type, name, source_files) # Register generators. Depending on target type, either 'expect-success' or # 'expect-failure' rule will be used. generators.register_standard("testing.expect-success", ["OBJ"], ["COMPILE"]) generators.register_standard("testing.expect-failure", ["OBJ"], ["COMPILE_FAIL"]) generators.register_standard("testing.expect-success", ["RUN_OUTPUT"], ["RUN"]) generators.register_standard("testing.expect-failure", ["RUN_OUTPUT"], ["RUN_FAIL"]) generators.register_standard("testing.expect-success", ["EXE"], ["LINK"]) generators.register_standard("testing.expect-failure", ["EXE"], ["LINK_FAIL"]) # Generator which runs an EXE and captures output. generators.register_standard("testing.capture-output", ["EXE"], ["RUN_OUTPUT"]) # Generator which creates a target if sources run successfully. Differs from RUN # in that run output is not captured. The reason why it exists is that the 'run' # rule is much better for automated testing, but is not user-friendly (see # http://article.gmane.org/gmane.comp.lib.boost.build/6353). generators.register_standard("testing.unit-test", ["EXE"], ["UNIT_TEST"])
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']) get_manager().engine().register_action( 'mc.compile', 'mc $(MCFLAGS) -h "$(<[1]:DW)" -r "$(<[2]:DW)" "$(>:W)"')
# 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)