1// 2// Copyright (C) 2019 The Android Open Source Project 3// All rights reserved. 4// 5// Redistribution and use in source and binary forms, with or without 6// modification, are permitted provided that the following conditions 7// are met: 8// * Redistributions of source code must retain the above copyright 9// notice, this list of conditions and the following disclaimer. 10// * Redistributions in binary form must reproduce the above copyright 11// notice, this list of conditions and the following disclaimer in 12// the documentation and/or other materials provided with the 13// distribution. 14// 15// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 22// OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 23// AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 25// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26// SUCH DAMAGE. 27// 28 29package { 30 default_team: "trendy_team_native_tools_libraries", 31 default_applicable_licenses: ["bionic_benchmarks_license"], 32} 33 34cc_defaults { 35 name: "bionic_spawn_benchmark_targets", 36 host_supported: true, 37 target: { 38 darwin: { 39 enabled: false, 40 }, 41 windows: { 42 enabled: false, 43 }, 44 linux_glibc_x86: { 45 enabled: false, 46 }, 47 linux_musl_x86: { 48 enabled: false, 49 }, 50 }, 51} 52 53cc_library_static { 54 name: "libbionic_spawn_benchmark", 55 defaults: ["bionic_spawn_benchmark_targets"], 56 57 srcs: ["spawn_benchmark.cpp"], 58 export_include_dirs: ["include"], 59 static_libs: [ 60 "libbase", 61 "libgoogle-benchmark", 62 "liblog", 63 ], 64} 65 66cc_benchmark { 67 name: "bionic-spawn-benchmarks", 68 defaults: ["bionic_spawn_benchmark_targets"], 69 70 srcs: ["spawn_benchmarks.cpp"], 71 static_libs: [ 72 "libbase", 73 "libbionic_spawn_benchmark", 74 "liblog", 75 ], 76 77 // Install these binaries in the same directory as the main benchmark binary. 78 data: [ 79 ":bench_cxa_atexit", 80 ":bench_noop", 81 ":bench_noop_nostl", 82 ":bench_noop_static", 83 ], 84} 85 86cc_defaults { 87 name: "bionic_spawn_benchmark_binary", 88 defaults: ["bionic_spawn_benchmark_targets"], 89 90 compile_multilib: "both", 91 multilib: { 92 lib32: { 93 suffix: "32", 94 }, 95 lib64: { 96 suffix: "64", 97 }, 98 }, 99 100 // When this binary is installed to host/linux-x86/bin, its runpath is ${ORIGIN}/../lib64, which 101 // is fine for finding host/linux-x86/lib64/libc++.so. When it's installed to 102 // host/linux-x86/benchmarktest64/bionic-spawn-benchmarks, the runpath needs an extra "..". This 103 // argument has no effect when a static executable is produced. 104 target: { 105 linux_glibc_x86_64: { 106 ldflags: [ 107 "-Wl,--rpath,${ORIGIN}/../../lib64", 108 ], 109 }, 110 linux_musl_x86_64: { 111 ldflags: [ 112 "-Wl,--rpath,${ORIGIN}/../../lib64", 113 ], 114 }, 115 }, 116} 117 118cc_binary { 119 defaults: ["bionic_spawn_benchmark_binary"], 120 name: "bench_cxa_atexit", 121 srcs: ["bench_cxa_atexit.cpp"], 122} 123 124cc_binary { 125 defaults: ["bionic_spawn_benchmark_binary"], 126 name: "bench_noop", 127 srcs: ["noop.cpp"], 128} 129 130cc_binary { 131 defaults: ["bionic_spawn_benchmark_binary"], 132 name: "bench_noop_nostl", 133 srcs: ["noop.cpp"], 134 stl: "none", 135} 136 137cc_binary { 138 defaults: ["bionic_spawn_benchmark_binary"], 139 name: "bench_noop_static", 140 srcs: ["noop.cpp"], 141 static_executable: true, 142 stl: "libc++_static", 143} 144