summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers/CMakeLists.txt
blob: 1db421dd7b4773c7988857973909ad7c8047803f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Copyright 2021 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(${ZMAKE_PROJECT_NAME})

target_include_directories(app PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    "${PLATFORM_EC}/driver/ppc/")

# Common sources
target_sources(app PRIVATE
  src/main.c
  src/test_mocks.c
  src/test_rules.c
  src/utils.c
  src/stubs.c
)

if(NOT ZMAKE_PROJECT_NAME MATCHES "^test-drivers.*")
  message(FATAL "Invalid project name")
endif()
string(SUBSTRING "${ZMAKE_PROJECT_NAME}" 12 -1 subproject_path)
string(REPLACE "-" "/" subproject_path "${subproject_path}")

if(subproject_path STREQUAL "")
  target_sources(app PRIVATE
    src/battery.c
    src/bb_retimer.c
    src/bc12.c
    src/bma2x2.c
    src/bmi160.c
    src/bmi260.c
    src/charge_manager.c
    src/console_cmd/charge_manager.c
    src/console_cmd/charge_state.c
    src/console_cmd/accelinit.c
    src/console_cmd/accelinfo.c
    src/console_cmd/accelspoof.c
    src/console_cmd/accelrate.c
    src/console_cmd/accelrange.c
    src/console_cmd/accelread.c
    src/console_cmd/accelres.c
    src/console_cmd/usb_pd_console.c
    src/cros_cbi.c
    src/espi.c
    src/gpio.c
    src/host_cmd/host_event_commands.c
    src/host_cmd/motion_sense.c
    src/integration/usbc/usb.c
    src/integration/usbc/usb_20v_3a_pd_charger.c
    src/integration/usbc/usb_5v_3a_pd_sink.c
    src/integration/usbc/usb_5v_3a_pd_source.c
    src/integration/usbc/usb_attach_src_snk.c
    src/integration/usbc/usb_pd_ctrl_msg.c
    src/integration/usbc/usb_pd_rev3.c
    src/i2c_passthru.c
    src/isl923x.c
    src/keyboard_scan.c
    src/lid_switch.c
    src/lis2dw12.c
    src/ln9310.c
    src/motion_sense/motion_sense.c
    src/panic.c
    src/power_common.c
    src/ppc_sn5s330.c
    src/ppc_syv682x.c
    src/ps8xxx.c
    src/smart.c
    src/stm_mems_common.c
    src/tcpci.c
    src/tcpci_test_common.c
    src/tcs3400.c
    src/temp_sensor.c
    src/thermistor.c
    src/uart_hostcmd.c
    src/usb_mux.c
    src/usb_pd_host_cmd.c
    src/vboot_hash.c
    src/watchdog.c
  )

    add_subdirectory(usb_malfunction_sink)
else()
  add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}${subproject_path})
endif()

set_compiler_property(APPEND PROPERTY coverage -O0)