(target_list, target_dicts,
                             shared_intermediate_dirs, config_name, params,
                             compiler_path)
return all_includes_list
Calculate the set of include directories to be used.

  Returns:
    A list including all the include_dir's specified for every target followed
    by any include directories that were added as cflag compiler options.
Calculate the set of include directories to be used.
Calculate the set of include directories to be used .
def GetAllIncludeDirectories(target_list, target_dicts,
                             shared_intermediate_dirs, config_name, params,
                             compiler_path):
  """Calculate the set of include directories to be used.

  Returns:
    A list including all the include_dir's specified for every target followed
    by any include directories that were added as cflag compiler options.
  """

  gyp_includes_set = set()
  compiler_includes_list = []

  # Find compiler's default include dirs.
  if compiler_path:
    command = shlex.split(compiler_path)
    command.extend(['-E', '-xc++', '-v', '-'])
    proc = subprocess.Popen(args=command, stdin=subprocess.PIPE,
                            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    output = proc.communicate()[1]
    # Extract the list of include dirs from the output, which has this format:
    #   ...
    #   #include "..." search starts here:
    #   #include <...> search starts here:
    #    /usr/include/c++/4.6
    #    /usr/local/include
    #   End of search list.
    #   ...
    in_include_list = False
    for line in output.splitlines():
      if line.startswith('#include'):
        in_include_list = True
        continue
      if line.startswith('End of search list.'):
        break
      if in_include_list:
        include_dir = line.strip()
        if include_dir not in compiler_includes_list:
          compiler_includes_list.append(include_dir)

  flavor = gyp.common.GetFlavor(params)
  if flavor == 'win':
    generator_flags = params.get('generator_flags', {})
  for target_name in target_list:
    target = target_dicts[target_name]
    if config_name in target['configurations']:
      config = target['configurations'][config_name]

      # Look for any include dirs that were explicitly added via cflags. This
      # may be done in gyp files to force certain includes to come at the end.
      # TODO(jgreenwald): Change the gyp files to not abuse cflags for this, and
      # remove this.
      if flavor == 'win':
        msvs_settings = gyp.msvs_emulation.MsvsSettings(target, generator_flags)
        cflags = msvs_settings.GetCflags(config_name)
      else:
        cflags = config['cflags']
      for cflag in cflags:
        if cflag.startswith('-I'):
          include_dir = cflag[2:]
          if include_dir not in compiler_includes_list:
            compiler_includes_list.append(include_dir)

      # Find standard gyp include dirs.
      if config.has_key('include_dirs'):
        include_dirs = config['include_dirs']
        for shared_intermediate_dir in shared_intermediate_dirs:
          for include_dir in include_dirs:
            include_dir = include_dir.replace('$SHARED_INTERMEDIATE_DIR',
                                              shared_intermediate_dir)
            if not os.path.isabs(include_dir):
              base_dir = os.path.dirname(target_name)

              include_dir = base_dir + '/' + include_dir
              include_dir = os.path.abspath(include_dir)

            gyp_includes_set.add(include_dir)

  # Generate a list that has all the include dirs.
  all_includes_list = list(gyp_includes_set)
  all_includes_list.sort()
  for compiler_include in compiler_includes_list:
    if not compiler_include in gyp_includes_set:
      all_includes_list.append(compiler_include)

  # All done.
  return all_includes_list
def GetAllIncludeDirectories ( target_list , target_dicts , shared_intermediate_dirs , config_name , params , compiler_path ) : gyp_includes_set = set ( ) compiler_includes_list = [ ] # Find compiler's default include dirs. if compiler_path : command = shlex . split ( compiler_path ) command . extend ( [ '-E' , '-xc++' , '-v' , '-' ] ) proc = subprocess . Popen ( args = command , stdin = subprocess . PIPE , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) output = proc . communicate ( ) [ 1 ] # Extract the list of include dirs from the output, which has this format: #   ... #   #include "..." search starts here: #   #include <...> search starts here: #    /usr/include/c++/4.6 #    /usr/local/include #   End of search list. #   ... in_include_list = False for line in output . splitlines ( ) : if line . startswith ( '#include' ) : in_include_list = True continue if line . startswith ( 'End of search list.' ) : break if in_include_list : include_dir = line . strip ( ) if include_dir not in compiler_includes_list : compiler_includes_list . append ( include_dir ) flavor = gyp . common . GetFlavor ( params ) if flavor == 'win' : generator_flags = params . get ( 'generator_flags' , { } ) for target_name in target_list : target = target_dicts [ target_name ] if config_name in target [ 'configurations' ] : config = target [ 'configurations' ] [ config_name ] # Look for any include dirs that were explicitly added via cflags. This # may be done in gyp files to force certain includes to come at the end. # TODO(jgreenwald): Change the gyp files to not abuse cflags for this, and # remove this. if flavor == 'win' : msvs_settings = gyp . msvs_emulation . MsvsSettings ( target , generator_flags ) cflags = msvs_settings . GetCflags ( config_name ) else : cflags = config [ 'cflags' ] for cflag in cflags : if cflag . startswith ( '-I' ) : include_dir = cflag [ 2 : ] if include_dir not in compiler_includes_list : compiler_includes_list . append ( include_dir ) # Find standard gyp include dirs. if config . has_key ( 'include_dirs' ) : include_dirs = config [ 'include_dirs' ] for shared_intermediate_dir in shared_intermediate_dirs : for include_dir in include_dirs : include_dir = include_dir . replace ( '$SHARED_INTERMEDIATE_DIR' , shared_intermediate_dir ) if not os . path . isabs ( include_dir ) : base_dir = os . path . dirname ( target_name ) include_dir = base_dir + '/' + include_dir include_dir = os . path . abspath ( include_dir ) gyp_includes_set . add ( include_dir ) # Generate a list that has all the include dirs. all_includes_list = list ( gyp_includes_set ) all_includes_list . sort ( ) for compiler_include in compiler_includes_list : if not compiler_include in gyp_includes_set : all_includes_list . append ( compiler_include ) # All done. return all_includes_list