• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2020 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
15cpuinfo_arm_common_src_files = [
16    "src/arm/uarch.c",
17    "src/arm/cache.c",
18    "src/arm/linux/init.c",
19    "src/arm/linux/cpuinfo.c",
20    "src/arm/linux/clusters.c",
21    "src/arm/linux/chipset.c",
22    "src/arm/linux/midr.c",
23    "src/arm/linux/hwcap.c",
24    "src/arm/android/properties.c",
25]
26
27cpuinfo_x86_common_src_files = [
28    "src/x86/init.c",
29    "src/x86/info.c",
30    "src/x86/name.c",
31    "src/x86/isa.c",
32    "src/x86/vendor.c",
33    "src/x86/uarch.c",
34    "src/x86/topology.c",
35    "src/x86/cache/init.c",
36    "src/x86/cache/descriptor.c",
37    "src/x86/cache/deterministic.c",
38    "src/x86/linux/cpuinfo.c",
39    "src/x86/linux/init.c",
40]
41
42cc_library_static {
43    name: "libcpuinfo",
44    export_include_dirs: ["include"],
45    vendor_available: true,
46    sdk_version: "current",
47    local_include_dirs: [
48        "src",
49    ],
50    srcs: [
51        "src/init.c",
52        "src/api.c",
53        "src/cache.c",
54        "src/linux/current.c",
55        "src/linux/processors.c",
56        "src/linux/smallfile.c",
57        "src/linux/multiline.c",
58        "src/linux/cpulist.c",
59    ],
60    arch: {
61        arm: {
62            srcs: cpuinfo_arm_common_src_files + [
63                "src/arm/linux/aarch32-isa.c",
64            ],
65            cflags: [
66                "-mcpu=generic",
67                "-march=armv7-a",
68            ],
69       },
70        arm64: {
71            srcs: cpuinfo_arm_common_src_files + [
72                "src/arm/linux/aarch64-isa.c",
73            ],
74        },
75        x86: {
76            srcs: cpuinfo_x86_common_src_files,
77        },
78        x86_64: {
79            srcs: cpuinfo_x86_common_src_files,
80        },
81    },
82    cflags: [
83        "-std=c99",
84        "-Oz",
85        "-D_GNU_SOURCE=1",
86        "-Wno-unused-function",
87        "-Wno-unused-parameter",
88        "-Wno-missing-field-initializers",
89    ],
90    whole_static_libs: [
91        "libclog",
92    ],
93}
94