Skip to content

Commit

Permalink
Set CMAKE_OSX_ARCHITECTURES to target architecture (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
keith authored Apr 16, 2022
1 parent 4aa243d commit e0590b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 40 deletions.
36 changes: 0 additions & 36 deletions examples/third_party/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,3 @@ local_repository(
load("//:repositories.bzl", "repositories")

repositories()

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "build_bazel_rules_apple",
sha256 = "0052d452af7742c8f3a4e0929763388a66403de363775db7e90adecb2ba4944b",
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.31.3/rules_apple.0.31.3.tar.gz",
)

load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)

apple_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)

swift_rules_dependencies()

load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)

swift_rules_extra_dependencies()

load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
)

apple_support_dependencies()
15 changes: 11 additions & 4 deletions examples/third_party/cares/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_build_test")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")

cc_test(
Expand All @@ -15,10 +15,17 @@ cc_library(
deps = ["@cares"],
)

ios_build_test(
name = "test_c_ares_ios",
apple_binary(
name = "ios_binary",
minimum_os_version = "12.0",
platform_type = "ios",
deps = [":ios_lib"],
)

build_test(
name = "test_c_ares_ios",
tags = ["manual"],
targets = ["ios_lib"],
target_compatible_with = ["@platforms//os:macos"],
targets = ["ios_binary"],
visibility = ["//:__pkg__"],
)
1 change: 1 addition & 0 deletions foreign_cc/built_tools/private/built_tools_framework.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ FOREIGN_CC_BUILT_TOOLS_ATTRS = {

# Common fragments for all built_tool rules
FOREIGN_CC_BUILT_TOOLS_FRAGMENTS = [
"apple",
"cpp",
]

Expand Down
2 changes: 2 additions & 0 deletions foreign_cc/private/framework.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ CC_EXTERNAL_RULE_ATTRIBUTES = {

# A list of common fragments required by rules using this framework
CC_EXTERNAL_RULE_FRAGMENTS = [
"apple",
"cpp",
]

Expand Down Expand Up @@ -306,6 +307,7 @@ def get_env_prelude(ctx, lib_name, data_dependencies, target_root):
"export DEVELOPER_DIR=\"$developer_dir_tmp\"",
"sdkroot_tmp=\"$(xcrun --sdk {} --show-sdk-path)\"".format(sdk),
"export SDKROOT=\"$sdkroot_tmp\"",
"export CMAKE_OSX_ARCHITECTURES={}".format(ctx.fragments.apple.single_arch_cpu),
])

cc_toolchain = find_cpp_toolchain(ctx)
Expand Down

0 comments on commit e0590b5

Please sign in to comment.