From cdf4ee1e5992d849a79ccf17d7baa95d41072ee3 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Tue, 11 Oct 2016 05:43:54 -0700 Subject: [PATCH] Move benchmark buck file into benchmark directory Summary: buck rules are not meant to be in the root buck file but instead next to source files. This diff moves benchmark rule into benchmark folder. Reviewed By: lucasr Differential Revision: D3992992 fbshipit-source-id: 34782ff73bbd5b799d83d0f01b553bfab928f1df --- .travis.yml | 4 ++-- BUCK | 12 ----------- CSSLAYOUT_DEFS | 3 +++ benchmark/BUCK | 27 ++++++++++++++++++++++++ {benchmarks => benchmark}/CSSBenchmark.c | 0 {benchmarks => benchmark}/CSSBenchmark.h | 0 6 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 benchmark/BUCK rename {benchmarks => benchmark}/CSSBenchmark.c (100%) rename {benchmarks => benchmark}/CSSBenchmark.h (100%) diff --git a/.travis.yml b/.travis.yml index 59d7df38..d5e9b5c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,6 @@ before_install: script: - buck test //:CSSLayout - buck test //:CSSLayout_java - - buck run //:benchmark + - buck run //benchmark:benchmark - git checkout HEAD^ - - buck run //:benchmark + - buck run //benchmark:benchmark diff --git a/BUCK b/BUCK index f626dc5a..fa9ef5b1 100644 --- a/BUCK +++ b/BUCK @@ -49,18 +49,6 @@ cxx_library( visibility = ['PUBLIC'], ) -cxx_binary( - name = 'benchmark', - srcs = glob(['benchmarks/*.c']), - headers = subdir_glob([('', 'benchmarks/*.h')]), - header_namespace = '', - compiler_flags = COMPILER_FLAGS, - deps = [ - ':CSSLayout', - ], - visibility = ['PUBLIC'], -) - cxx_test( name = 'CSSLayout_tests', contacts = ['emilsj@fb.com'], diff --git a/CSSLAYOUT_DEFS b/CSSLAYOUT_DEFS index e33cf002..6c45022f 100644 --- a/CSSLAYOUT_DEFS +++ b/CSSLAYOUT_DEFS @@ -9,6 +9,9 @@ GTEST_TARGET = '//lib/gtest:gtest' GTEST_DL_URL = 'https://github.com/google/googletest/archive/release-1.7.0.zip' JNI_DEPS = ['//lib/fb:fbjni'] +def csslayout_dep(dep): + return '//' + dep + class allow_unsafe_import: def __enter__(self): pass diff --git a/benchmark/BUCK b/benchmark/BUCK new file mode 100644 index 00000000..918600b2 --- /dev/null +++ b/benchmark/BUCK @@ -0,0 +1,27 @@ +# Copyright (c) 2014-present, Facebook, Inc. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. An additional grant +# of patent rights can be found in the PATENTS file in the same directory. + +include_defs('//CSSLAYOUT_DEFS') + +cxx_binary( + name = 'benchmark', + srcs = glob(['*.c']), + headers = subdir_glob([('', '*.h')]), + header_namespace = '', + compiler_flags = [ + '-fno-omit-frame-pointer', + '-fexceptions', + '-Wall', + '-Werror', + '-O3', + '-std=c11', + ], + deps = [ + csslayout_dep(':CSSLayout'), + ], + visibility = ['PUBLIC'], +) diff --git a/benchmarks/CSSBenchmark.c b/benchmark/CSSBenchmark.c similarity index 100% rename from benchmarks/CSSBenchmark.c rename to benchmark/CSSBenchmark.c diff --git a/benchmarks/CSSBenchmark.h b/benchmark/CSSBenchmark.h similarity index 100% rename from benchmarks/CSSBenchmark.h rename to benchmark/CSSBenchmark.h