From ce724a5f1c94f539a6bf956fc6431c37e97961a9 Mon Sep 17 00:00:00 2001 From: Jeff McGlynn Date: Mon, 18 Jun 2018 10:55:12 -0700 Subject: Set up build system and add dependencies to WORKSPACE --- .gitignore | 2 ++ BUILD.bazel | 15 +++++++++++++++ WORKSPACE | 33 +++++++++++++++++++++++++++++++++ third_party/honggfuzz.BUILD | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 .gitignore create mode 100644 BUILD.bazel create mode 100644 WORKSPACE create mode 100644 third_party/honggfuzz.BUILD diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..afa1830 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bazel-* +.bazelrc diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..c947e83 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,15 @@ +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +licenses(["notice"]) diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..69e5513 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,33 @@ +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +local_repository( + name = "gtest", + path = "third_party/googletest", +) + +new_http_archive( + name = "honggfuzz", + url = "https://github.com/google/honggfuzz/archive/1.6.zip", + sha256 = "c331ac5beebe526bced3043ed3012109e439315b7d74d72760b0aa6d08cc05d2", + build_file = "third_party/honggfuzz.BUILD", + strip_prefix = "honggfuzz-1.6", +) + +http_archive( + name = "benchmark", + url = "https://github.com/google/benchmark/archive/v1.4.1.zip", + sha256 = "61ae07eb5d4a0b02753419eb17a82b7d322786bb36ab62bd3df331a4d47c00a7", + strip_prefix = "benchmark-1.4.1", +) diff --git a/third_party/honggfuzz.BUILD b/third_party/honggfuzz.BUILD new file mode 100644 index 0000000..67a44be --- /dev/null +++ b/third_party/honggfuzz.BUILD @@ -0,0 +1,34 @@ +config_setting( + name = "opt", + values = {"compilation_mode": "opt"} +) + +cc_library( + name = "honggfuzz", + srcs = glob([ + "libhfuzz/*.c", + "libhfcommon/*.c", + ], + exclude = ["libhfuzz/linux.c"], + ) + select({ + "@bazel_tools//src/conditions:darwin_x86_64": [], + "@bazel_tools//src/conditions:darwin": [], + "//conditions:default": ["libhfuzz/linux.c"], + }), + hdrs = glob([ + "libhfuzz/*.h", + "libhfcommon/*.h", + "honggfuzz.h", + ]), + defines = select({ + "@bazel_tools//src/conditions:darwin_x86_64": ["_HF_ARCH_DARWIN"], + "@bazel_tools//src/conditions:darwin": ["_HF_ARCH_DARWIN"], + "//conditions:default": ["_HF_ARCH_LINUX", "linux=linux"], + }) + select({ + ":opt": [], + "//conditions:default": ["DEBUG=DEBUG"], + }), + includes = ["."], + visibility = ["//visibility:public"], + linkstatic = 1 +) -- cgit v1.2.3