aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarat Dukhan <maratek@google.com>2020-04-10 23:06:30 -0700
committerMarat Dukhan <maratek@google.com>2020-04-10 23:25:36 -0700
commitf7dd0576a1c8289ef099d4fd8b136b1c4487a873 (patch)
tree30ac0b3e72ca64c20a9de5a27099cbb96aac69ff
parentd80e7d1a8aa6e30c51b57eaaf27fcd950515af2b (diff)
downloadFXdiv-f7dd0576a1c8289ef099d4fd8b136b1c4487a873.tar.gz
Add Bazel configuration files
-rw-r--r--.gitignore11
-rw-r--r--BUILD.bazel85
-rw-r--r--WORKSPACE30
3 files changed, 124 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 73b2998..c10cb60 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,10 +2,17 @@
build.ninja
# Build objects and artifacts
-deps/
-build/
+bazel-bin
+bazel-genfiles
+bazel-out
+bazel-testlogs
+bazel-FXdiv
bin/
+build/
+build-*/
+deps/
lib/
+libs/
*.pyc
*.pyo
diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 0000000..7b0ba72
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,85 @@
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
+
+licenses(["notice"])
+
+################################# FXdiv library ################################
+
+cc_library(
+ name = "FXdiv",
+ hdrs = [
+ "include/fxdiv.h",
+ ],
+ includes = [
+ "include",
+ ],
+ strip_include_prefix = "include",
+ deps = [],
+ visibility = ["//visibility:public"],
+)
+
+################################## Unit tests ##################################
+
+cc_test(
+ name = "multiply_high_test",
+ srcs = ["test/multiply-high.cc"],
+ deps = [
+ ":FXdiv",
+ "@com_google_googletest//:gtest_main",
+ ],
+)
+
+cc_test(
+ name = "quotient_test",
+ srcs = ["test/quotient.cc"],
+ deps = [
+ ":FXdiv",
+ "@com_google_googletest//:gtest_main",
+ ],
+)
+
+################################## Benchmarks ##################################
+
+cc_binary(
+ name = "init_bench",
+ srcs = ["bench/init.cc"],
+ deps = [
+ ":FXdiv",
+ "@com_google_benchmark//:benchmark",
+ ],
+)
+
+cc_binary(
+ name = "multiply_bench",
+ srcs = ["bench/multiply.cc"],
+ deps = [
+ ":FXdiv",
+ "@com_google_benchmark//:benchmark",
+ ],
+)
+
+cc_binary(
+ name = "divide_bench",
+ srcs = ["bench/divide.cc"],
+ deps = [
+ ":FXdiv",
+ "@com_google_benchmark//:benchmark",
+ ],
+)
+
+cc_binary(
+ name = "quotient_bench",
+ srcs = ["bench/quotient.cc"],
+ deps = [
+ ":FXdiv",
+ "@com_google_benchmark//:benchmark",
+ ],
+)
+
+cc_binary(
+ name = "round_down_bench",
+ srcs = ["bench/round-down.cc"],
+ deps = [
+ ":FXdiv",
+ "@com_google_benchmark//:benchmark",
+ ],
+)
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000..4fbe23d
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,30 @@
+workspace(name = "FXdiv")
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+# Bazel rule definitions
+http_archive(
+ name = "rules_cc",
+ strip_prefix = "rules_cc-master",
+ urls = ["https://github.com/bazelbuild/rules_cc/archive/master.zip"],
+)
+
+# Google Test framework, used by most unit-tests.
+http_archive(
+ name = "com_google_googletest",
+ strip_prefix = "googletest-master",
+ urls = ["https://github.com/google/googletest/archive/master.zip"],
+)
+
+# Google Benchmark library, used in micro-benchmarks.
+http_archive(
+ name = "com_google_benchmark",
+ strip_prefix = "benchmark-master",
+ urls = ["https://github.com/google/benchmark/archive/master.zip"],
+)
+
+# Android NDK location and version is auto-detected from $ANDROID_NDK_HOME environment variable
+android_ndk_repository(name = "androidndk")
+
+# Android SDK location and API is auto-detected from $ANDROID_HOME environment variable
+android_sdk_repository(name = "androidsdk")