use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.
the class AppleCxxPlatformsTest method cxxToolParamsReadFromBuckConfig.
@Test
public void cxxToolParamsReadFromBuckConfig() throws Exception {
AppleSdkPaths appleSdkPaths = AppleSdkPaths.builder().setDeveloperPath(Paths.get(".")).addToolchainPaths(Paths.get("Toolchains/XcodeDefault.xctoolchain")).setPlatformPath(Paths.get("Platforms/iPhoneOS.platform")).setSdkPath(Paths.get("Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk")).build();
ImmutableSet<Path> paths = ImmutableSet.<Path>builder().addAll(COMMON_KNOWN_PATHS).add(Paths.get("Platforms/iPhoneOS.platform/Developer/usr/bin/libtool")).add(Paths.get("Platforms/iPhoneOS.platform/Developer/usr/bin/ar")).add(Paths.get("Tools/otest")).build();
AppleToolchain toolchain = AppleToolchain.builder().setIdentifier("com.apple.dt.XcodeDefault").setPath(Paths.get("Toolchains/XcodeDefault.xctoolchain")).setVersion("1").build();
AppleSdk targetSdk = AppleSdk.builder().setApplePlatform(ApplePlatform.IPHONEOS).setName("iphoneos8.0").setVersion("8.0").setToolchains(ImmutableList.of(toolchain)).build();
AppleCxxPlatform appleCxxPlatform = AppleCxxPlatforms.buildWithExecutableChecker(projectFilesystem, targetSdk, "7.0", "armv7", appleSdkPaths, FakeBuckConfig.builder().setSections(ImmutableMap.of("cxx", ImmutableMap.of("cflags", "-std=gnu11", "cppflags", "-DCTHING", "cxxflags", "-std=c++11", "cxxppflags", "-DCXXTHING"))).build(), new FakeAppleConfig(), new FakeExecutableFinder(paths), Optional.empty(), Optional.empty());
CxxPlatform cxxPlatform = appleCxxPlatform.getCxxPlatform();
assertThat(cxxPlatform.getCflags(), hasItem("-std=gnu11"));
assertThat(cxxPlatform.getCppflags(), hasItems("-DCTHING"));
assertThat(cxxPlatform.getCxxflags(), hasItem("-std=c++11"));
assertThat(cxxPlatform.getCxxppflags(), hasItems("-DCXXTHING"));
}
use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.
the class CxxPlatformXcodeConfigGeneratorTest method testResultHasIphoneOsSdkRootTakenFromIphoneSimulatorFlavor.
@Test
public void testResultHasIphoneOsSdkRootTakenFromIphoneSimulatorFlavor() {
CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setFlavor(InternalFlavor.of("iphonesimulator-x86_64")).build();
ImmutableMap<String, ImmutableMap<String, String>> buildConfigs = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform(platform, new LinkedHashMap<String, String>());
ImmutableMap<String, String> config = buildConfigs.get(CxxPlatformXcodeConfigGenerator.DEBUG_BUILD_CONFIGURATION_NAME);
assertThat(config.get(CxxPlatformXcodeConfigGenerator.SDKROOT), Matchers.equalTo("iphoneos"));
}
use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.
the class CxxPlatformXcodeConfigGeneratorTest method testResultHasCxxLanguageStardardValueTakenFromAppendConfigIfPresent.
@Test
public void testResultHasCxxLanguageStardardValueTakenFromAppendConfigIfPresent() {
LinkedHashMap<String, String> appendConfig = new LinkedHashMap<String, String>();
appendConfig.put(CxxPlatformXcodeConfigGenerator.CLANG_CXX_LANGUAGE_STANDARD, "value");
CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setCxxflags(ImmutableList.of("-std=cxxflagsvalue")).build();
ImmutableMap<String, ImmutableMap<String, String>> buildConfigs = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform(platform, appendConfig);
ImmutableMap<String, String> config = buildConfigs.get(CxxPlatformXcodeConfigGenerator.DEBUG_BUILD_CONFIGURATION_NAME);
assertThat(config.get(CxxPlatformXcodeConfigGenerator.CLANG_CXX_LANGUAGE_STANDARD), Matchers.equalTo(appendConfig.get(CxxPlatformXcodeConfigGenerator.CLANG_CXX_LANGUAGE_STANDARD)));
}
use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.
the class CxxPlatformXcodeConfigGeneratorTest method testResultHasMacOsxSdkRootTakenFromMacOsxFlavor.
@Test
public void testResultHasMacOsxSdkRootTakenFromMacOsxFlavor() {
CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setFlavor(InternalFlavor.of("macosx-12.0")).build();
ImmutableMap<String, ImmutableMap<String, String>> buildConfigs = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform(platform, new LinkedHashMap<String, String>());
ImmutableMap<String, String> config = buildConfigs.get(CxxPlatformXcodeConfigGenerator.DEBUG_BUILD_CONFIGURATION_NAME);
assertThat(config.get(CxxPlatformXcodeConfigGenerator.SDKROOT), Matchers.equalTo("macosx"));
}
use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.
the class CxxPlatformXcodeConfigGeneratorTest method testResultHasCxxLibraryValueTakenFromPlatformCxxflags.
@Test
public void testResultHasCxxLibraryValueTakenFromPlatformCxxflags() {
CxxPlatform platform = CxxPlatform.builder().from(DEFAULT_PLATFORM).setCxxflags(ImmutableList.of("-stdlib=somevalue")).build();
ImmutableMap<String, ImmutableMap<String, String>> buildConfigs = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform(platform, new LinkedHashMap<String, String>());
ImmutableMap<String, String> config = buildConfigs.get(CxxPlatformXcodeConfigGenerator.DEBUG_BUILD_CONFIGURATION_NAME);
assertThat(config.get(CxxPlatformXcodeConfigGenerator.CLANG_CXX_LIBRARY), Matchers.equalTo("somevalue"));
}
Aggregations