From 5120c9ba76ef79f0460bd2c4202f62fd0ab73188 Mon Sep 17 00:00:00 2001 From: Chris Cummins Date: Thu, 2 Apr 2020 17:58:28 +0100 Subject: [PATCH] Improvements to third party packages. This adds the following new packages: * fmt * ctpl * libpqxx * progress_cpp * subprocess Additionally: * Add a clang++ target to llvm. * Simplify tbb dependency. Signed-off-by: format 20.02.05 --- WORKSPACE | 70 ++++++++++++++++++++++++++++++++++ third_party/ctpl.BUILD | 11 ++++++ third_party/fmt.BUILD | 10 +++++ third_party/llvm.BUILD | 5 +++ third_party/progress_cpp.BUILD | 11 ++++++ third_party/subprocess.BUILD | 11 ++++++ third_party/tbb_lin.BUILD | 1 + third_party/tbb_mac.BUILD | 1 + 8 files changed, 120 insertions(+) create mode 100644 third_party/ctpl.BUILD create mode 100644 third_party/fmt.BUILD create mode 100644 third_party/progress_cpp.BUILD create mode 100644 third_party/subprocess.BUILD diff --git a/WORKSPACE b/WORKSPACE index efae829c5..659e46b33 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -883,3 +883,73 @@ load("@org_tensorflow//tensorflow:workspace.bzl", "tf_repositories") tf_repositories() ################################################################################ + +# A modern C++ formatting library. +# https://fmt.dev + +http_archive( + name = "fmt", + build_file = "//:third_party/fmt.BUILD", + sha256 = "1cafc80701b746085dddf41bd9193e6d35089e1c6ec1940e037fcb9c98f62365", + strip_prefix = "fmt-6.1.2", + urls = ["https://github.com/fmtlib/fmt/archive/6.1.2.tar.gz"], +) + +# Subprocessing with modern C++. +# https://github.com/arun11299/cpp-subprocess.git + +http_archive( + name = "subprocess", + build_file = "//:third_party/subprocess.BUILD", + sha256 = "886df0a814a7bb7a3fdeead22f75400abd8d3235b81d05817bc8c1125eeebb8f", + strip_prefix = "cpp-subprocess-2.0", + urls = [ + "https://github.com/arun11299/cpp-subprocess/archive/v2.0.tar.gz", + ], +) + +http_archive( + name = "ctpl", + build_file = "//:third_party/ctpl.BUILD", + sha256 = "8c1cec7c570d6d84be1d29283af5039ea27c3e69703bd446d396424bf619816e", + strip_prefix = "CTPL-ctpl_v.0.0.2", + urls = ["https://github.com/vit-vit/CTPL/archive/ctpl_v.0.0.2.tar.gz"], +) + +# Build rules for interfacing with "foreign" (non-Bazel) build systems. +# https://github.com/bazelbuild/rules_foreign_cc + +http_archive( + name = "rules_foreign_cc", + sha256 = "450563dc2938f38566a59596bb30a3e905fbbcc35b3fff5a1791b122bc140465", + strip_prefix = "rules_foreign_cc-456425521973736ef346d93d3d6ba07d807047df", + url = "https://github.com/bazelbuild/rules_foreign_cc/archive/456425521973736ef346d93d3d6ba07d807047df.zip", +) + +all_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])""" + +load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies") + +rules_foreign_cc_dependencies([]) + +# The C++ connector for PostgreSQL. +# https://www.postgresql.org/docs/6.5/libpqplusplus.htm + +http_archive( + name = "libpqxx", + build_file_content = all_content, + sha256 = "2280621eee7ec675ed6751abac2273f0ac41395e99be96e06584a54a0cc3985a", + strip_prefix = "libpqxx-6.4.6", + urls = ["https://github.com/jtv/libpqxx/archive/6.4.6.tar.gz"], +) + +# A flexible ASCII progress-bar for C++. +# https://github.com/prakhar1989/progress-cpp + +http_archive( + name = "progress_cpp", + build_file = "//:third_party/progress_cpp.BUILD", + sha256 = "e5a8804c71a4b86149a00deab62bede041003df7109822805ea8cce015d5373b", + strip_prefix = "progress-cpp-06fdda086eb06b462faff7a917984062bc15b61e", + urls = ["https://github.com/prakhar1989/progress-cpp/archive/06fdda086eb06b462faff7a917984062bc15b61e.tar.gz"], +) diff --git a/third_party/ctpl.BUILD b/third_party/ctpl.BUILD new file mode 100644 index 000000000..a5c39ad84 --- /dev/null +++ b/third_party/ctpl.BUILD @@ -0,0 +1,11 @@ +cc_library( + name = "ctpl", + hdrs = [ + "ctpl.h", + "ctpl_stl.h", + ], + visibility = ["//visibility:public"], + deps = [ + "@boost//:lockfree", + ], +) diff --git a/third_party/fmt.BUILD b/third_party/fmt.BUILD new file mode 100644 index 000000000..4130c2969 --- /dev/null +++ b/third_party/fmt.BUILD @@ -0,0 +1,10 @@ +# A modern formatting library. https://fmt.dev + +cc_library( + name = "fmt", + srcs = glob(["src/*.cc"]), + hdrs = glob(["include/fmt/*.h"]), + copts = ["-Iexternal/fmt/include"], + strip_include_prefix = "include", + visibility = ["//visibility:public"], +) diff --git a/third_party/llvm.BUILD b/third_party/llvm.BUILD index 48baffc0c..7e575bdef 100644 --- a/third_party/llvm.BUILD +++ b/third_party/llvm.BUILD @@ -9,6 +9,11 @@ filegroup( srcs = ["bin/clang"], ) +filegroup( + name = "clang++", + srcs = ["bin/clang++"], +) + filegroup( name = "libcxx_headers", srcs = glob([ diff --git a/third_party/progress_cpp.BUILD b/third_party/progress_cpp.BUILD new file mode 100644 index 000000000..f28c58dab --- /dev/null +++ b/third_party/progress_cpp.BUILD @@ -0,0 +1,11 @@ +# A flexible ASCII progress-bar for C++. +# https://github.com/prakhar1989/progress-cpp + +licenses(["notice"]) # MIT. + +cc_library( + name = "progress_cpp", + hdrs = ["ProgressBar.hpp"], + include_prefix = "progress_cpp", + visibility = ["//visibility:public"], +) diff --git a/third_party/subprocess.BUILD b/third_party/subprocess.BUILD new file mode 100644 index 000000000..c485c6a5f --- /dev/null +++ b/third_party/subprocess.BUILD @@ -0,0 +1,11 @@ +# Subprocessing with modern C++. +# https://github.com/arun11299/cpp-subprocess + +licenses(["notice"]) # MIT. + +cc_library( + name = "subprocess", + hdrs = ["subprocess.hpp"], + include_prefix = "subprocess", + visibility = ["//visibility:public"], +) diff --git a/third_party/tbb_lin.BUILD b/third_party/tbb_lin.BUILD index e48d34ab3..146328028 100644 --- a/third_party/tbb_lin.BUILD +++ b/third_party/tbb_lin.BUILD @@ -2,6 +2,7 @@ cc_library( name = "main", srcs = glob(["lib/intel64/gcc4.7/libtbb.so*"]), hdrs = glob(["include/**/*.h"]), + includes = ["include"], linkopts = ["-pthread"], visibility = ["//visibility:public"], ) diff --git a/third_party/tbb_mac.BUILD b/third_party/tbb_mac.BUILD index 3c2033923..70a7e7b87 100644 --- a/third_party/tbb_mac.BUILD +++ b/third_party/tbb_mac.BUILD @@ -2,5 +2,6 @@ cc_library( name = "main", srcs = ["lib/libtbb.dylib"], hdrs = glob(["include/**/*.h"]), + includes = ["include"], visibility = ["//visibility:public"], )