blob: 99a231e5bae67b15004715d2de903c2b698729f3 [file] [log] [blame]
Igor Murashkin41444282018-08-09 11:04:20 -07001// 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 Badour57ec8902021-02-12 15:04:15 -080015package {
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
33license {
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 Murashkin41444282018-08-09 11:04:20 -070047cc_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 Huange9410df2019-03-07 13:34:42 -080053 exclude_srcs: ["include/catch_with_main.cpp"],
Igor Murashkin41444282018-08-09 11:04:20 -070054}
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
63cc_library_static {
64 name: "libcatch2-main",
65 defaults: [
66 "libcatch2-defaults",
67 ],
68 srcs: [
Haibo Huange9410df2019-03-07 13:34:42 -080069 "include/catch_with_main.cpp",
Igor Murashkin41444282018-08-09 11:04:20 -070070 ],
71}
72
73// libcatch2 without the pre-defined main.
74// This is only useful if your program will define its own main.
75cc_library_static {
76 name: "libcatch2",
77 defaults: [
78 "libcatch2-defaults",
79 ],
Haibo Huange9410df2019-03-07 13:34:42 -080080 cflags: ["-DCATCH_CONFIG_DISABLE_EXCEPTIONS"],
Igor Murashkin41444282018-08-09 11:04:20 -070081}
82
Igor Murashkin810b0372018-08-09 16:48:37 -070083// This rule can be used by other external/ projects that depend on catch2
84// without turning off exceptions.
85cc_library_static {
86 name: "libcatch2-upstream",
87 defaults: [
88 "libcatch2-defaults",
89 ],
Igor Murashkin810b0372018-08-09 16:48:37 -070090 cflags: ["-fexceptions"],
91}
92
Igor Murashkin41444282018-08-09 11:04:20 -070093// Configurations meant for validating upstream. Not intended to be used by anything else.
94
95cc_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 Huang7ddcf952020-03-19 20:18:59 -0700106 shared_libs: ["liblog"],
Igor Murashkin41444282018-08-09 11:04:20 -0700107}
108
Haibo Huange9410df2019-03-07 13:34:42 -0800109// Upstream config: Exceptions are enabled.
Igor Murashkin41444282018-08-09 11:04:20 -0700110// This should be validated first after an upstream merge.
111cc_test {
112 name: "libcatch2-tests-upstream",
113 defaults: [
114 "libcatch2-defaults-tests",
Igor Murashkin41444282018-08-09 11:04:20 -0700115 ],
116
117 gtest: false,
Igor Murashkin41444282018-08-09 11:04:20 -0700118 cflags: ["-fexceptions"],
Igor Murashkin810b0372018-08-09 16:48:37 -0700119
120 whole_static_libs: [
121 "libcatch2-upstream",
122 ],
Igor Murashkin41444282018-08-09 11:04:20 -0700123}
124
Haibo Huange9410df2019-03-07 13:34:42 -0800125// Android config: Exceptions are disabled.
Igor Murashkin41444282018-08-09 11:04:20 -0700126// This should be validated second after an upstream merge.
127cc_test {
128 name: "libcatch2-tests",
129 defaults: [
130 "libcatch2-defaults-tests",
131 ],
Haibo Huange9410df2019-03-07 13:34:42 -0800132 cflags: [
133 "-DCATCH_CONFIG_DISABLE_EXCEPTIONS",
134 "-Wno-unused-function",
135 ],
Igor Murashkin41444282018-08-09 11:04:20 -0700136 gtest: false,
137 whole_static_libs: [
138 "libcatch2",
139 ],
140}