Alexei Frolov | c10c812 | 2019-11-01 16:31:19 -0700 | [diff] [blame^] | 1 | # Copyright 2019 The Pigweed Authors |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 4 | # use this file except in compliance with the License. You may obtain a copy of |
| 5 | # the License at |
| 6 | # |
| 7 | # https://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, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations under |
| 13 | # the License. |
| 14 | |
| 15 | import("$dir_pw_build/pw_executable.gni") |
| 16 | |
| 17 | config("default_config") { |
| 18 | include_dirs = [ "public" ] |
| 19 | } |
| 20 | |
| 21 | # pw_unit_test core library. |
| 22 | source_set("pw_unit_test") { |
| 23 | public_configs = [ |
| 24 | "$dir_pw_build:pw_default_cpp", |
| 25 | ":default_config", |
| 26 | ] |
| 27 | public_deps = [ |
| 28 | "$dir_pw_preprocessor", |
| 29 | ] |
| 30 | public = [ |
| 31 | "public/gtest/gtest.h", |
| 32 | "public/pw_unit_test/event_handler.h", |
| 33 | "public/pw_unit_test/framework.h", |
| 34 | ] |
| 35 | sources = [ "framework.cc" ] + public |
| 36 | } |
| 37 | |
| 38 | # Library providing an event handler which outputs human-readable text. |
| 39 | source_set("simple_printing_event_handler") { |
| 40 | public_deps = [ |
| 41 | ":pw_unit_test", |
| 42 | "$dir_pw_preprocessor", |
| 43 | ] |
| 44 | public = [ |
| 45 | "public/pw_unit_test/simple_printing_event_handler.h", |
| 46 | ] |
| 47 | sources = [ "simple_printing_event_handler.cc" ] + public |
| 48 | } |
| 49 | |
| 50 | # Library providing a standard desktop main function for the pw_unit_test |
| 51 | # framework. Unit test files can link against this library to build runnable |
| 52 | # unit test executables. |
| 53 | source_set("main") { |
| 54 | public_deps = [ |
| 55 | ":pw_unit_test", |
| 56 | ] |
| 57 | deps = [ |
| 58 | ":simple_printing_event_handler", |
| 59 | ] |
| 60 | sources = [ |
| 61 | "main.cc", |
| 62 | ] |
| 63 | } |
| 64 | |
| 65 | # TODO(frolv): These targets are temporarily here until unit test support is |
| 66 | # integrated into the build system. |
| 67 | pw_executable("framework_test") { |
| 68 | deps = [ |
| 69 | ":main", |
| 70 | ":pw_unit_test", |
| 71 | ] |
| 72 | sources = [ |
| 73 | "framework_test.cc", |
| 74 | ] |
| 75 | } |
| 76 | |
| 77 | group("framework_test_linux") { |
| 78 | deps = [ |
| 79 | ":framework_test($dir_pw_toolchain:x86_linux_o2)", |
| 80 | ] |
| 81 | } |