Set CMAKE_OSX_ARCHITECTURES to target architecture (#891)

This commit is contained in:
Keith Smiley 2022-04-16 09:19:01 -07:00 committed by GitHub
parent 4aa243d4db
commit e0590b50e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 40 deletions

View File

@ -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()

View File

@ -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(
@ -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__"],
)

View File

@ -27,6 +27,7 @@ FOREIGN_CC_BUILT_TOOLS_ATTRS = {
# Common fragments for all built_tool rules
FOREIGN_CC_BUILT_TOOLS_FRAGMENTS = [
"apple",
"cpp",
]

View File

@ -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",
]
@ -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)