| load(":osx_archs.bzl", "OSX_TOOLS_ARCHS") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| exports_files(["osx_archs.bzl"]) |
| |
| # Target constraints for each arch. |
| # TODO(apple-rules): Rename osx constraint to macOS. |
| OSX_TOOLS_CONSTRAINTS = { |
| "armeabi-v7a": ["@platforms//cpu:arm"], |
| "darwin_arm64": [ |
| "@platforms//os:osx", |
| "@platforms//cpu:aarch64", |
| ], |
| "darwin_arm64e": [ |
| "@platforms//os:osx", |
| "@platforms//cpu:aarch64", |
| ], |
| "darwin_x86_64": [ |
| "@platforms//os:osx", |
| "@platforms//cpu:x86_64", |
| ], |
| "ios_arm64": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:aarch64", |
| ], |
| "ios_arm64e": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:aarch64", |
| ], |
| "ios_armv7": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:arm", |
| ], |
| "ios_i386": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:x86_32", |
| ], |
| "ios_x86_64": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:x86_64", |
| ], |
| "ios_sim_arm64": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:aarch64", |
| ], |
| "tvos_arm64": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:aarch64", |
| ], |
| "tvos_x86_64": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:x86_64", |
| ], |
| "watchos_arm64_32": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:aarch64", |
| ], |
| "watchos_armv7k": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:arm", |
| ], |
| "watchos_i386": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:x86_32", |
| ], |
| "watchos_x86_64": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:x86_64", |
| ], |
| } |
| |
| OSX_DEVELOPER_PLATFORM_CPUS = [ |
| "aarch64", |
| "x86_64", |
| ] |
| |
| [ |
| toolchain( |
| name = "cc-toolchain-" + arch + "-" + cpu, |
| exec_compatible_with = [ |
| # These only execute on macOS. |
| "@platforms//os:osx", |
| "@platforms//cpu:" + cpu, |
| ], |
| target_compatible_with = OSX_TOOLS_CONSTRAINTS[arch], |
| toolchain = "@local_config_cc//:cc-compiler-" + arch, |
| toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", |
| ) |
| for arch in OSX_TOOLS_ARCHS + ["armeabi-v7a"] |
| for cpu in OSX_DEVELOPER_PLATFORM_CPUS |
| ] |