1# Copyright 2020 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# Do not rely on the PW_ROOT environment variable being set through bootstrap. 16# Regardless of whether it's set or not the following include will ensure it is. 17include(${CMAKE_CURRENT_LIST_DIR}/../../pw_build/pigweed.cmake) 18 19include($ENV{PW_ROOT}/pw_assert/backend.cmake) 20include($ENV{PW_ROOT}/pw_chrono/backend.cmake) 21include($ENV{PW_ROOT}/pw_log/backend.cmake) 22include($ENV{PW_ROOT}/pw_perf_test/backend.cmake) 23include($ENV{PW_ROOT}/pw_rpc/system_server/backend.cmake) 24include($ENV{PW_ROOT}/pw_sync/backend.cmake) 25include($ENV{PW_ROOT}/pw_sys_io/backend.cmake) 26include($ENV{PW_ROOT}/pw_thread/backend.cmake) 27include($ENV{PW_ROOT}/pw_trace/backend.cmake) 28 29set(CMAKE_C_COMPILER gcc) 30set(CMAKE_CXX_COMPILER g++) 31 32pw_add_global_compile_options(-std=c++20 LANGUAGES CXX) 33 34# Configure backend for assert facade. 35pw_set_backend(pw_assert.check pw_assert.print_and_abort_check_backend) 36pw_set_backend(pw_assert.assert pw_assert.print_and_abort_assert_backend) 37 38# Configure backend for logging facade. 39pw_set_backend(pw_log pw_log_basic) 40 41# Configure backends for pw_sync's facades. 42pw_set_backend(pw_sync.interrupt_spin_lock pw_sync_stl.interrupt_spin_lock) 43pw_set_backend(pw_sync.binary_semaphore pw_sync_stl.binary_semaphore_backend) 44pw_set_backend(pw_sync.counting_semaphore 45 pw_sync_stl.counting_semaphore_backend) 46pw_set_backend(pw_sync.mutex pw_sync_stl.mutex_backend) 47pw_set_backend(pw_sync.timed_mutex pw_sync_stl.timed_mutex_backend) 48pw_set_backend(pw_sync.thread_notification 49 pw_sync.binary_semaphore_thread_notification_backend) 50pw_set_backend(pw_sync.timed_thread_notification 51 pw_sync.binary_semaphore_timed_thread_notification_backend) 52 53# Configure backend for pw_sys_io facade. 54pw_set_backend(pw_sys_io pw_sys_io_stdio) 55 56# Configure backend for pw_rpc_system_server. 57pw_set_backend(pw_rpc.system_server targets.host.system_rpc_server) 58# TODO(hepler): set config to use global mutex 59 60# Configure backend for pw_chrono's facades. 61pw_set_backend(pw_chrono.system_clock pw_chrono_stl.system_clock) 62pw_set_backend(pw_chrono.system_timer pw_chrono_stl.system_timer) 63 64# Configure backend for pw_perf_test's facade. 65pw_perf_test(pw_perf_test.timer pw_perf_test.chrono_timer) 66 67# Configure backends for pw_thread's facades. 68pw_set_backend(pw_thread.id pw_thread_stl.id) 69pw_set_backend(pw_thread.yield pw_thread_stl.yield) 70pw_set_backend(pw_thread.sleep pw_thread_stl.sleep) 71pw_set_backend(pw_thread.thread pw_thread_stl.thread) 72 73# TODO(ewout): Migrate this to match GN's tokenized trace setup. 74pw_set_backend(pw_trace pw_trace.null) 75 76set(pw_build_WARNINGS pw_build.strict_warnings pw_build.extra_strict_warnings 77 CACHE STRING "" FORCE) 78