xref: /aosp_15_r20/external/tensorflow/third_party/sqlite.BUILD (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1# Description:
2#   sqlite3 is a serverless SQL RDBMS.
3
4licenses(["unencumbered"])  # Public Domain
5
6SQLITE_COPTS = [
7    "-DSQLITE_ENABLE_JSON1",
8    "-DHAVE_DECL_STRERROR_R=1",
9    "-DHAVE_STDINT_H=1",
10    "-DHAVE_INTTYPES_H=1",
11    "-D_FILE_OFFSET_BITS=64",
12    "-D_REENTRANT=1",
13] + select({
14    "@org_tensorflow//tensorflow:windows": [
15        "-DSQLITE_MAX_TRIGGER_DEPTH=100",
16    ],
17    "@org_tensorflow//tensorflow:macos": [
18        "-Os",
19        "-DHAVE_GMTIME_R=1",
20        "-DHAVE_LOCALTIME_R=1",
21        "-DHAVE_USLEEP=1",
22    ],
23    "//conditions:default": [
24        "-Os",
25        "-DHAVE_FDATASYNC=1",
26        "-DHAVE_GMTIME_R=1",
27        "-DHAVE_LOCALTIME_R=1",
28        "-DHAVE_POSIX_FALLOCATE=1",
29        "-DHAVE_USLEEP=1",
30    ],
31})
32
33# Production build of SQLite library that's baked into TensorFlow.
34cc_library(
35    name = "org_sqlite",
36    srcs = ["sqlite3.c"],
37    hdrs = [
38        "sqlite3.h",
39        "sqlite3ext.h",
40    ],
41    copts = SQLITE_COPTS,
42    defines = [
43        # This gets rid of the bloat of deprecated functionality. It
44        # needs to be listed here instead of copts because it's actually
45        # referenced in the sqlite3.h file.
46        "SQLITE_OMIT_DEPRECATED",
47    ],
48    linkopts = select({
49        "@org_tensorflow//tensorflow:windows": [],
50        "//conditions:default": [
51            "-ldl",
52            "-lpthread",
53        ],
54    }),
55    visibility = ["//visibility:public"],
56)
57
58# This is a Copybara sync helper for Google.
59py_library(
60    name = "python",
61    srcs_version = "PY3",
62    visibility = ["//visibility:public"],
63)
64