Search in sources :

Example 51 with CxxPlatform

use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.

the class AppleCxxPlatformsTest method appleTVOSSimulatorPlatformSetsLinkerFlags.

@Test
public void appleTVOSSimulatorPlatformSetsLinkerFlags() throws Exception {
    AppleSdkPaths appleSdkPaths = AppleSdkPaths.builder().setDeveloperPath(Paths.get(".")).addToolchainPaths(Paths.get("Toolchains/XcodeDefault.xctoolchain")).setPlatformPath(Paths.get("Platforms/AppleTVSimulator.platform")).setSdkPath(Paths.get("Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator9.1.sdk")).build();
    ImmutableSet<Path> paths = ImmutableSet.<Path>builder().addAll(COMMON_KNOWN_PATHS).add(Paths.get("Platforms/AppleTVSimulator.platform/Developer/usr/bin/libtool")).add(Paths.get("Platforms/AppleTVSimulator.platform/Developer/usr/bin/ar")).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.APPLETVSIMULATOR).setName("appletvsimulator9.1").setVersion("9.1").setToolchains(ImmutableList.of(toolchain)).build();
    AppleCxxPlatform appleCxxPlatform = AppleCxxPlatforms.buildWithExecutableChecker(projectFilesystem, targetSdk, "9.1", "arm64", appleSdkPaths, FakeBuckConfig.builder().build(), new FakeAppleConfig(), new FakeExecutableFinder(paths), Optional.empty(), Optional.empty());
    CxxPlatform cxxPlatform = appleCxxPlatform.getCxxPlatform();
    assertThat(cxxPlatform.getCflags(), hasItem("-mtvos-simulator-version-min=9.1"));
    assertThat(cxxPlatform.getLdflags(), hasItem("-mtvos-simulator-version-min=9.1"));
}
Also used : Path(java.nio.file.Path) FakeSourcePath(com.facebook.buck.rules.FakeSourcePath) CxxPlatform(com.facebook.buck.cxx.CxxPlatform) FakeExecutableFinder(com.facebook.buck.io.FakeExecutableFinder) Test(org.junit.Test)

Example 52 with CxxPlatform

use of com.facebook.buck.cxx.CxxPlatform in project buck by facebook.

the class HalideLibraryBuilder method createDefaultPlatforms.

// The #halide-compiler version of the HalideLibrary rule expects to be able
// to find a CxxFlavor to use when building for the host architecture.
// AbstractCxxBuilder doesn't create the default host flavor, so we "override"
// the createDefaultPlatforms() method here.
public static FlavorDomain<CxxPlatform> createDefaultPlatforms() {
    Flavor hostFlavor = CxxPlatforms.getHostFlavor();
    CxxPlatform hostCxxPlatform = CxxPlatform.builder().from(CxxPlatformUtils.DEFAULT_PLATFORM).setFlavor(hostFlavor).build();
    CxxPlatform defaultCxxPlatform = createDefaultPlatform();
    return new FlavorDomain<>("C/C++ Platform", ImmutableMap.<Flavor, CxxPlatform>builder().put(defaultCxxPlatform.getFlavor(), defaultCxxPlatform).put(hostCxxPlatform.getFlavor(), hostCxxPlatform).build());
}
Also used : CxxPlatform(com.facebook.buck.cxx.CxxPlatform) Flavor(com.facebook.buck.model.Flavor) FlavorDomain(com.facebook.buck.model.FlavorDomain)

Aggregations

CxxPlatform (com.facebook.buck.cxx.CxxPlatform)52 Test (org.junit.Test)25 ImmutableMap (com.google.common.collect.ImmutableMap)24 Path (java.nio.file.Path)22 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)20 BuildTarget (com.facebook.buck.model.BuildTarget)19 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)19 SourcePath (com.facebook.buck.rules.SourcePath)17 BuildRule (com.facebook.buck.rules.BuildRule)14 ImmutableList (com.google.common.collect.ImmutableList)11 HumanReadableException (com.facebook.buck.util.HumanReadableException)9 ImmutableSet (com.google.common.collect.ImmutableSet)9 FakeExecutableFinder (com.facebook.buck.io.FakeExecutableFinder)8 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)8 FakeSourcePath (com.facebook.buck.rules.FakeSourcePath)8 Optional (java.util.Optional)8 Flavor (com.facebook.buck.model.Flavor)7 ImmutableSortedSet (com.google.common.collect.ImmutableSortedSet)7 CxxBuckConfig (com.facebook.buck.cxx.CxxBuckConfig)6 Linker (com.facebook.buck.cxx.Linker)6