• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
32# Configure backend for assert facade.
33pw_set_backend(pw_assert.check pw_assert.print_and_abort_check_backend)
34pw_set_backend(pw_assert.assert pw_assert.print_and_abort_assert_backend)
35
36# Configure backend for logging facade.
37pw_set_backend(pw_log pw_log_basic)
38
39# Configure backends for pw_sync's facades.
40pw_set_backend(pw_sync.interrupt_spin_lock pw_sync_stl.interrupt_spin_lock)
41pw_set_backend(pw_sync.binary_semaphore pw_sync_stl.binary_semaphore_backend)
42pw_set_backend(pw_sync.counting_semaphore
43               pw_sync_stl.counting_semaphore_backend)
44pw_set_backend(pw_sync.mutex pw_sync_stl.mutex_backend)
45pw_set_backend(pw_sync.timed_mutex pw_sync_stl.timed_mutex_backend)
46pw_set_backend(pw_sync.thread_notification
47               pw_sync.binary_semaphore_thread_notification_backend)
48pw_set_backend(pw_sync.timed_thread_notification
49               pw_sync.binary_semaphore_timed_thread_notification_backend)
50
51# Configure backend for pw_sys_io facade.
52pw_set_backend(pw_sys_io pw_sys_io_stdio)
53
54# Configure backend for pw_rpc_system_server.
55pw_set_backend(pw_rpc.system_server targets.host.system_rpc_server)
56# TODO(hepler): set config to use global mutex
57
58# Configure backend for pw_chrono's facades.
59pw_set_backend(pw_chrono.system_clock pw_chrono_stl.system_clock)
60pw_set_backend(pw_chrono.system_timer pw_chrono_stl.system_timer)
61
62# Configure backend for pw_perf_test's facade.
63pw_perf_test(pw_perf_test.timer pw_perf_test.chrono_timer)
64
65# Configure backends for pw_thread's facades.
66pw_set_backend(pw_thread.id pw_thread_stl.id)
67pw_set_backend(pw_thread.yield pw_thread_stl.yield)
68pw_set_backend(pw_thread.sleep pw_thread_stl.sleep)
69pw_set_backend(pw_thread.thread pw_thread_stl.thread)
70
71# TODO(ewout): Migrate this to match GN's tokenized trace setup.
72pw_set_backend(pw_trace pw_trace.null)
73
74set(pw_build_WARNINGS pw_build.strict_warnings pw_build.extra_strict_warnings
75    CACHE STRING "" FORCE)
76