1/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18package {
19    // See: http://go/android-license-faq
20    // A large-scale-change added 'default_applicable_licenses' to import
21    // all of the 'license_kinds' from "system_chre_license"
22    // to get the below license kinds:
23    //   SPDX-license-identifier-Apache-2.0
24    default_applicable_licenses: ["system_chre_license"],
25}
26
27cc_library_static {
28    name: "chre_chpp_linux",
29    vendor: true,
30    cflags: [
31        "-std=c89",
32        "-Wall",
33        "-Wcast-align",
34        "-Wcast-qual",
35        "-Wconversion",
36        "-Werror",
37        "-Wextra",
38        "-Wmissing-prototypes",
39        "-Wno-strict-aliasing",
40        "-Wpointer-arith",
41        "-Wsign-compare",
42        "-Wshadow",
43        "-Wstrict-prototypes",
44        "-Wswitch",
45        "-DCHPP_CHECKSUM_ENABLED",
46        "-DCHPP_CLIENT_ENABLED_DISCOVERY",
47        "-DCHPP_CLIENT_ENABLED_LOOPBACK",
48        "-DCHPP_CLIENT_ENABLED_TIMESYNC",
49        "-DCHPP_CLIENT_ENABLED_TRANSPORT_LOOPBACK",
50        "-DCHPP_CLIENT_ENABLED_GNSS",
51        "-DCHPP_CLIENT_ENABLED_WIFI",
52        "-DCHPP_CLIENT_ENABLED_WWAN",
53        "-DCHPP_SERVICE_ENABLED_GNSS",
54        "-DCHPP_SERVICE_ENABLED_WIFI",
55        "-DCHPP_SERVICE_ENABLED_WWAN",
56        "-DCHPP_SERVICE_ENABLED_TRANSPORT_LOOPBACK",
57        "-DCHPP_MAX_REGISTERED_CLIENTS=3",
58        "-DCHPP_MAX_REGISTERED_SERVICES=3",
59        "-DCHPP_ENABLE_WORK_MONITOR",
60        "-DCHPP_DEBUG_ASSERT_ENABLED",
61        // clock_gettime() requires _POSIX_C_SOURCE >= 199309L
62        "-D_POSIX_C_SOURCE=199309L",
63        // Required for pthread_setname_np()
64        "-D_GNU_SOURCE"
65    ],
66    conlyflags: ["-std=c11"],
67    srcs: [
68        "transport.c",
69        "app.c",
70        "clients.c",
71        "services.c",
72        "clients/discovery.c",
73        "clients/loopback.c",
74        "clients/timesync.c",
75        "clients/gnss.c",
76        "clients/wifi.c",
77        "clients/wwan.c",
78        "common/gnss_convert.c",
79        "common/wifi_convert.c",
80        "common/wifi_utils.c",
81        "common/wwan_convert.c",
82        "services/discovery.c",
83        "services/loopback.c",
84        "services/nonhandle.c",
85        "services/timesync.c",
86        "services/gnss.c",
87        "services/wifi.c",
88        "services/wwan.c",
89        "platform/pal_api.c",
90        "platform/linux/link.c",
91        "platform/linux/memory.c",
92        "platform/linux/notifier.c",
93        "platform/shared/crc.c",
94    ],
95    export_include_dirs: [
96        "platform/linux/include",
97        "include",
98    ],
99    header_libs: [
100        "chre_pal",
101        "chre_api",
102    ],
103    export_header_lib_headers: [
104        "chre_pal",
105        "chre_api",
106    ],
107    static_libs: ["chre_pal_linux"],
108    host_supported: true,
109}
110
111cc_test_host {
112    name: "chre_chpp_linux_tests",
113    cflags: [
114        "-DCHPP_CLIENT_ENABLED_TRANSPORT_LOOPBACK",
115        "-DCHPP_CHECKSUM_ENABLED",
116        "-DCHPP_MAX_REGISTERED_CLIENTS=3",
117        "-DCHPP_MAX_REGISTERED_SERVICES=3",
118        "-DCHPP_ENABLE_WORK_MONITOR",
119    ],
120    srcs: [
121        "test/app_test_base.cpp",
122        "test/app_test.cpp",
123        "test/transport_test.cpp",
124        "test/clients_test.cpp",
125    ],
126    test_suites: [
127        // Needed to support running on TreeHugger
128        "general-tests",
129    ],
130    static_libs: [
131        "chre_chpp_linux",
132        "chre_pal_linux"
133    ],
134}
135
136cc_test_host {
137    name: "chre_chpp_convert_tests",
138    cflags: [
139        "-Wcast-align",
140        "-Wsign-compare",
141    ],
142    header_libs: [
143        "chre_test_common",
144    ],
145    srcs: [
146        "test/wifi_convert_test.cpp",
147        "test/wwan_convert_test.cpp"
148    ],
149    test_suites: [
150        // Needed to support running on TreeHugger
151        "general-tests",
152    ],
153    static_libs: ["chre_chpp_linux"],
154}
155