diff options
author | Geoffrey Martin-Noble <gcmn@google.com> | 2021-01-21 06:58:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-21 06:58:37 +0300 |
commit | 4bdd13c49aa74bd9695aa050f67ffd688a1e88a4 (patch) | |
tree | 6d6791752bbdb3c1a2d9e8ee9e6f1ab35fd855df | |
parent | d65bcd7add7b5e7587355e4301c1b8ce335a877a (diff) |
Simplify cpuinfo build overlay (#247)
-rw-r--r-- | WORKSPACE | 11 | ||||
-rw-r--r-- | third_party/clog.BUILD | 55 | ||||
-rw-r--r-- | third_party/cpuinfo.BUILD | 36 |
3 files changed, 35 insertions, 67 deletions
@@ -32,17 +32,6 @@ maybe( build_file = "@//third_party:cpuinfo.BUILD", ) -# clog library, used by cpuinfo for logging -http_archive( - name = "clog", - strip_prefix = "cpuinfo-d5e37adf1406cf899d7d9ec1d317c47506ccb970", - sha256 = "3f2dc1970f397a0e59db72f9fca6ff144b216895c1d606f6c94a507c1e53a025", - urls = [ - "https://github.com/pytorch/cpuinfo/archive/d5e37adf1406cf899d7d9ec1d317c47506ccb970.tar.gz", - ], - build_file = "@//third_party:clog.BUILD", -) - # skylib utility for additional bazel functionality. skylib_version = "0.9.0" http_archive( diff --git a/third_party/clog.BUILD b/third_party/clog.BUILD deleted file mode 100644 index cd48137..0000000 --- a/third_party/clog.BUILD +++ /dev/null @@ -1,55 +0,0 @@ -# Description: -# C-style (a-la printf) logging library - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -exports_files(["LICENSE"]) - -cc_library( - name = "clog", - srcs = [ - "deps/clog/src/clog.c", - ], - hdrs = [ - "deps/clog/include/clog.h", - ], - copts = select({ - ":windows": [], - "//conditions:default": ["-Wno-unused-result"], - }), - linkopts = select({ - ":android": ["-llog"], - "//conditions:default": [], - }), - linkstatic = select({ - # https://github.com/bazelbuild/bazel/issues/11552 - ":macos_x86_64": False, - "//conditions:default": True, - }), - defines = select({ - # When linkstatic=False, we need default visibility - ":macos_x86_64": ["CLOG_VISIBILITY="], - "//conditions:default": [], - }), - strip_include_prefix = "deps/clog/include", -) - -config_setting( - name = "android", - values = {"crosstool_top": "//external:android/crosstool"}, -) - -config_setting( - name = "windows", - values = {"cpu": "x64_windows"}, -) - -config_setting( - name = "macos_x86_64", - values = { - "apple_platform_type": "macos", - "cpu": "darwin", - }, -) diff --git a/third_party/cpuinfo.BUILD b/third_party/cpuinfo.BUILD index c385981..6d68cd5 100644 --- a/third_party/cpuinfo.BUILD +++ b/third_party/cpuinfo.BUILD @@ -94,6 +94,35 @@ MACH_ARM_SRCS = [ ] cc_library( + name = "clog", + srcs = [ + "deps/clog/src/clog.c", + ], + hdrs = [ + "deps/clog/include/clog.h", + ], + copts = select({ + ":windows_x86_64": [], + "//conditions:default": ["-Wno-unused-result"], + }), + linkopts = select({ + ":android": ["-llog"], + "//conditions:default": [], + }), + linkstatic = select({ + # https://github.com/bazelbuild/bazel/issues/11552 + ":macos_x86_64": False, + "//conditions:default": True, + }), + defines = select({ + # When linkstatic=False, we need default visibility + ":macos_x86_64": ["CLOG_VISIBILITY="], + "//conditions:default": [], + }), + strip_include_prefix = "deps/clog/include", +) + +cc_library( name = "cpuinfo_impl", srcs = select({ ":linux_x86_64": COMMON_SRCS + X86_SRCS + LINUX_SRCS + LINUX_X86_SRCS, @@ -152,7 +181,7 @@ cc_library( "src/arm/midr.h", ], deps = [ - "@clog", + ":clog", ], ) @@ -218,6 +247,11 @@ config_setting( ) config_setting( + name = "android", + values = {"crosstool_top": "//external:android/crosstool"}, +) + +config_setting( name = "windows_x86_64", values = {"cpu": "x64_windows"}, ) |