From 5d66ea93b2b17dbd4dcc886dcadc455b90bc6e08 Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Wed, 3 Jan 2018 08:22:37 -0800 Subject: Add Snappy support to SQLite This change also puts the necessary build infrastructure in place so we can continue to build many proper lightweight SQLite extensions in the future that are easy for users to copy over into their own environments, so they can readily access their data. PiperOrigin-RevId: 180673039 --- third_party/sqlite.BUILD | 61 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 7 deletions(-) (limited to 'third_party/sqlite.BUILD') diff --git a/third_party/sqlite.BUILD b/third_party/sqlite.BUILD index 9840d7b151..761838d194 100644 --- a/third_party/sqlite.BUILD +++ b/third_party/sqlite.BUILD @@ -1,16 +1,63 @@ # Description: -# Sqlite3 library. Provides utilities for interacting -# with sqlite3 databases. +# sqlite3 is a serverless SQL RDBMS. licenses(["unencumbered"]) # Public Domain -# exports_files(["LICENSE"]) +SQLITE_COPTS = [ + "-DHAVE_DECL_STRERROR_R=1", + "-DHAVE_STDINT_H=1", + "-DHAVE_INTTYPES_H=1", + "-D_FILE_OFFSET_BITS=64", + "-D_REENTRANT=1", +] + select({ + "@org_tensorflow//tensorflow:windows": [ + "-DSQLITE_MAX_TRIGGER_DEPTH=100", + ], + "@org_tensorflow//tensorflow:windows_msvc": [ + "-DSQLITE_MAX_TRIGGER_DEPTH=100", + ], + "@org_tensorflow//tensorflow:darwin": [ + "-DHAVE_GMTIME_R=1", + "-DHAVE_LOCALTIME_R=1", + "-DHAVE_USLEEP=1", + ], + "//conditions:default": [ + "-DHAVE_FDATASYNC=1", + "-DHAVE_GMTIME_R=1", + "-DHAVE_LOCALTIME_R=1", + "-DHAVE_POSIX_FALLOCATE=1", + "-DHAVE_USLEEP=1", + ], +}) +# Production build of SQLite library that's baked into TensorFlow. cc_library( - name = "sqlite", + name = "org_sqlite", srcs = ["sqlite3.c"], - hdrs = ["sqlite3.h"], - includes = ["."], - linkopts = ["-lm"], + hdrs = [ + "sqlite3.h", + "sqlite3ext.h", + ], + copts = SQLITE_COPTS, + defines = [ + # This gets rid of the bloat of deprecated functionality. It + # needs to be listed here instead of copts because it's actually + # referenced in the sqlite3.h file. + "SQLITE_OMIT_DEPRECATED", + ], + linkopts = select({ + "@org_tensorflow//tensorflow:windows_msvc": [], + "//conditions:default": [ + "-ldl", + "-lpthread", + ], + }), + visibility = ["//visibility:public"], +) + +# This is a Copybara sync helper for Google. +py_library( + name = "python", + srcs_version = "PY2AND3", visibility = ["//visibility:public"], ) -- cgit v1.2.3