Skip to content

Commit

Permalink
Support MacOS build with Bazel
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 273306747
  • Loading branch information
Maratyszcza authored and xnnpack-bot committed Oct 7, 2019
1 parent dd69f0b commit 885ca24
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
8 changes: 8 additions & 0 deletions BUILD
Expand Up @@ -1571,6 +1571,14 @@ config_setting(
},
)

config_setting(
name = "macos_x86_64",
values = {
"apple_platform_type": "macos",
"cpu": "darwin",
},
)

config_setting(
name = "emscripten",
values = {"crosstool_top": "//toolchain/emscripten"},
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -8,7 +8,7 @@ XNNPACK is a highly optimized library of floating-point neural network inference
- ARM on Android
- WebAssembly MVP
- WebAssembly SIMD (experimental)
- x86 and x86-64 (up to SSE2 only) on Android and Linux
- x86 and x86-64 (up to SSE2 only) on Android, Linux, and macOS

## Operator Coverage

Expand Down
3 changes: 3 additions & 0 deletions build_defs.bzl
Expand Up @@ -95,6 +95,7 @@ def xnnpack_cc_library(
srcs = srcs + select({
":linux_k8": x86_srcs,
":linux_aarch64": aarch64_srcs,
":macos_x86_64": x86_srcs,
":android_armv7": aarch32_srcs,
":android_arm64": aarch64_srcs,
":android_x86": x86_srcs,
Expand All @@ -107,6 +108,7 @@ def xnnpack_cc_library(
] + copts + select({
":linux_k8": x86_copts,
":linux_aarch64": aarch64_copts,
":macos_x86_64": x86_copts,
":android_armv7": aarch32_copts,
":android_arm64": aarch64_copts,
":android_x86": x86_copts,
Expand Down Expand Up @@ -153,6 +155,7 @@ def xnnpack_aggregate_library(
deps = generic_deps + select({
":linux_k8": x86_deps,
":linux_aarch64": aarch64_deps,
":macos_x86_64": x86_deps,
":android_armv7": aarch32_deps,
":android_arm64": aarch64_deps,
":android_x86": x86_deps,
Expand Down
9 changes: 9 additions & 0 deletions third_party/cpuinfo.BUILD
Expand Up @@ -101,6 +101,7 @@ cc_library(
name = "cpuinfo_impl",
srcs = select({
":linux_x86_64": COMMON_SRCS + X86_SRCS + LINUX_SRCS + LINUX_X86_SRCS,
":macos_x86_64": COMMON_SRCS + X86_SRCS + MACH_SRCS + MACH_X86_SRCS,
":android_armv7": COMMON_SRCS + ARM_SRCS + LINUX_SRCS + LINUX_ARM32_SRCS + ANDROID_ARM_SRCS,
":android_arm64": COMMON_SRCS + ARM_SRCS + LINUX_SRCS + LINUX_ARM64_SRCS + ANDROID_ARM_SRCS,
":android_x86": COMMON_SRCS + X86_SRCS + LINUX_SRCS + LINUX_X86_SRCS,
Expand Down Expand Up @@ -154,6 +155,14 @@ config_setting(
visibility = ["//visibility:public"],
)

config_setting(
name = "macos_x86_64",
values = {
"apple_platform_type": "macos",
"cpu": "darwin",
},
)

config_setting(
name = "android_armv7",
values = {
Expand Down

0 comments on commit 885ca24

Please sign in to comment.