blob: 4852cf03e8a7ca97389bf7bda57a06d4ddbfc6b1 [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"],
Haibo Huange9410df2019-03-07 13:34:42 -080021 exclude_srcs: ["include/catch_with_main.cpp"],
Igor Murashkin41444282018-08-09 11:04:20 -070022}
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
31cc_library_static {
32 name: "libcatch2-main",
33 defaults: [
34 "libcatch2-defaults",
35 ],
36 srcs: [
Haibo Huange9410df2019-03-07 13:34:42 -080037 "include/catch_with_main.cpp",
Igor Murashkin41444282018-08-09 11:04:20 -070038 ],
39}
40
41// libcatch2 without the pre-defined main.
42// This is only useful if your program will define its own main.
43cc_library_static {
44 name: "libcatch2",
45 defaults: [
46 "libcatch2-defaults",
47 ],
Haibo Huange9410df2019-03-07 13:34:42 -080048 cflags: ["-DCATCH_CONFIG_DISABLE_EXCEPTIONS"],
Igor Murashkin41444282018-08-09 11:04:20 -070049}
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 ],
Igor Murashkin810b0372018-08-09 16:48:37 -070058 cflags: ["-fexceptions"],
59}
60
Igor Murashkin41444282018-08-09 11:04:20 -070061// Configurations meant for validating upstream. Not intended to be used by anything else.
62
63cc_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
Haibo Huange9410df2019-03-07 13:34:42 -080076// Upstream config: Exceptions are enabled.
Igor Murashkin41444282018-08-09 11:04:20 -070077// This should be validated first after an upstream merge.
78cc_test {
79 name: "libcatch2-tests-upstream",
80 defaults: [
81 "libcatch2-defaults-tests",
Igor Murashkin41444282018-08-09 11:04:20 -070082 ],
83
84 gtest: false,
Igor Murashkin41444282018-08-09 11:04:20 -070085 cflags: ["-fexceptions"],
Igor Murashkin810b0372018-08-09 16:48:37 -070086
87 whole_static_libs: [
88 "libcatch2-upstream",
89 ],
Igor Murashkin41444282018-08-09 11:04:20 -070090}
91
Haibo Huange9410df2019-03-07 13:34:42 -080092// Android config: Exceptions are disabled.
Igor Murashkin41444282018-08-09 11:04:20 -070093// This should be validated second after an upstream merge.
94cc_test {
95 name: "libcatch2-tests",
96 defaults: [
97 "libcatch2-defaults-tests",
98 ],
Haibo Huange9410df2019-03-07 13:34:42 -080099 cflags: [
100 "-DCATCH_CONFIG_DISABLE_EXCEPTIONS",
101 "-Wno-unused-function",
102 ],
Igor Murashkin41444282018-08-09 11:04:20 -0700103 gtest: false,
104 whole_static_libs: [
105 "libcatch2",
106 ],
107}