| 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:arm64", |
| ], |
| "darwin_arm64e": [ |
| "@platforms//os:osx", |
| "@platforms//cpu:arm64", |
| ], |
| "darwin_x86_64": [ |
| "@platforms//os:osx", |
| "@platforms//cpu:x86_64", |
| ], |
| "ios_arm64": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:arm64", |
| ], |
| "ios_arm64e": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:arm64", |
| ], |
| "ios_armv7": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:armv7", |
| ], |
| "ios_i386": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:i386", |
| ], |
| "ios_x86_64": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:x86_64", |
| ], |
| "ios_sim_arm64": [ |
| "@platforms//os:ios", |
| "@platforms//cpu:arm64", |
| ], |
| "tvos_arm64": [ |
| "@platforms//os:tvos", |
| "@platforms//cpu:arm64", |
| ], |
| "tvos_x86_64": [ |
| "@platforms//os:tvos", |
| "@platforms//cpu:x86_64", |
| ], |
| "tvos_sim_arm64": [ |
| "@platforms//os:tvos", |
| "@platforms//cpu:arm64", |
| ], |
| "watchos_arm64": [ |
| "@platforms//os:watchos", |
| "@platforms//cpu:arm64", |
| ], |
| "watchos_arm64_32": [ |
| "@platforms//os:watchos", |
| "@platforms//cpu:arm64_32", |
| ], |
| "watchos_armv7k": [ |
| "@platforms//os:watchos", |
| "@platforms//cpu:armv7k", |
| ], |
| "watchos_i386": [ |
| "@platforms//os:watchos", |
| "@platforms//cpu:i386", |
| ], |
| "watchos_x86_64": [ |
| "@platforms//os:watchos", |
| "@platforms//cpu:x86_64", |
| ], |
| } |
| |
| OSX_DEVELOPER_PLATFORM_CPUS = [ |
| "arm64", |
| "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 |
| ] |