Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 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 | |
Bob Badour | 57ec890 | 2021-02-12 15:04:15 -0800 | [diff] [blame] | 15 | package { |
| 16 | default_applicable_licenses: ["external_catch2_license"], |
| 17 | } |
| 18 | |
| 19 | // Added automatically by a large-scale-change that took the approach of |
| 20 | // 'apply every license found to every target'. While this makes sure we respect |
| 21 | // every license restriction, it may not be entirely correct. |
| 22 | // |
| 23 | // e.g. GPL in an MIT project might only apply to the contrib/ directory. |
| 24 | // |
| 25 | // Please consider splitting the single license below into multiple licenses, |
| 26 | // taking care not to lose any license_kind information, and overriding the |
| 27 | // default license using the 'licenses: [...]' property on targets as needed. |
| 28 | // |
| 29 | // For unused files, consider creating a 'fileGroup' with "//visibility:private" |
| 30 | // to attach the license to, and including a comment whether the files may be |
| 31 | // used in the current project. |
| 32 | // See: http://go/android-license-faq |
| 33 | license { |
| 34 | name: "external_catch2_license", |
| 35 | visibility: [":__subpackages__"], |
| 36 | license_kinds: [ |
| 37 | "SPDX-license-identifier-BSD", |
| 38 | "SPDX-license-identifier-BSL-1.0", |
| 39 | "SPDX-license-identifier-GPL", |
| 40 | "SPDX-license-identifier-MIT", |
| 41 | ], |
| 42 | license_text: [ |
| 43 | "LICENSE.txt", |
| 44 | ], |
| 45 | } |
| 46 | |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 47 | cc_defaults { |
| 48 | name: "libcatch2-defaults", |
| 49 | host_supported: true, |
| 50 | local_include_dirs: ["include"], // cc_test ignores export_include_dirs |
| 51 | export_include_dirs: ["include"], |
| 52 | srcs: ["include/**/*.cpp"], |
Haibo Huang | e9410df | 2019-03-07 13:34:42 -0800 | [diff] [blame] | 53 | exclude_srcs: ["include/catch_with_main.cpp"], |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | // !!! IMPORTANT: Use 'whole_static_libs' or the linker will dead-code-eliminate |
| 57 | // parts of the important code (the console and junit reporters). |
| 58 | |
| 59 | // Android users: libcatch2-main is what you want 99% of the time. |
| 60 | // Using the pre-defined main speeds up compilation significantly. |
| 61 | // If for some reason you want to provide your own `main`, use "libcatch2" |
| 62 | // See also docs/configuration.md |
| 63 | cc_library_static { |
| 64 | name: "libcatch2-main", |
| 65 | defaults: [ |
| 66 | "libcatch2-defaults", |
| 67 | ], |
| 68 | srcs: [ |
Haibo Huang | e9410df | 2019-03-07 13:34:42 -0800 | [diff] [blame] | 69 | "include/catch_with_main.cpp", |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 70 | ], |
| 71 | } |
| 72 | |
| 73 | // libcatch2 without the pre-defined main. |
| 74 | // This is only useful if your program will define its own main. |
| 75 | cc_library_static { |
| 76 | name: "libcatch2", |
| 77 | defaults: [ |
| 78 | "libcatch2-defaults", |
| 79 | ], |
Haibo Huang | e9410df | 2019-03-07 13:34:42 -0800 | [diff] [blame] | 80 | cflags: ["-DCATCH_CONFIG_DISABLE_EXCEPTIONS"], |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 81 | } |
| 82 | |
Igor Murashkin | 810b037 | 2018-08-09 16:48:37 -0700 | [diff] [blame] | 83 | // This rule can be used by other external/ projects that depend on catch2 |
| 84 | // without turning off exceptions. |
| 85 | cc_library_static { |
| 86 | name: "libcatch2-upstream", |
| 87 | defaults: [ |
| 88 | "libcatch2-defaults", |
| 89 | ], |
Igor Murashkin | 810b037 | 2018-08-09 16:48:37 -0700 | [diff] [blame] | 90 | cflags: ["-fexceptions"], |
| 91 | } |
| 92 | |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 93 | // Configurations meant for validating upstream. Not intended to be used by anything else. |
| 94 | |
| 95 | cc_defaults { |
| 96 | name: "libcatch2-defaults-tests", |
| 97 | host_supported: true, |
| 98 | srcs: [ |
| 99 | "projects/SelfTest/**/*.cpp", |
| 100 | ], |
| 101 | // This directory just re-includes existing tests 100x over. |
| 102 | // This is extremely slow to build, we don't lose coverage by excluding it. |
| 103 | exclude_srcs: [ |
| 104 | "projects/SelfTest/CompileTimePerfTests/**/*.cpp", |
| 105 | ], |
Haibo Huang | 7ddcf95 | 2020-03-19 20:18:59 -0700 | [diff] [blame] | 106 | shared_libs: ["liblog"], |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 107 | } |
| 108 | |
Haibo Huang | e9410df | 2019-03-07 13:34:42 -0800 | [diff] [blame] | 109 | // Upstream config: Exceptions are enabled. |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 110 | // This should be validated first after an upstream merge. |
| 111 | cc_test { |
| 112 | name: "libcatch2-tests-upstream", |
| 113 | defaults: [ |
| 114 | "libcatch2-defaults-tests", |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 115 | ], |
| 116 | |
| 117 | gtest: false, |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 118 | cflags: ["-fexceptions"], |
Igor Murashkin | 810b037 | 2018-08-09 16:48:37 -0700 | [diff] [blame] | 119 | |
| 120 | whole_static_libs: [ |
| 121 | "libcatch2-upstream", |
| 122 | ], |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 123 | } |
| 124 | |
Haibo Huang | e9410df | 2019-03-07 13:34:42 -0800 | [diff] [blame] | 125 | // Android config: Exceptions are disabled. |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 126 | // This should be validated second after an upstream merge. |
| 127 | cc_test { |
| 128 | name: "libcatch2-tests", |
| 129 | defaults: [ |
| 130 | "libcatch2-defaults-tests", |
| 131 | ], |
Haibo Huang | e9410df | 2019-03-07 13:34:42 -0800 | [diff] [blame] | 132 | cflags: [ |
| 133 | "-DCATCH_CONFIG_DISABLE_EXCEPTIONS", |
| 134 | "-Wno-unused-function", |
| 135 | ], |
Igor Murashkin | 4144428 | 2018-08-09 11:04:20 -0700 | [diff] [blame] | 136 | gtest: false, |
| 137 | whole_static_libs: [ |
| 138 | "libcatch2", |
| 139 | ], |
| 140 | } |