parameters: (self, lib_configuration, input_uselib_name, header_only_library, lib_required)
docstring: Apply all the uselib related values (INCLUDES, LIB, etc) for a uselib based on the configuration
  
          :param lib_configuration:       debug or release
          :param input_uselib_name:       The base uselib name
          :param header_only_library:     Flag to indicate this is a header only lib (no libs)
          :param lib_required:            Flag to indicate that this is a required lib
docstring_summary: Apply all the uselib related values (INCLUDES, LIB, etc) for a uselib based on the configuration
docstring_tokens: Apply all the uselib related values ( INCLUDES LIB etc ) for a uselib based on the configuration
function: def apply_uselib_from_config(self, lib_configuration, input_uselib_name, header_only_library, lib_required):
          """
          Apply all the uselib related values (INCLUDES, LIB, etc) for a uselib based on the configuration
  
          :param lib_configuration:       debug or release
          :param input_uselib_name:       The base uselib name
          :param header_only_library:     Flag to indicate this is a header only lib (no libs)
          :param lib_required:            Flag to indicate that this is a required lib
          """
  
          # Pre-process the required "source" key at the root
          if "source" not in self.lib_root:
              self.raise_config_error("Missing required 'source' attribute in configuration file")
          lib_rel_source = self.lib_root["source"]
          if len(lib_rel_source) == 0:
              self.raise_config_error("Invalid empty 'source' attribute in configuration file")
  
          # Pre-process the path
          lib_source_path = self.apply_optional_path_alias(lib_rel_source, None)
  
          # Since copy_extra commands are most likely duplicated across multiple uselibs in the same library definition file, we will cache
          # the values and apply aliases as much as possible to reduce overhead in the cache file
          copy_extra_cache = {}
  
          # Maintain a map of static libs based on the compound key ${platform}_${configuration}
          platform_config_lib_map = {}
  
          # Work on either a list of uselibs or a single uselib
          uselib_names = [input_uselib_name] if isinstance(input_uselib_name,str) else input_uselib_name
  
          def debug_log(message):
              Logs.debug('third_party: {}'.format(message))
  
          debug_log('----------------')
          debug_log('Processing {} for {}_{}'.format(self.lib_key, self.platform_key, self.configuration_key))
  
          for uselib_name in uselib_names:
  
              uselib_env_name = uselib_name.upper()
  
              # Find the most specific include path and apply it
              include_paths = self.get_most_specific_entry("includes", uselib_name, lib_configuration)
              self.apply_uselib_values_file_path(uselib_env_name, include_paths, "INCLUDES", lib_source_path)
  
              system_include_paths = self.get_most_specific_entry("system_includes", uselib_name, lib_configuration)
              self.apply_uselib_values_file_path(uselib_env_name, system_include_paths, "SYSTEM_INCLUDES", lib_source_path)
  
              # Read and apply the values for DEFINES_(uselib_name)
              defines = self.get_most_specific_entry("defines", uselib_name, lib_configuration)
              self.apply_uselib_values_general(uselib_env_name, defines, "DEFINES")
  
              if header_only_library:
                  # If this is a header only library, then no need to look for libs/binaries
                  return True, None
  
              # symlink_patterns
              symlink_patterns = self.get_most_specific_entry("symlink_patterns", uselib_name, lib_configuration)
              if symlink_patterns:
                  self.apply_uselib_values_general(uselib_env_name, symlink_patterns, "SYMLINK_PATTERNS")
  
              # Determine what kind of libraries we are using
              static_lib_paths = self.get_most_specific_entry("libpath", uselib_name, lib_configuration)
              static_lib_filenames = self.get_most_specific_entry("lib", uselib_name, lib_configuration)
              has_static_libs =  bool(static_lib_paths and static_lib_filenames)
  
              import_lib_paths = self.get_most_specific_entry("importlibpath", uselib_name, lib_configuration)
              import_lib_filenames = self.get_most_specific_entry("import", uselib_name, lib_configuration)
              has_import_libs = bool(import_lib_paths and import_lib_filenames)
  
              shared_lib_paths = self.get_most_specific_entry("sharedlibpath", uselib_name, lib_configuration)
              shared_lib_filenames = self.get_most_specific_entry("shared", uselib_name, lib_configuration)
              has_shared_libs = bool(shared_lib_paths and shared_lib_filenames)
  
              framework_paths = self.get_most_specific_entry("frameworkpath", uselib_name, lib_configuration)
              frameworks = self.get_most_specific_entry("framework", uselib_name, lib_configuration)
              has_frameworks = bool(framework_paths and frameworks)
  
              apply_lib_types = []
  
              # since the uselib system will pull all variable variants specified for that lib, we need to make sure the
              # correct version of the library is specified for the current variant.
              if has_static_libs and (has_shared_libs or has_import_libs):
                  debug_log(' - Detected both STATIC and SHARED libs for {}'.format(uselib_name))
  
                  if self.ctx.is_build_monolithic(self.platform_key, self.configuration_key):
                      apply_lib_types.append('static')
                  else:
                      apply_lib_types.append('shared')
  
              elif has_static_libs:
                  apply_lib_types.append('static')
  
              elif has_shared_libs or has_import_libs:
                  apply_lib_types.append('shared')
  
              if framework_paths:
                  apply_lib_types.append('framework')
  
              # Apply any system libs that may be specified
              static_system_lib_names = self.get_most_specific_entry("system_static_lib", uselib_name, lib_configuration)
              if static_system_lib_names:
                  self.apply_uselib_values_general(uselib_env_name, static_system_lib_names, "STLIB")
  
              shared_system_lib_names = self.get_most_specific_entry("system_lib", uselib_name, lib_configuration)
              if shared_system_lib_names:
                  self.apply_uselib_values_general(uselib_env_name, shared_system_lib_names, "LIB")
                  
              system_framework_names = self.get_most_specific_entry("system_framework", uselib_name, lib_configuration)
              if system_framework_names:
                  self.apply_framework(uselib_env_name, system_framework_names)
  
              # apply the static libraries, if specified
              if 'static' in apply_lib_types:
                  debug_log(' - Adding STATIC libs for {}'.format(uselib_name))
  
                  defines = self.get_most_specific_entry("defines_static", uselib_name, lib_configuration)
                  self.apply_uselib_values_general(uselib_env_name, defines, "DEFINES")
  
                  self.apply_uselib_values_file_path(uselib_env_name, static_lib_paths, 'STLIBPATH', lib_source_path)
                  self.apply_lib_based_uselib(static_lib_filenames, static_lib_paths, 'STLIB', uselib_env_name, lib_source_path, lib_required, False, lib_configuration, platform_config_lib_map)
  
              # apply the frameworks, if specified
              if 'framework' in apply_lib_types:
                  debug_log(' - Adding FRAMEWORKS for {}'.format(uselib_name))
                  self.apply_uselib_values_file_path(uselib_env_name, framework_paths, "FRAMEWORKPATH", lib_source_path)
                  self.apply_framework(uselib_env_name, frameworks)
  
              # Apply the link flags flag if any
              link_flags = self.get_most_specific_entry("linkflags", uselib_name, lib_configuration)
              self.apply_uselib_values_general(uselib_env_name, link_flags, "LINKFLAGS", lib_configuration, platform_config_lib_map)
  
              # Apply any optional c/cpp compile flags if any
              cc_flags = self.get_most_specific_entry("ccflags", uselib_name, lib_configuration)
              self.apply_uselib_values_general(uselib_env_name, cc_flags, "CFLAGS", lib_configuration, platform_config_lib_map)
              self.apply_uselib_values_general(uselib_env_name, cc_flags, "CXXFLAGS", lib_configuration, platform_config_lib_map)
  
              # apply the shared libraries, if specified
              if 'shared' in apply_lib_types:
                  debug_log(' - Adding SHARED libs for {}'.format(uselib_name))
  
                  linkage_lib_paths = shared_lib_paths
                  linkage_lib_filenames = shared_lib_filenames
  
                  if import_lib_paths and import_lib_filenames:
                      debug_log('- Adding IMPORT libs for {}'.format(uselib_name))
                      linkage_lib_paths = import_lib_paths
                      linkage_lib_filenames = import_lib_filenames
  
                  self.apply_uselib_values_file_path(uselib_env_name, linkage_lib_paths, "LIBPATH", lib_source_path)
                  self.apply_lib_based_uselib(linkage_lib_filenames, linkage_lib_paths, "LIB", uselib_env_name, lib_source_path, lib_required, False, lib_configuration, platform_config_lib_map)
  
                  defines = self.get_most_specific_entry("defines_shared", uselib_name, lib_configuration)
                  self.apply_uselib_values_general(uselib_env_name, defines, "DEFINES")
  
                  # Special case, specific to qt.  Since we are copying the dlls as part of the qt5 bootstrap, we will ignore the shared variables if we are working on the qt5 lib
                  if self.lib_key == 'qt5':
                      continue
  
                  # keep the SHAREDLIB* vars around to house the full library names for copying
                  self.apply_uselib_values_file_path(uselib_env_name, shared_lib_paths, "SHAREDLIBPATH", lib_source_path)
                  self.apply_uselib_values_general(uselib_env_name, shared_lib_filenames, "SHAREDLIB")
  
                  # Read and apply the values for PDB_(uselib_name)
                  pdb_filenames = self.get_most_specific_entry("pdb", uselib_name, lib_configuration)
                  combined_paths = (static_lib_paths if static_lib_paths is not None else []) + (shared_lib_paths if shared_lib_paths is not None else []) + (import_lib_paths if import_lib_paths is not None else [])
                  if len(combined_paths) > 0:
                      self.apply_lib_based_uselib(pdb_filenames, combined_paths, "PDB", uselib_env_name, lib_source_path, False, True)
  
              copy_extras = self.get_most_specific_entry("copy_extra", uselib_name, lib_configuration)
              if copy_extras is not None:
                  copy_extras_key = '.'.join(copy_extras)
                  if copy_extras_key in copy_extra_cache:
                      copy_extra_base = copy_extra_cache[copy_extras_key]
                      uselib_env_key = 'COPY_EXTRA_{}'.format(uselib_env_name)
                      self.apply_env_func(uselib_env_key, '@{}'.format(copy_extra_base))
                  else:
                      copy_extra_cache[copy_extras_key] = uselib_env_name
                      self.apply_copy_extra_values(lib_source_path, copy_extras, uselib_env_name)
