xref: /aosp_15_r20/external/perfetto/bazel/sqlite.BUILD (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1# Copyright (C) 2019 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
15# This build file is used for both @perfetto_dep_sqlite and
16# @perfetto_dep_sqlite_src.
17
18load("@perfetto_cfg//:perfetto_cfg.bzl", "PERFETTO_CONFIG")
19
20# #############################
21# @perfetto_dep_sqlite section
22# #############################
23
24filegroup(
25    name = "headers",
26    srcs = [
27        "sqlite3.h",
28        "sqlite3ext.h",
29    ],
30    visibility = ["//visibility:public"],
31)
32
33include_sqlite = [
34    ".",
35]
36
37sqlite_copts = [
38    "-Wno-misleading-indentation",
39    "-DSQLITE_THREADSAFE=0",
40    "-DQLITE_DEFAULT_MEMSTATUS=0",
41    "-DSQLITE_LIKE_DOESNT_MATCH_BLOBS",
42    "-DSQLITE_OMIT_DEPRECATED",
43    "-DSQLITE_OMIT_SHARED_CACHE",
44    "-DHAVE_USLEEP",
45    "-DHAVE_UTIME",
46    "-DSQLITE_BYTEORDER=1234",
47    "-DSQLITE_DEFAULT_AUTOVACUUM=0",
48    "-DSQLITE_DEFAULT_MMAP_SIZE=0",
49    "-DSQLITE_CORE",
50    "-DSQLITE_TEMP_STORE=3",
51    "-DSQLITE_OMIT_LOAD_EXTENSION",
52    "-DSQLITE_OMIT_RANDOMNESS",
53] + PERFETTO_CONFIG.deps_copts.sqlite
54
55cc_library(
56    name = "sqlite",
57    srcs = [
58        "sqlite3.c",
59        "sqlite3.h",
60    ],
61    hdrs = [":headers"],
62    copts = sqlite_copts,
63    includes = include_sqlite,
64    visibility = ["//visibility:public"],
65)
66
67# ################################
68# @perfetto_dep_sqlite_src section
69# ################################
70
71cc_library(
72    name = "percentile_ext",
73    srcs = [
74        "ext/misc/percentile.c",
75    ],
76    copts = sqlite_copts,
77    deps = PERFETTO_CONFIG.deps.sqlite,
78    visibility = ["//visibility:public"],
79)
80