1// Copyright (C) 2016 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://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,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15cc_defaults {
16    name: "hidl-gen-defaults",
17    cflags: [
18        "-Wall",
19        "-Werror",
20    ],
21    target: {
22        host: {
23            cflags: [
24                "-O0",
25                "-g",
26            ],
27        },
28    },
29}
30
31// This configuration is inherited by all hidl-gen-generated modules.
32cc_defaults {
33    name: "hidl-module-defaults",
34    cflags: [
35        "-Wall",
36        "-Werror",
37        "-Wextra-semi",
38    ],
39    tidy_checks: [
40        // _hidl_cb and addOnewayTask are stuck because of the legacy ABI
41        "-performance-unnecessary-value-param",
42    ],
43    product_variables: {
44        debuggable: {
45            cflags: ["-D__ANDROID_DEBUGGABLE__"],
46        },
47    },
48}
49
50// This configuration is inherited by all hidl-gen-java modules
51java_defaults {
52    name: "hidl-java-module-defaults",
53    // TODO(b/68433855): allow HIDL java to build in the PDK
54    product_variables: {
55        pdk: {
56            enabled: false,
57        },
58    },
59}
60
61cc_library_host_static {
62    name: "libhidl-gen",
63    defaults: ["hidl-gen-defaults"],
64    cflags: [
65        "-Wno-bool-operation", // found in ConstantExpression.cpp:105
66    ],
67    srcs: [
68        "Annotation.cpp",
69        "ArrayType.cpp",
70        "CompoundType.cpp",
71        "ConstantExpression.cpp",
72        "DeathRecipientType.cpp",
73        "DocComment.cpp",
74        "EnumType.cpp",
75        "FmqType.cpp",
76        "HandleType.cpp",
77        "HidlTypeAssertion.cpp",
78        "Interface.cpp",
79        "Location.cpp",
80        "MemoryType.cpp",
81        "Method.cpp",
82        "NamedType.cpp",
83        "PointerType.cpp",
84        "ScalarType.cpp",
85        "Scope.cpp",
86        "StringType.cpp",
87        "Type.cpp",
88        "TypeDef.cpp",
89        "VectorType.cpp",
90    ],
91    shared_libs: [
92        "libbase",
93        "liblog",
94    ],
95    static_libs: [
96        "libcrypto",
97        "libhidl-gen-hash",
98        "libhidl-gen-host-utils",
99        "libhidl-gen-utils",
100    ],
101    export_shared_lib_headers: ["libbase"],
102    export_static_lib_headers: [
103        "libhidl-gen-hash",
104        "libhidl-gen-host-utils",
105        "libhidl-gen-utils",
106    ],
107    export_include_dirs: ["."], // for tests
108}
109
110cc_library_host_static {
111    name: "libhidl-gen-ast",
112    defaults: ["hidl-gen-defaults"],
113    srcs: [
114        "AST.cpp",
115        "Coordinator.cpp",
116        "generateCpp.cpp",
117        "generateCppAdapter.cpp",
118        "generateCppImpl.cpp",
119        "generateDependencies.cpp",
120        "generateFormattedHidl.cpp",
121        "generateInheritanceHierarchy.cpp",
122        "generateJava.cpp",
123        "generateJavaImpl.cpp",
124        "generateVts.cpp",
125        "hidl-gen_l.ll",
126        "hidl-gen_y.yy",
127    ],
128    shared_libs: [
129        "libbase",
130        "libjsoncpp",
131    ],
132    static_libs: [
133        "libcrypto",
134        "libhidl-gen",
135        "libhidl-gen-hash",
136        "libhidl-gen-host-utils",
137        "libhidl-gen-utils",
138    ],
139    export_shared_lib_headers: ["libbase"],
140    export_static_lib_headers: [
141        "libhidl-gen-hash",
142        "libhidl-gen-utils",
143    ],
144    export_include_dirs: ["."], // for tests
145    yacc: {
146        gen_location_hh: true,
147        gen_position_hh: true,
148    },
149}
150
151cc_binary_host {
152    name: "hidl-gen",
153    defaults: ["hidl-gen-defaults"],
154    srcs: ["main.cpp"],
155    static_libs: [
156        "libbase",
157        "libcrypto",
158        "libhidl-gen",
159        "libhidl-gen-ast",
160        "libhidl-gen-hash",
161        "libhidl-gen-host-utils",
162        "libhidl-gen-utils",
163        "libjsoncpp",
164        "liblog",
165    ],
166}
167