コード例 #1
0
ファイル: CxxPlatforms.java プロジェクト: LittlePeng/buck
  public static CxxPlatform build(
      Flavor flavor,
      Platform platform,
      CxxBuckConfig config,
      Tool as,
      Tool aspp,
      Tool cc,
      Tool cxx,
      Tool cpp,
      Tool cxxpp,
      Tool cxxld,
      Optional<CxxPlatform.LinkerType> linkerType,
      Tool ld,
      Iterable<String> ldFlags,
      Tool ar,
      byte[] expectedGlobalHeader,
      ImmutableList<String> cflags,
      ImmutableList<String> cppflags,
      Optional<Tool> lex,
      Optional<Tool> yacc,
      Optional<DebugPathSanitizer> debugPathSanitizer) {
    // TODO(user, agallagher): Generalize this so we don't need all these setters.
    CxxPlatform.Builder builder = CxxPlatform.builder();

    builder
        .setFlavor(flavor)
        .setAs(getTool(flavor, "as", config).or(as))
        .setAspp(getTool(flavor, "aspp", config).or(aspp))
        .setCc(getTool(flavor, "cc", config).or(cc))
        .setCxx(getTool(flavor, "cxx", config).or(cxx))
        .setCpp(getTool(flavor, "cpp", config).or(cpp))
        .setCxxpp(getTool(flavor, "cxxpp", config).or(cxxpp))
        .setCxxld(getTool(flavor, "cxxld", config).or(cxxld))
        .setLd(getLd(flavor, platform, config, linkerType, getTool(flavor, "ld", config).or(ld)))
        .addAllLdflags(ldFlags)
        .setAr(getTool(flavor, "ar", config).or(ar))
        .setArExpectedGlobalHeader(expectedGlobalHeader)
        .setLex(getTool(flavor, "lex", config).or(lex))
        .setYacc(getTool(flavor, "yacc", config).or(yacc))
        .setSharedLibraryExtension(CxxPlatforms.getSharedLibraryExtension(platform))
        .setDebugPathSanitizer(debugPathSanitizer.or(CxxPlatforms.DEFAULT_DEBUG_PATH_SANITIZER));
    builder.addAllCflags(cflags);
    builder.addAllCxxflags(cflags);
    builder.addAllCppflags(cppflags);
    builder.addAllCxxppflags(cppflags);
    builder.addAllCxxldflags(cflags);
    CxxPlatforms.addToolFlagsFromConfig(config, builder);
    return builder.build();
  }
コード例 #2
0
ファイル: CxxPlatforms.java プロジェクト: LittlePeng/buck
 public static void addToolFlagsFromConfig(CxxBuckConfig config, CxxPlatform.Builder builder) {
   ImmutableList<String> asflags = config.getFlags("asflags").or(DEFAULT_ASFLAGS);
   ImmutableList<String> cflags = config.getFlags("cflags").or(DEFAULT_CFLAGS);
   ImmutableList<String> cxxflags = config.getFlags("cxxflags").or(DEFAULT_CXXFLAGS);
   builder
       .addAllAsflags(asflags)
       .addAllAsppflags(config.getFlags("asppflags").or(DEFAULT_ASPPFLAGS))
       .addAllAsppflags(asflags)
       .addAllCflags(cflags)
       .addAllCxxflags(cxxflags)
       .addAllCppflags(config.getFlags("cppflags").or(DEFAULT_CPPFLAGS))
       .addAllCppflags(cflags)
       .addAllCxxppflags(config.getFlags("cxxppflags").or(DEFAULT_CXXPPFLAGS))
       .addAllCxxppflags(cxxflags)
       .addAllCxxldflags(config.getFlags("cxxldflags").or(DEFAULT_CXXLDFLAGS))
       .addAllLdflags(config.getFlags("ldflags").or(DEFAULT_LDFLAGS))
       .addAllArflags(config.getFlags("arflags").or(DEFAULT_ARFLAGS))
       .addAllLexFlags(config.getFlags("lexflags").or(DEFAULT_LEX_FLAGS))
       .addAllYaccFlags(config.getFlags("yaccflags").or(DEFAULT_YACC_FLAGS));
 }