# same name included from different places. # We don't need this extra information for angle includes, # since they should not depend on including file (we can't # get literal "." in include path). g2 = g + "#" + b g = "<" + g + ">" g2 = "<" + g2 + ">" angle = [g + x for x in angle] quoted = [g2 + x for x in quoted] res = [g2 + x for x in res] all = angle + quoted bjam.call('mark-included', target, all) engine = get_manager().engine() engine.add_dependency(target, res) bjam.call('NOCARE', all + res) engine.set_target_variable(angle, 'SEARCH', [utility.get_value(inc) for inc in self.includes]) engine.set_target_variable(quoted, 'SEARCH', [b + utility.get_value(inc) for inc in self.includes]) engine.set_target_variable(res, 'SEARCH', [b + utility.get_value(inc) for inc in self.includes]) # Just propagate current scanner to includes, in a hope # that includes do not change scanners. get_manager().scanners().propagate(self, angle + quoted) scanner.register(ResScanner, 'include') type.set_scanner('RC', ResScanner)
included_quoted, 'SEARCH', [utility.get_value(inc) for inc in self.includes]) engine.set_target_variable( imported, 'SEARCH', [utility.get_value(inc) for inc in self.includes]) engine.set_target_variable( imported_tlbs, 'SEARCH', [utility.get_value(inc) for inc in self.includes]) get_manager().scanners().propagate( type.get_scanner('CPP', PropertySet(self.includes)), included_angle + included_quoted) get_manager().scanners().propagate(self, imported) scanner.register(MidlScanner, 'include') type.set_scanner('IDL', MidlScanner) # Command line options feature('midl-stubless-proxy', ['yes', 'no'], ['propagated']) feature('midl-robust', ['yes', 'no'], ['propagated']) flags('midl.compile.idl', 'MIDLFLAGS', ['<midl-stubless-proxy>yes'], ['/Oicf']) flags('midl.compile.idl', 'MIDLFLAGS', ['<midl-stubless-proxy>no'], ['/Oic']) flags('midl.compile.idl', 'MIDLFLAGS', ['<midl-robust>yes'], ['/robust']) flags('midl.compile.idl', 'MIDLFLAGS', ['<midl-robust>no'], ['/no_robust']) # Architecture-specific options architecture_x86 = ['<architecture>', '<architecture>x86'] address_model_32 = ['<address-model>', '<address-model>32'] address_model_64 = ['<address-model>', '<address-model>64']
includes = angles + quoted bjam.call('INCLUDES', target, includes) bjam.call('NOCARE', includes) ENGINE.set_target_variable(angles, 'SEARCH', self.includes) ENGINE.set_target_variable(quoted, 'SEARCH', [b] + self.includes) # Just propagate the current scanner to includes, in hope that includes # do not change scanners. SCANNERS.propagate(self, includes) bjam.call('ISFILE', includes) scanner.register(CScanner, 'include') type_.register_type('CPP', ['cpp', 'cxx', 'cc']) type_.register_type('H', ['h']) type_.register_type('HPP', ['hpp'], 'H') type_.register_type('C', ['c']) # It most cases where a CPP file or a H file is a source of some action, we # should rebuild the result if any of files included by CPP/H are changed. One # case when this is not needed is installation, which is handled specifically. type_.set_scanner('CPP', CScanner) type_.set_scanner('C', CScanner) # One case where scanning of H/HPP files is necessary is PCH generation -- if # any header included by HPP being precompiled changes, we need to recompile the # header. type_.set_scanner('H', CScanner) type_.set_scanner('HPP', CScanner)
g2 = "<" + g2 + ">" angle = [g + x for x in angle] quoted = [g2 + x for x in quoted] all = angle + quoted bjam.call("mark-included", target, all) engine = get_manager().engine() engine.set_target_variable(angle, "SEARCH", get_value(self.includes_)) engine.set_target_variable(quoted, "SEARCH", [b] + get_value(self.includes_)) # Just propagate current scanner to includes, in a hope # that includes do not change scanners. get_manager().scanners().propagate(self, angle + quoted) scanner.register (CScanner, 'include') type.set_scanner ('CPP', CScanner) type.set_scanner ('C', CScanner) # Ported to trunk@47077 class LibGenerator (generators.Generator): """ The generator class for libraries (target type LIB). Depending on properties it will request building of the approapriate specific type -- SHARED_LIB, STATIC_LIB or SHARED_LIB. """ def __init__(self, id, composing = True, source_types = [], target_types_and_names = ['LIB'], requirements = []): generators.Generator.__init__(self, id, composing, source_types, target_types_and_names, requirements) def run(self, project, name, prop_set, sources):
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 $(<) $(>) """)
imported_tlbs = [ g + x for x in imported_tlbs ] all = included_angle + included_quoted + imported bjam.call('INCLUDES', [target], all) bjam.call('DEPENDS', [target], imported_tlbs) bjam.call('NOCARE', all + imported_tlbs) engine.set_target_variable(included_angle , 'SEARCH', [utility.get_value(inc) for inc in self.includes]) engine.set_target_variable(included_quoted, 'SEARCH', [utility.get_value(inc) for inc in self.includes]) engine.set_target_variable(imported , 'SEARCH', [utility.get_value(inc) for inc in self.includes]) engine.set_target_variable(imported_tlbs , 'SEARCH', [utility.get_value(inc) for inc in self.includes]) get_manager().scanners().propagate(type.get_scanner('CPP', PropertySet(self.includes)), included_angle + included_quoted) get_manager().scanners().propagate(self, imported) scanner.register(MidlScanner, 'include') type.set_scanner('IDL', MidlScanner) # Command line options feature('midl-stubless-proxy', ['yes', 'no'], ['propagated'] ) feature('midl-robust', ['yes', 'no'], ['propagated'] ) flags('midl.compile.idl', 'MIDLFLAGS', ['<midl-stubless-proxy>yes'], ['/Oicf' ]) flags('midl.compile.idl', 'MIDLFLAGS', ['<midl-stubless-proxy>no' ], ['/Oic' ]) flags('midl.compile.idl', 'MIDLFLAGS', ['<midl-robust>yes' ], ['/robust' ]) flags('midl.compile.idl', 'MIDLFLAGS', ['<midl-robust>no' ], ['/no_robust']) # Architecture-specific options architecture_x86 = ['<architecture>' , '<architecture>x86'] address_model_32 = ['<address-model>', '<address-model>32']
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 $(<) $(>) """)
angle = [g + x for x in angle] quoted = [g2 + x for x in quoted] all = angle + quoted bjam.call("mark-included", target, all) engine = get_manager().engine() engine.set_target_variable(angle, "SEARCH", get_value(self.includes_)) engine.set_target_variable(quoted, "SEARCH", [b] + get_value(self.includes_)) # Just propagate current scanner to includes, in a hope # that includes do not change scanners. get_manager().scanners().propagate(self, angle + quoted) scanner.register(CScanner, "include") type.set_scanner("CPP", CScanner) type.set_scanner("C", CScanner) # Ported to trunk@47077 class LibGenerator(generators.Generator): """ The generator class for libraries (target type LIB). Depending on properties it will request building of the approapriate specific type -- SHARED_LIB, STATIC_LIB or SHARED_LIB. """ def __init__(self, id, composing=True, source_types=[], target_types_and_names=["LIB"], requirements=[]): generators.Generator.__init__(self, id, composing, source_types, target_types_and_names, requirements) def run(self, project, name, prop_set, sources):
bjam.call("INCLUDES", [target], all) bjam.call("DEPENDS", [target], imported_tlbs) bjam.call("NOCARE", all + imported_tlbs) engine.set_target_variable(included_angle, "SEARCH", [utility.get_value(inc) for inc in self.includes]) engine.set_target_variable(included_quoted, "SEARCH", [utility.get_value(inc) for inc in self.includes]) engine.set_target_variable(imported, "SEARCH", [utility.get_value(inc) for inc in self.includes]) engine.set_target_variable(imported_tlbs, "SEARCH", [utility.get_value(inc) for inc in self.includes]) get_manager().scanners().propagate( type.get_scanner("CPP", PropertySet(self.includes)), included_angle + included_quoted ) get_manager().scanners().propagate(self, imported) scanner.register(MidlScanner, "include") type.set_scanner("IDL", MidlScanner) # Command line options feature("midl-stubless-proxy", ["yes", "no"], ["propagated"]) feature("midl-robust", ["yes", "no"], ["propagated"]) flags("midl.compile.idl", "MIDLFLAGS", ["<midl-stubless-proxy>yes"], ["/Oicf"]) flags("midl.compile.idl", "MIDLFLAGS", ["<midl-stubless-proxy>no"], ["/Oic"]) flags("midl.compile.idl", "MIDLFLAGS", ["<midl-robust>yes"], ["/robust"]) flags("midl.compile.idl", "MIDLFLAGS", ["<midl-robust>no"], ["/no_robust"]) # Architecture-specific options architecture_x86 = ["<architecture>", "<architecture>x86"] address_model_32 = ["<address-model>", "<address-model>32"]