def run(self, project, name, prop_set, sources): assert isinstance(project, targets.ProjectTarget) assert isinstance(name, basestring) or name is None assert isinstance(prop_set, property_set.PropertySet) assert is_iterable_typed(sources, virtual_target.VirtualTarget) # create a copy since sources is being modified sources = list(sources) sources.extend(prop_set.get('<library>')) # Add <library-path> properties for all searched libraries extra = [] for s in sources: if s.type() == 'SEARCHED_LIB': search = s.search() extra.extend( property.Property('<library-path>', sp) for sp in search) # It's possible that we have libraries in sources which did not came # from 'lib' target. For example, libraries which are specified # just as filenames as sources. We don't have xdll-path properties # for such target, but still need to add proper dll-path properties. extra_xdll_path = [] for s in sources: if type.is_derived(s.type(), 'SHARED_LIB') and not s.action(): # Unfortunately, we don't have a good way to find the path # to a file, so use this nasty approach. p = s.project() location = path.root(s.name(), p.get('source-location')[0]) extra_xdll_path.append(os.path.dirname(location)) # Hardcode DLL paths only when linking executables. # Pros: do not need to relink libraries when installing. # Cons: "standalone" libraries (plugins, python extensions) can not # hardcode paths to dependent libraries. if prop_set.get('<hardcode-dll-paths>') == ['true'] \ and type.is_derived(self.target_types_ [0], 'EXE'): xdll_path = prop_set.get('<xdll-path>') extra.extend(property.Property('<dll-path>', sp) \ for sp in extra_xdll_path) extra.extend(property.Property('<dll-path>', sp) \ for sp in xdll_path) if extra: prop_set = prop_set.add_raw(extra) result = generators.Generator.run(self, project, name, prop_set, sources) if result: ur = self.extra_usage_requirements(result, prop_set) ur = ur.add( property_set.create( ['<xdll-path>' + p for p in extra_xdll_path])) else: return None return (ur, result)
def run(self, project, name, prop_set, sources): lib_sources = prop_set.get('<library>') sources.extend(lib_sources) # Add <library-path> properties for all searched libraries extra = [] for s in sources: if s.type() == 'SEARCHED_LIB': search = s.search() extra.extend( property.Property('<library-path>', sp) for sp in search) orig_xdll_path = [] if prop_set.get('<hardcode-dll-paths>') == ['true'] \ and type.is_derived(self.target_types_ [0], 'EXE'): xdll_path = prop_set.get('<xdll-path>') orig_xdll_path = [ replace_grist(x, '<dll-path>') for x in xdll_path ] # It's possible that we have libraries in sources which did not came # from 'lib' target. For example, libraries which are specified # just as filenames as sources. We don't have xdll-path properties # for such target, but still need to add proper dll-path properties. for s in sources: if type.is_derived(s.type(), 'SHARED_LIB') and not s.action(): # Unfortunately, we don't have a good way to find the path # to a file, so use this nasty approach. p = s.project() location = path.root(s.name(), p.get('source-location')) xdll_path.append(path.parent(location)) extra.extend( property.Property('<dll-path>', sp) for sp in xdll_path) if extra: prop_set = prop_set.add_raw(extra) result = generators.Generator.run(self, project, name, prop_set, sources) if result: ur = self.extra_usage_requirements(result, prop_set) ur = ur.add(property_set.create(orig_xdll_path)) else: return None return (ur, result)
def boost_std(inc=None, lib=None): # The default definitions for pre-built libraries. rules.project(['boost'], ['usage-requirements'] + ['<include>{}'.format(i) for i in inc] + ['<define>BOOST_ALL_NO_LIB'], ['requirements'] + ['<search>{}'.format(l) for l in lib]) # TODO: There should be a better way to add a Python function into a # project requirements property set. tag_prop_set = property_set.create([property.Property('<tag>', tag_std)]) attributes = projects.attributes(projects.current().project_module()) attributes.requirements = attributes.requirements.refine(tag_prop_set) alias('headers') def boost_lib(lib_name, dyn_link_macro): if (isinstance(lib_name, str)): lib_name = [lib_name] builtin.lib(lib_name, usage_requirements=[ '<link>shared:<define>{}'.format(dyn_link_macro) ]) boost_lib('container', 'BOOST_CONTAINER_DYN_LINK') boost_lib('date_time', 'BOOST_DATE_TIME_DYN_LINK') boost_lib('filesystem', 'BOOST_FILE_SYSTEM_DYN_LINK') boost_lib('graph', 'BOOST_GRAPH_DYN_LINK') boost_lib('graph_parallel', 'BOOST_GRAPH_DYN_LINK') boost_lib('iostreams', 'BOOST_IOSTREAMS_DYN_LINK') boost_lib('locale', 'BOOST_LOG_DYN_LINK') boost_lib('log', 'BOOST_LOG_DYN_LINK') boost_lib('log_setup', 'BOOST_LOG_DYN_LINK') boost_lib('math_tr1', 'BOOST_MATH_TR1_DYN_LINK') boost_lib('math_tr1f', 'BOOST_MATH_TR1_DYN_LINK') boost_lib('math_tr1l', 'BOOST_MATH_TR1_DYN_LINK') boost_lib('math_c99', 'BOOST_MATH_TR1_DYN_LINK') boost_lib('math_c99f', 'BOOST_MATH_TR1_DYN_LINK') boost_lib('math_c99l', 'BOOST_MATH_TR1_DYN_LINK') boost_lib('mpi', 'BOOST_MPI_DYN_LINK') boost_lib('program_options', 'BOOST_PROGRAM_OPTIONS_DYN_LINK') boost_lib('python', 'BOOST_PYTHON_DYN_LINK') boost_lib('python3', 'BOOST_PYTHON_DYN_LINK') boost_lib('random', 'BOOST_RANDOM_DYN_LINK') boost_lib('regex', 'BOOST_REGEX_DYN_LINK') boost_lib('serialization', 'BOOST_SERIALIZATION_DYN_LINK') boost_lib('wserialization', 'BOOST_SERIALIZATION_DYN_LINK') boost_lib('signals', 'BOOST_SIGNALS_DYN_LINK') boost_lib('system', 'BOOST_SYSTEM_DYN_LINK') boost_lib('unit_test_framework', 'BOOST_TEST_DYN_LINK') boost_lib('prg_exec_monitor', 'BOOST_TEST_DYN_LINK') boost_lib('test_exec_monitor', 'BOOST_TEST_DYN_LINK') boost_lib('thread', 'BOOST_THREAD_DYN_DLL') boost_lib('wave', 'BOOST_WAVE_DYN_LINK')
def adjust_properties(self, target, build_ps): a = target.action() properties = [] if a: ps = a.properties() properties = ps.all() # Unless <hardcode-dll-paths>true is in properties, which can happen # only if the user has explicitly requested it, nuke all <dll-path> # properties. if build_ps.get('hardcode-dll-paths') != ['true']: properties = [ p for p in properties if p.feature().name() != 'dll-path' ] # If any <dll-path> properties were specified for installing, add # them. properties.extend(build_ps.get_properties('dll-path')) # Also copy <linkflags> feature from current build set, to be used # for relinking. properties.extend(build_ps.get_properties('linkflags')) # Remove the <tag> feature on original targets. # And <location>. If stage target has another stage target in # sources, then we shall get virtual targets with the <location> # property set. properties = [ p for p in properties if not p.feature().name() in ['tag', 'location'] ] properties.extend(build_ps.get_properties('dependency')) properties.extend(build_ps.get_properties('location')) properties.extend( build_ps.get_properties('install-no-version-symlinks')) d = build_ps.get_properties('install-source-root') # Make the path absolute: we shall use it to compute relative paths and # making the path absolute will help. if d: p = d[0] properties.append( property.Property(p.feature(), os.path.abspath(p.value()))) return property_set.create(properties)
def run (self, project, name, prop_set, sources): assert isinstance(project, targets.ProjectTarget) assert isinstance(name, basestring) or name is None assert isinstance(prop_set, property_set.PropertySet) assert is_iterable_typed(sources, virtual_target.VirtualTarget) # create a copy since this modifies the sources list sources = list(sources) sources.extend(prop_set.get('<library>')) result = generators.Generator.run (self, project, name, prop_set, sources) usage_requirements = [] link = prop_set.get('<link>') if 'static' in link: for t in sources: if type.is_derived(t.type(), 'LIB'): usage_requirements.append(property.Property('<library>', t)) usage_requirements = property_set.create(usage_requirements) return usage_requirements, result
import bjam from b2.build import alias, property, property_set, feature from b2.manager import get_manager from b2.tools import builtin, common from b2.util import bjam_signature, regex # TODO: This is currently necessary in Python Port, but was not in Jam. feature.feature('layout', ['system', 'versioned', 'tag'], ['optional']) feature.feature('root', [], ['optional', 'free']) feature.feature('build-id', [], ['optional', 'free']) __initialized = None __boost_auto_config = property_set.create([property.Property('layout', 'system')]) __boost_configured = {} __boost_default = None __build_id = None __debug = None def debug(): global __debug if __debug is None: __debug = "--debug-configuration" in bjam.variable("ARGV") return __debug # Configuration of the boost library to use. #
import bjam from b2.build import alias, property, property_set, feature from b2.manager import get_manager from b2.tools import builtin, common from b2.util import bjam_signature, regex # TODO: This is currently necessary in Python Port, but was not in Jam. feature.feature('layout', ['system', 'versioned', 'tag'], ['optional']) feature.feature('root', [], ['optional', 'free']) feature.feature('build-id', [], ['optional', 'free']) __initialized = None __boost_auto_config = property_set.create( [property.Property('layout', 'system')]) __boost_configured = {} __boost_default = None __build_id = None __debug = None def debug(): global __debug if __debug is None: __debug = "--debug-configuration" in bjam.variable("ARGV") return __debug # Configuration of the boost library to use.