function_tokens: def apply_uselib_from_config ( self , lib_configuration , input_uselib_name , header_only_library , lib_required ) : # Pre-process the required "source" key at the root if "source" not in self . lib_root : self . raise_config_error ( "Missing required 'source' attribute in configuration file" ) lib_rel_source = self . lib_root [ "source" ] if len ( lib_rel_source ) == 0 : self . raise_config_error ( "Invalid empty 'source' attribute in configuration file" ) # Pre-process the path lib_source_path = self . apply_optional_path_alias ( lib_rel_source , None ) # Since copy_extra commands are most likely duplicated across multiple uselibs in the same library definition file, we will cache # the values and apply aliases as much as possible to reduce overhead in the cache file copy_extra_cache = { } # Maintain a map of static libs based on the compound key ${platform}_${configuration} platform_config_lib_map = { } # Work on either a list of uselibs or a single uselib uselib_names = [ input_uselib_name ] if isinstance ( input_uselib_name , str ) else input_uselib_name def debug_log ( message ) : Logs . debug ( 'third_party: {}' . format ( message ) ) debug_log ( '----------------' ) debug_log ( 'Processing {} for {}_{}' . format ( self . lib_key , self . platform_key , self . configuration_key ) ) for uselib_name in uselib_names : uselib_env_name = uselib_name . upper ( ) # Find the most specific include path and apply it include_paths = self . get_most_specific_entry ( "includes" , uselib_name , lib_configuration ) self . apply_uselib_values_file_path ( uselib_env_name , include_paths , "INCLUDES" , lib_source_path ) system_include_paths = self . get_most_specific_entry ( "system_includes" , uselib_name , lib_configuration ) self . apply_uselib_values_file_path ( uselib_env_name , system_include_paths , "SYSTEM_INCLUDES" , lib_source_path ) # Read and apply the values for DEFINES_(uselib_name) defines = self . get_most_specific_entry ( "defines" , uselib_name , lib_configuration ) self . apply_uselib_values_general ( uselib_env_name , defines , "DEFINES" ) if header_only_library : # If this is a header only library, then no need to look for libs/binaries return True , None # symlink_patterns symlink_patterns = self . get_most_specific_entry ( "symlink_patterns" , uselib_name , lib_configuration ) if symlink_patterns : self . apply_uselib_values_general ( uselib_env_name , symlink_patterns , "SYMLINK_PATTERNS" ) # Determine what kind of libraries we are using static_lib_paths = self . get_most_specific_entry ( "libpath" , uselib_name , lib_configuration ) static_lib_filenames = self . get_most_specific_entry ( "lib" , uselib_name , lib_configuration ) has_static_libs = bool ( static_lib_paths and static_lib_filenames ) import_lib_paths = self . get_most_specific_entry ( "importlibpath" , uselib_name , lib_configuration ) import_lib_filenames = self . get_most_specific_entry ( "import" , uselib_name , lib_configuration ) has_import_libs = bool ( import_lib_paths and import_lib_filenames ) shared_lib_paths = self . get_most_specific_entry ( "sharedlibpath" , uselib_name , lib_configuration ) shared_lib_filenames = self . get_most_specific_entry ( "shared" , uselib_name , lib_configuration ) has_shared_libs = bool ( shared_lib_paths and shared_lib_filenames ) framework_paths = self . get_most_specific_entry ( "frameworkpath" , uselib_name , lib_configuration ) frameworks = self . get_most_specific_entry ( "framework" , uselib_name , lib_configuration ) has_frameworks = bool ( framework_paths and frameworks ) apply_lib_types = [ ] # since the uselib system will pull all variable variants specified for that lib, we need to make sure the # correct version of the library is specified for the current variant. if has_static_libs and ( has_shared_libs or has_import_libs ) : debug_log ( ' - Detected both STATIC and SHARED libs for {}' . format ( uselib_name ) ) if self . ctx . is_build_monolithic ( self . platform_key , self . configuration_key ) : apply_lib_types . append ( 'static' ) else : apply_lib_types . append ( 'shared' ) elif has_static_libs : apply_lib_types . append ( 'static' ) elif has_shared_libs or has_import_libs : apply_lib_types . append ( 'shared' ) if framework_paths : apply_lib_types . append ( 'framework' ) # Apply any system libs that may be specified static_system_lib_names = self . get_most_specific_entry ( "system_static_lib" , uselib_name , lib_configuration ) if static_system_lib_names : self . apply_uselib_values_general ( uselib_env_name , static_system_lib_names , "STLIB" ) shared_system_lib_names = self . get_most_specific_entry ( "system_lib" , uselib_name , lib_configuration ) if shared_system_lib_names : self . apply_uselib_values_general ( uselib_env_name , shared_system_lib_names , "LIB" ) system_framework_names = self . get_most_specific_entry ( "system_framework" , uselib_name , lib_configuration ) if system_framework_names : self . apply_framework ( uselib_env_name , system_framework_names ) # apply the static libraries, if specified if 'static' in apply_lib_types : debug_log ( ' - Adding STATIC libs for {}' . format ( uselib_name ) ) defines = self . get_most_specific_entry ( "defines_static" , uselib_name , lib_configuration ) self . apply_uselib_values_general ( uselib_env_name , defines , "DEFINES" ) self . apply_uselib_values_file_path ( uselib_env_name , static_lib_paths , 'STLIBPATH' , lib_source_path ) self . apply_lib_based_uselib ( static_lib_filenames , static_lib_paths , 'STLIB' , uselib_env_name , lib_source_path , lib_required , False , lib_configuration , platform_config_lib_map ) # apply the frameworks, if specified if 'framework' in apply_lib_types : debug_log ( ' - Adding FRAMEWORKS for {}' . format ( uselib_name ) ) self . apply_uselib_values_file_path ( uselib_env_name , framework_paths , "FRAMEWORKPATH" , lib_source_path ) self . apply_framework ( uselib_env_name , frameworks ) # Apply the link flags flag if any link_flags = self . get_most_specific_entry ( "linkflags" , uselib_name , lib_configuration ) self . apply_uselib_values_general ( uselib_env_name , link_flags , "LINKFLAGS" , lib_configuration , platform_config_lib_map ) # Apply any optional c/cpp compile flags if any cc_flags = self . get_most_specific_entry ( "ccflags" , uselib_name , lib_configuration ) self . apply_uselib_values_general ( uselib_env_name , cc_flags , "CFLAGS" , lib_configuration , platform_config_lib_map ) self . apply_uselib_values_general ( uselib_env_name , cc_flags , "CXXFLAGS" , lib_configuration , platform_config_lib_map ) # apply the shared libraries, if specified if 'shared' in apply_lib_types : debug_log ( ' - Adding SHARED libs for {}' . format ( uselib_name ) ) linkage_lib_paths = shared_lib_paths linkage_lib_filenames = shared_lib_filenames if import_lib_paths and import_lib_filenames : debug_log ( '- Adding IMPORT libs for {}' . format ( uselib_name ) ) linkage_lib_paths = import_lib_paths linkage_lib_filenames = import_lib_filenames self . apply_uselib_values_file_path ( uselib_env_name , linkage_lib_paths , "LIBPATH" , lib_source_path ) self . apply_lib_based_uselib ( linkage_lib_filenames , linkage_lib_paths , "LIB" , uselib_env_name , lib_source_path , lib_required , False , lib_configuration , platform_config_lib_map ) defines = self . get_most_specific_entry ( "defines_shared" , uselib_name , lib_configuration ) self . apply_uselib_values_general ( uselib_env_name , defines , "DEFINES" ) # Special case, specific to qt.  Since we are copying the dlls as part of the qt5 bootstrap, we will ignore the shared variables if we are working on the qt5 lib if self . lib_key == 'qt5' : continue # keep the SHAREDLIB* vars around to house the full library names for copying self . apply_uselib_values_file_path ( uselib_env_name , shared_lib_paths , "SHAREDLIBPATH" , lib_source_path ) self . apply_uselib_values_general ( uselib_env_name , shared_lib_filenames , "SHAREDLIB" ) # Read and apply the values for PDB_(uselib_name) pdb_filenames = self . get_most_specific_entry ( "pdb" , uselib_name , lib_configuration ) combined_paths = ( static_lib_paths if static_lib_paths is not None else [ ] ) + ( shared_lib_paths if shared_lib_paths is not None else [ ] ) + ( import_lib_paths if import_lib_paths is not None else [ ] ) if len ( combined_paths ) > 0 : self . apply_lib_based_uselib ( pdb_filenames , combined_paths , "PDB" , uselib_env_name , lib_source_path , False , True ) copy_extras = self . get_most_specific_entry ( "copy_extra" , uselib_name , lib_configuration ) if copy_extras is not None : copy_extras_key = '.' . join ( copy_extras ) if copy_extras_key in copy_extra_cache : copy_extra_base = copy_extra_cache [ copy_extras_key ] uselib_env_key = 'COPY_EXTRA_{}' . format ( uselib_env_name ) self . apply_env_func ( uselib_env_key , '@{}' . format ( copy_extra_base ) ) else : copy_extra_cache [ copy_extras_key ] = uselib_env_name self . apply_copy_extra_values ( lib_source_path , copy_extras , uselib_env_name )