Set CMAKE_OSX_ARCHITECTURES to target architecture (#891)
This commit is contained in:
parent
4aa243d4db
commit
e0590b50e4
|
@ -17,39 +17,3 @@ local_repository(
|
||||||
load("//:repositories.bzl", "repositories")
|
load("//:repositories.bzl", "repositories")
|
||||||
|
|
||||||
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()
|
|
||||||
|
|
|
@ -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")
|
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
|
||||||
|
|
||||||
cc_test(
|
cc_test(
|
||||||
|
@ -15,10 +15,17 @@ cc_library(
|
||||||
deps = ["@cares"],
|
deps = ["@cares"],
|
||||||
)
|
)
|
||||||
|
|
||||||
ios_build_test(
|
apple_binary(
|
||||||
name = "test_c_ares_ios",
|
name = "ios_binary",
|
||||||
minimum_os_version = "12.0",
|
minimum_os_version = "12.0",
|
||||||
|
platform_type = "ios",
|
||||||
|
deps = [":ios_lib"],
|
||||||
|
)
|
||||||
|
|
||||||
|
build_test(
|
||||||
|
name = "test_c_ares_ios",
|
||||||
tags = ["manual"],
|
tags = ["manual"],
|
||||||
targets = ["ios_lib"],
|
target_compatible_with = ["@platforms//os:macos"],
|
||||||
|
targets = ["ios_binary"],
|
||||||
visibility = ["//:__pkg__"],
|
visibility = ["//:__pkg__"],
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,6 +27,7 @@ FOREIGN_CC_BUILT_TOOLS_ATTRS = {
|
||||||
|
|
||||||
# Common fragments for all built_tool rules
|
# Common fragments for all built_tool rules
|
||||||
FOREIGN_CC_BUILT_TOOLS_FRAGMENTS = [
|
FOREIGN_CC_BUILT_TOOLS_FRAGMENTS = [
|
||||||
|
"apple",
|
||||||
"cpp",
|
"cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,7 @@ CC_EXTERNAL_RULE_ATTRIBUTES = {
|
||||||
|
|
||||||
# A list of common fragments required by rules using this framework
|
# A list of common fragments required by rules using this framework
|
||||||
CC_EXTERNAL_RULE_FRAGMENTS = [
|
CC_EXTERNAL_RULE_FRAGMENTS = [
|
||||||
|
"apple",
|
||||||
"cpp",
|
"cpp",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -306,6 +307,7 @@ def get_env_prelude(ctx, lib_name, data_dependencies, target_root):
|
||||||
"export DEVELOPER_DIR=\"$developer_dir_tmp\"",
|
"export DEVELOPER_DIR=\"$developer_dir_tmp\"",
|
||||||
"sdkroot_tmp=\"$(xcrun --sdk {} --show-sdk-path)\"".format(sdk),
|
"sdkroot_tmp=\"$(xcrun --sdk {} --show-sdk-path)\"".format(sdk),
|
||||||
"export SDKROOT=\"$sdkroot_tmp\"",
|
"export SDKROOT=\"$sdkroot_tmp\"",
|
||||||
|
"export CMAKE_OSX_ARCHITECTURES={}".format(ctx.fragments.apple.single_arch_cpu),
|
||||||
])
|
])
|
||||||
|
|
||||||
cc_toolchain = find_cpp_toolchain(ctx)
|
cc_toolchain = find_cpp_toolchain(ctx)
|
||||||
|
|
Loading…
Reference in New Issue