1# Copyright 2023 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 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/module_config.gni") 18import("$dir_pw_build/target_types.gni") 19import("$dir_pw_docgen/docs.gni") 20import("$dir_pw_third_party/chre/chre.gni") 21import("$dir_pw_unit_test/test.gni") 22 23config("disable_warnings") { 24 cflags = [ 25 "-Wno-nested-anon-types", 26 "-Wno-gnu-anonymous-struct", 27 "-Wno-thread-safety-analysis", 28 "-Wno-vla", 29 ] 30 visibility = [ ":*" ] 31} 32 33config("public_overrides") { 34 include_dirs = [ "include" ] 35} 36 37pw_source_set("chre_empty_host_link") { 38 sources = [ "chre_empty_host_link.cc" ] 39 deps = [ ":chre" ] 40} 41 42pw_source_set("chre_backend_headers") { 43 public = [ 44 "include/chre/target_platform/atomic_base.h", 45 "include/chre/target_platform/atomic_base_impl.h", 46 "include/chre/target_platform/condition_variable_base.h", 47 "include/chre/target_platform/condition_variable_impl.h", 48 "include/chre/target_platform/fatal_error.h", 49 "include/chre/target_platform/host_link_base.h", 50 "include/chre/target_platform/log.h", 51 "include/chre/target_platform/memory_impl.h", 52 "include/chre/target_platform/mutex_base.h", 53 "include/chre/target_platform/mutex_base_impl.h", 54 "include/chre/target_platform/platform_nanoapp_base.h", 55 "include/chre/target_platform/platform_sensor_base.h", 56 "include/chre/target_platform/platform_sensor_manager_base.h", 57 "include/chre/target_platform/platform_sensor_type_helpers_base.h", 58 "include/chre/target_platform/power_control_manager_base.h", 59 "include/chre/target_platform/static_nanoapp_init.h", 60 "include/chre/target_platform/system_timer_base.h", 61 ] 62 public_configs = [ ":public_overrides" ] 63 public_deps = [ 64 "$dir_pw_chrono:system_timer", 65 "$dir_pw_log", 66 "$dir_pw_sync:mutex", 67 "$dir_pw_sync:timed_thread_notification", 68 ] 69} 70 71pw_source_set("pw_chre_backend") { 72 sources = [ 73 "chre_api_re.cc", 74 "context.cc", 75 "host_link.cc", 76 "memory.cc", 77 "memory_manager.cc", 78 "platform_debug_dump_manager.cc", 79 "platform_nanoapp.cc", 80 "platform_pal.cc", 81 "power_control_manager.cc", 82 "system_time.cc", 83 "system_timer.cc", 84 ] 85 deps = [ 86 "$dir_pw_string:format", 87 "$dir_pw_third_party/chre:chre_headers", 88 ] 89 public_deps = [ 90 ":chre_backend_headers", 91 "$dir_pw_chrono:system_timer", 92 "$dir_pw_log", 93 "$dir_pw_sync:mutex", 94 "$dir_pw_sync:timed_thread_notification", 95 ] 96 97 public_configs = [ 98 ":public_include_path", 99 ":public_overrides", 100 ":disable_warnings", 101 ] 102 remove_configs = [ "$dir_pw_build:internal_strict_warnings" ] 103} 104 105pw_source_set("chre_backend") { 106 public_deps = [ 107 ":pw_chre_backend", 108 "$dir_pw_third_party/chre:shared_platform", 109 ] 110} 111 112config("public_include_path") { 113 include_dirs = [ "public" ] 114 visibility = [ ":*" ] 115} 116 117pw_source_set("chre") { 118 public_configs = [ ":public_include_path" ] 119 public = [ 120 "public/pw_chre/chre.h", 121 "public/pw_chre/host_link.h", 122 ] 123 sources = [ "chre.cc" ] 124 deps = [ "$dir_pw_third_party/chre" ] 125} 126 127pw_executable("chre_example") { 128 sources = [ 129 "example_init.cc", 130 "static_nanoapps.cc", 131 ] 132 133 deps = [ 134 ":chre", 135 ":chre_empty_host_link", 136 "$dir_pw_system", 137 "$dir_pw_third_party/chre:example_apps", 138 ] 139} 140 141group("host_example") { 142 deps = [ ":chre_example($dir_pigweed/targets/host_device_simulator:host_device_simulator.speed_optimized)" ] 143} 144 145pw_test_group("tests") { 146 enable_if = dir_pw_third_party_chre != "" 147 tests = [ 148 "$dir_pw_third_party/chre:unit_tests", 149 "$dir_pw_third_party/chre:integration_tests", 150 ] 151} 152 153pw_doc_group("docs") { 154 sources = [ "docs.rst" ] 155} 156