1 // Copyright (C) 2018 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 cc_defaults { 16 name: "libcatch2-defaults", 17 host_supported: true, 18 local_include_dirs: ["include"], // cc_test ignores export_include_dirs 19 export_include_dirs: ["include"], 20 srcs: ["include/**/*.cpp"], 21 exclude_srcs: ["include/catch_with_main.cpp"], 22 } 23 24 // !!! IMPORTANT: Use 'whole_static_libs' or the linker will dead-code-eliminate 25 // parts of the important code (the console and junit reporters). 26 27 // Android users: libcatch2-main is what you want 99% of the time. 28 // Using the pre-defined main speeds up compilation significantly. 29 // If for some reason you want to provide your own `main`, use "libcatch2" 30 // See also docs/configuration.md 31 cc_library_static { 32 name: "libcatch2-main", 33 defaults: [ 34 "libcatch2-defaults", 35 ], 36 srcs: [ 37 "include/catch_with_main.cpp", 38 ], 39 } 40 41 // libcatch2 without the pre-defined main. 42 // This is only useful if your program will define its own main. 43 cc_library_static { 44 name: "libcatch2", 45 defaults: [ 46 "libcatch2-defaults", 47 ], 48 cflags: ["-DCATCH_CONFIG_DISABLE_EXCEPTIONS"], 49 } 50 51 // This rule can be used by other external/ projects that depend on catch2 52 // without turning off exceptions. 53 cc_library_static { 54 name: "libcatch2-upstream", 55 defaults: [ 56 "libcatch2-defaults", 57 ], 58 cflags: ["-fexceptions"], 59 } 60 61 // Configurations meant for validating upstream. Not intended to be used by anything else. 62 63 cc_defaults { 64 name: "libcatch2-defaults-tests", 65 host_supported: true, 66 srcs: [ 67 "projects/SelfTest/**/*.cpp", 68 ], 69 // This directory just re-includes existing tests 100x over. 70 // This is extremely slow to build, we don't lose coverage by excluding it. 71 exclude_srcs: [ 72 "projects/SelfTest/CompileTimePerfTests/**/*.cpp", 73 ], 74 } 75 76 // Upstream config: Exceptions are enabled. 77 // This should be validated first after an upstream merge. 78 cc_test { 79 name: "libcatch2-tests-upstream", 80 defaults: [ 81 "libcatch2-defaults-tests", 82 ], 83 84 gtest: false, 85 cflags: ["-fexceptions"], 86 87 whole_static_libs: [ 88 "libcatch2-upstream", 89 ], 90 } 91 92 // Android config: Exceptions are disabled. 93 // This should be validated second after an upstream merge. 94 cc_test { 95 name: "libcatch2-tests", 96 defaults: [ 97 "libcatch2-defaults-tests", 98 ], 99 cflags: [ 100 "-DCATCH_CONFIG_DISABLE_EXCEPTIONS", 101 "-Wno-unused-function", 102 ], 103 gtest: false, 104 whole_static_libs: [ 105 "libcatch2", 106 ], 107 } 108