blob: 42df9d6634847f2b5b7e4c0326260b25091f6343 [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
15cc_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}
22
23// !!! IMPORTANT: Use 'whole_static_libs' or the linker will dead-code-eliminate
24// parts of the important code (the console and junit reporters).
25
26// Android users: libcatch2-main is what you want 99% of the time.
27// Using the pre-defined main speeds up compilation significantly.
28// If for some reason you want to provide your own `main`, use "libcatch2"
29// See also docs/configuration.md
30cc_library_static {
31 name: "libcatch2-main",
32 defaults: [
33 "libcatch2-defaults",
34 ],
35 srcs: [
36 // cannot use catch_with_main.hpp as main, soong errors with "has unknown extension"
37 // "include/catch_with_main.hpp",
38 "examples/000-CatchMain.cpp",
39 ],
40}
41
42// libcatch2 without the pre-defined main.
43// This is only useful if your program will define its own main.
44cc_library_static {
45 name: "libcatch2",
46 defaults: [
47 "libcatch2-defaults",
48 ],
49}
50
Igor Murashkin810b0372018-08-09 16:48:37 -070051// This rule can be used by other external/ projects that depend on catch2
52// without turning off exceptions.
53cc_library_static {
54 name: "libcatch2-upstream",
55 defaults: [
56 "libcatch2-defaults",
57 ],
58 rtti: true,
59 cflags: ["-fexceptions"],
60}
61
Igor Murashkin41444282018-08-09 11:04:20 -070062// Configurations meant for validating upstream. Not intended to be used by anything else.
63
64cc_defaults {
65 name: "libcatch2-defaults-tests",
66 host_supported: true,
67 srcs: [
68 "projects/SelfTest/**/*.cpp",
69 ],
70 // This directory just re-includes existing tests 100x over.
71 // This is extremely slow to build, we don't lose coverage by excluding it.
72 exclude_srcs: [
73 "projects/SelfTest/CompileTimePerfTests/**/*.cpp",
74 ],
75}
76
77// Upstream config: RTTI and exceptions are enabled.
78// This should be validated first after an upstream merge.
79cc_test {
80 name: "libcatch2-tests-upstream",
81 defaults: [
82 "libcatch2-defaults-tests",
Igor Murashkin41444282018-08-09 11:04:20 -070083 ],
84
85 gtest: false,
86 rtti: true,
87 cflags: ["-fexceptions"],
Igor Murashkin810b0372018-08-09 16:48:37 -070088
89 whole_static_libs: [
90 "libcatch2-upstream",
91 ],
Igor Murashkin41444282018-08-09 11:04:20 -070092}
93
94// Android config: RTTI and exceptions are disabled.
95// This should be validated second after an upstream merge.
96cc_test {
97 name: "libcatch2-tests",
98 defaults: [
99 "libcatch2-defaults-tests",
100 ],
101 gtest: false,
102 whole_static_libs: [
103 "libcatch2",
104 ],
105}