[DO-982] add sqlite package (!13)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/13
This commit is contained in:
190
recipes/sqlite3/all/CMakeLists.txt
Normal file
190
recipes/sqlite3/all/CMakeLists.txt
Normal file
@@ -0,0 +1,190 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
project(sqlite3 LANGUAGES C)
|
||||
|
||||
# Add some options from https://sqlite.org/compile.html
|
||||
option(SQLITE3_BUILD_EXECUTABLE "Build sqlite command line utility for accessing SQLite databases")
|
||||
option(ENABLE_JSON1 "Enable JSON SQL functions")
|
||||
option(ENABLE_COLUMN_METADATA "Enable additional APIs that provide convenient access to meta-data about tables and queries")
|
||||
option(ENABLE_DBSTAT_VTAB "Enable the DBSTAT virtual table")
|
||||
option(ENABLE_EXPLAIN_COMMENTS "Enable SQLite to insert comment text into the output of EXPLAIN")
|
||||
option(ENABLE_FTS3 "Enable version 3 of the full-text search engine")
|
||||
option(ENABLE_FTS3_PARENTHESIS "Kodifies the query pattern parser in FTS3 such that it supports operators AND and NOT (in addition to the usual OR and NEAR) and also allows query expressions to contain nested parenthesis")
|
||||
option(ENABLE_FTS4 "Enable version 3 and 4 of the full-text search engine")
|
||||
option(ENABLE_FTS5 "Enable version 5 of the full-text search engine")
|
||||
option(ENABLE_SOUNDEX "Enable the soundex() SQL function")
|
||||
option(ENABLE_PREUPDATE_HOOK "Enables APIs to handle any change to a rowid table")
|
||||
option(ENABLE_RTREE "Enable support for the R*Tree index extension")
|
||||
option(ENABLE_UNLOCK_NOTIFY "Enable support for the unlock notify API")
|
||||
option(ENABLE_DEFAULT_SECURE_DELETE "Turns on secure deletion by default")
|
||||
option(USE_ALLOCA "The alloca() memory allocator will be used in a few situations where it is appropriate.")
|
||||
option(USE_URI "This option causes the URI filename process logic to be enabled by default.")
|
||||
option(OMIT_LOAD_EXTENSION "Omits the entire extension loading mechanism from SQLite")
|
||||
option(OMIT_DEPRECATED "Omits deprecated interfaces and features")
|
||||
if(SQLITE3_VERSION VERSION_GREATER_EQUAL "3.35.0")
|
||||
option(ENABLE_MATH_FUNCTIONS "Enables the built-in SQL math functions" ON)
|
||||
else()
|
||||
set(ENABLE_MATH_FUNCTIONS OFF)
|
||||
endif()
|
||||
option(HAVE_FDATASYNC "Use fdatasync() instead of fsync() on unix systems")
|
||||
option(HAVE_GMTIME_R "Use the threadsafe gmtime_r()")
|
||||
option(HAVE_LOCALTIME_R "Use the threadsafe localtime_r()")
|
||||
option(HAVE_POSIX_FALLOCATE "Use posix_fallocate()")
|
||||
option(HAVE_STRERROR_R "Use strerror_r()")
|
||||
option(HAVE_USLEEP "Use usleep() system call to implement the xSleep method")
|
||||
option(DISABLE_GETHOSTUUID "Disable function gethostuuid")
|
||||
set(MAX_COLUMN CACHE STRING "The maximum number of columns in a table / index / view")
|
||||
set(MAX_VARIABLE_NUMBER CACHE STRING "The maximum value of a ?nnn wildcard that the parser will accept")
|
||||
set(MAX_BLOB_SIZE CACHE STRING "Set the maximum number of bytes in a string or BLOB")
|
||||
option(DISABLE_DEFAULT_VFS "Disable default VFS implementation")
|
||||
option(ENABLE_DBPAGE_VTAB "The SQLITE_DBPAGE extension implements an eponymous-only virtual table that provides direct access to the underlying database file by interacting with the pager. SQLITE_DBPAGE is capable of both reading and writing any page of the database. Because interaction is through the pager layer, all changes are transactional.")
|
||||
|
||||
add_library(${PROJECT_NAME} ${SQLITE3_SRC_DIR}/sqlite3.c)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES C_VISIBILITY_PRESET hidden)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(WIN32)
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PRIVATE "SQLITE_API=__declspec(dllexport)"
|
||||
INTERFACE "SQLITE_API=__declspec(dllimport)"
|
||||
)
|
||||
else()
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PUBLIC "SQLITE_API=__attribute__((visibility(\"default\")))"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if(ENABLE_JSON1)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_JSON1)
|
||||
endif()
|
||||
if(ENABLE_COLUMN_METADATA)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_COLUMN_METADATA)
|
||||
endif()
|
||||
if(ENABLE_DBSTAT_VTAB)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_DBSTAT_VTAB)
|
||||
endif()
|
||||
if(ENABLE_EXPLAIN_COMMENTS)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_EXPLAIN_COMMENTS)
|
||||
endif()
|
||||
if(ENABLE_FTS3)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_FTS3)
|
||||
endif()
|
||||
if(ENABLE_FTS3_PARENTHESIS)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_FTS3_PARENTHESIS)
|
||||
endif()
|
||||
if(ENABLE_FTS4)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_FTS4)
|
||||
endif()
|
||||
if(ENABLE_FTS5)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_FTS5)
|
||||
endif()
|
||||
if(ENABLE_PREUPDATE_HOOK)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_PREUPDATE_HOOK)
|
||||
endif()
|
||||
if(ENABLE_RTREE)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_RTREE)
|
||||
endif()
|
||||
if(ENABLE_UNLOCK_NOTIFY)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_UNLOCK_NOTIFY)
|
||||
endif()
|
||||
if(ENABLE_DEFAULT_SECURE_DELETE)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_SECURE_DELETE)
|
||||
endif()
|
||||
if(ENABLE_SOUNDEX)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_SOUNDEX)
|
||||
endif()
|
||||
if(USE_ALLOCA)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_USE_ALLOCA)
|
||||
endif()
|
||||
if(USE_URI)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_USE_URI)
|
||||
endif()
|
||||
if(OMIT_LOAD_EXTENSION)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_OMIT_LOAD_EXTENSION)
|
||||
endif()
|
||||
if (OMIT_DEPRECATED)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_OMIT_DEPRECATED)
|
||||
endif()
|
||||
if(ENABLE_MATH_FUNCTIONS)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_MATH_FUNCTIONS)
|
||||
endif()
|
||||
if(HAVE_FDATASYNC)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_FDATASYNC)
|
||||
endif()
|
||||
if(HAVE_GMTIME_R)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_GMTIME_R)
|
||||
endif()
|
||||
if(HAVE_LOCALTIME_R)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_LOCALTIME_R)
|
||||
endif()
|
||||
if(HAVE_POSIX_FALLOCATE)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_POSIX_FALLOCATE)
|
||||
endif()
|
||||
if(HAVE_STRERROR_R)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_STRERROR_R)
|
||||
endif()
|
||||
if(HAVE_USLEEP)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_USLEEP)
|
||||
endif()
|
||||
if(DISABLE_GETHOSTUUID)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_GETHOSTUUID=0)
|
||||
endif()
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_THREADSAFE=${THREADSAFE})
|
||||
if(MAX_COLUMN)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_MAX_COLUMN=${MAX_COLUMN})
|
||||
endif()
|
||||
if(MAX_VARIABLE_NUMBER)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_MAX_VARIABLE_NUMBER=${MAX_VARIABLE_NUMBER})
|
||||
endif()
|
||||
if(MAX_BLOB_SIZE)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_MAX_LENGTH=${MAX_BLOB_SIZE})
|
||||
endif()
|
||||
if(DISABLE_DEFAULT_VFS)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_OS_OTHER=1)
|
||||
endif()
|
||||
if(ENABLE_DBPAGE_VTAB)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_ENABLE_DBPAGE_VTAB)
|
||||
endif()
|
||||
|
||||
if(THREADSAFE)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
|
||||
endif()
|
||||
|
||||
if(NOT OMIT_LOAD_EXTENSION)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
if(ENABLE_FTS5 OR ENABLE_MATH_FUNCTIONS)
|
||||
include(CheckLibraryExists)
|
||||
# Check if math functionality is on the separate 'libm' library,
|
||||
# otherwise assume that it is already part of the C runtime.
|
||||
# The `m` library is part of the compiler toolchain, this checks
|
||||
# if the compiler can successfully link against the library.
|
||||
check_library_exists(m log "" HAVE_MATH_LIBRARY)
|
||||
if(HAVE_MATH_LIBRARY)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE m)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
install(DIRECTORY ${SQLITE3_SRC_DIR}/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
|
||||
if(SQLITE3_BUILD_EXECUTABLE)
|
||||
add_executable(sqlite3-bin ${SQLITE3_SRC_DIR}/shell.c)
|
||||
target_link_libraries(sqlite3-bin PRIVATE ${PROJECT_NAME})
|
||||
if(ENABLE_DBPAGE_VTAB)
|
||||
target_compile_definitions(sqlite3-bin PRIVATE SQLITE_ENABLE_DBPAGE_VTAB)
|
||||
endif()
|
||||
set_target_properties(sqlite3-bin PROPERTIES OUTPUT_NAME "sqlite3" PDB_NAME "sqlite3-bin")
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(system "stdlib.h" HAVE_SYSTEM)
|
||||
if(NOT HAVE_SYSTEM)
|
||||
target_compile_definitions(sqlite3-bin PRIVATE SQLITE_NOHAVE_SYSTEM)
|
||||
endif()
|
||||
install(TARGETS sqlite3-bin DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
82
recipes/sqlite3/all/conandata.yml
Normal file
82
recipes/sqlite3/all/conandata.yml
Normal file
@@ -0,0 +1,82 @@
|
||||
sources:
|
||||
"3.47.1":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2024/sqlite-amalgamation-3470100.zip"
|
||||
sha256: "9da21e6b14ef6a943cdc30f973df259fb390bb4483f77e7f171b9b6e977e5458"
|
||||
"3.47.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2024/sqlite-amalgamation-3470000.zip"
|
||||
sha256: "2842fddbb1cc33f66c7da998a57535f14a6bfee159676a07bb4bf3e59375d93e"
|
||||
"3.46.1":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2024/sqlite-amalgamation-3460100.zip"
|
||||
sha256: "77823cb110929c2bcb0f5d48e4833b5c59a8a6e40cdea3936b99e199dbbe5784"
|
||||
"3.46.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2024/sqlite-amalgamation-3460000.zip"
|
||||
sha256: "712a7d09d2a22652fb06a49af516e051979a3984adb067da86760e60ed51a7f5"
|
||||
"3.45.3":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2024/sqlite-amalgamation-3450300.zip"
|
||||
sha256: "ea170e73e447703e8359308ca2e4366a3ae0c4304a8665896f068c736781c651"
|
||||
"3.45.2":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2024/sqlite-amalgamation-3450200.zip"
|
||||
sha256: "65230414820d43a6d1445d1d98cfe57e8eb9f7ac0d6a96ad6932e0647cce51db"
|
||||
"3.45.1":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2024/sqlite-amalgamation-3450100.zip"
|
||||
sha256: "5592243caf28b2cdef41e6ab58d25d653dfc53deded8450eb66072c929f030c4"
|
||||
"3.45.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2024/sqlite-amalgamation-3450000.zip"
|
||||
sha256: "bde30d13ebdf84926ddd5e8b6df145be03a577a48fd075a087a5dd815bcdf740"
|
||||
"3.44.2":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2023/sqlite-amalgamation-3440200.zip"
|
||||
sha256: "833be89b53b3be8b40a2e3d5fedb635080e3edb204957244f3d6987c2bb2345f"
|
||||
"3.44.1":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2023/sqlite-amalgamation-3440100.zip"
|
||||
sha256: "cc6545b71ca188e245d5d668543c01f61175f0228a0e1b4ced76fabc75ea6b2e"
|
||||
"3.44.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2023/sqlite-amalgamation-3440000.zip"
|
||||
sha256: "93299c8d2c8397622fe00bd807204b1f58815f45bda8097bf93b3bf759a3ebad"
|
||||
"3.43.2":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2023/sqlite-amalgamation-3430200.zip"
|
||||
sha256: "a17ac8792f57266847d57651c5259001d1e4e4b46be96ec0d985c953925b2a1c"
|
||||
"3.43.1":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2023/sqlite-amalgamation-3430100.zip"
|
||||
sha256: "7e634bbd4b2870a83dc7c1e3cc02e4d30b8555cd7db7b332f24e0c447fd0dd16"
|
||||
"3.43.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2023/sqlite-amalgamation-3430000.zip"
|
||||
sha256: "bb5849ae4d7129c09d20596379a0b3f7b1ac59cf9998eba5ef283ea9b6c000a5"
|
||||
"3.42.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2023/sqlite-amalgamation-3420000.zip"
|
||||
sha256: "1cc824d0f5e675829fa37018318fda833ea56f7e9de2b41eddd9f7643b5ec29e"
|
||||
"3.41.2":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2023/sqlite-amalgamation-3410200.zip"
|
||||
sha256: "01df06a84803c1ab4d62c64e995b151b2dbcf5dbc93bbc5eee213cb18225d987"
|
||||
"3.41.1":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2023/sqlite-amalgamation-3410100.zip"
|
||||
sha256: "df0d54bf246521360c8148f64e7e5ad07a4665b4f902339e844f4c493d535ff5"
|
||||
"3.40.1":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2022/sqlite-amalgamation-3400100.zip"
|
||||
sha256: "49112cc7328392aa4e3e5dae0b2f6736d0153430143d21f69327788ff4efe734"
|
||||
"3.40.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2022/sqlite-amalgamation-3400000.zip"
|
||||
sha256: "7c23eb51409315738c930a222cf7cd41518ae5823c41e60a81b93a07070ef22a"
|
||||
"3.39.4":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2022/sqlite-amalgamation-3390400.zip"
|
||||
sha256: "9c99955b21d2374f3a385d67a1f64cbacb1d4130947473d25c77ad609c03b4cd"
|
||||
"3.39.3":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2022/sqlite-amalgamation-3390300.zip"
|
||||
sha256: "a89db3030d229d860ae56a8bac50ac9761434047ae886e47e7c8f9f428fa98ad"
|
||||
"3.39.2":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2022/sqlite-amalgamation-3390200.zip"
|
||||
sha256: "87775784f8b22d0d0f1d7811870d39feaa7896319c7c20b849a4181c5a50609b"
|
||||
"3.39.1":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2022/sqlite-amalgamation-3390100.zip"
|
||||
sha256: "f2ce17bca51b376de4fcb9d0dc174c52f472a34c29aa1ccc774f27467cc63ed7"
|
||||
"3.39.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2022/sqlite-amalgamation-3390000.zip"
|
||||
sha256: "35109dd6e4f062f4d76b48bd7614eec35abae9d2da70351c7ef936876b064b5f"
|
||||
"3.38.5":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2022/sqlite-amalgamation-3380500.zip"
|
||||
sha256: "bebb039b748441e3d25d71d11f7a4a33f5df11f318ec18fa7f343d2083755e2c"
|
||||
"3.37.2":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2022/sqlite-amalgamation-3370200.zip"
|
||||
sha256: "cb25df0fb90b77be6660f6ace641bbea88f3d0441110d394ce418f35f7561bb0"
|
||||
"3.36.0":
|
||||
url: "https://nexus.avroid.tech/repository/all-raw-proxy-sqlite_org/2021/sqlite-amalgamation-3360000.zip"
|
||||
sha256: "999826fe4c871f18919fdb8ed7ec9dd8217180854dd1fe21eea96aed36186729"
|
||||
226
recipes/sqlite3/all/conanfile.py
Normal file
226
recipes/sqlite3/all/conanfile.py
Normal file
@@ -0,0 +1,226 @@
|
||||
from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.apple import is_apple_os
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import get, load, save
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
import textwrap
|
||||
|
||||
required_conan_version = ">=1.53.0"
|
||||
|
||||
|
||||
class Sqlite3Conan(ConanFile):
|
||||
name = "sqlite3"
|
||||
description = "Self-contained, serverless, in-process SQL database engine."
|
||||
license = "Unlicense"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://www.sqlite.org"
|
||||
topics = ("sqlite", "database", "sql", "serverless")
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"threadsafe": [0, 1, 2],
|
||||
"enable_column_metadata": [True, False],
|
||||
"enable_dbstat_vtab": [True, False],
|
||||
"enable_explain_comments": [True, False],
|
||||
"enable_fts3": [True, False],
|
||||
"enable_fts3_parenthesis": [True, False],
|
||||
"enable_fts4": [True, False],
|
||||
"enable_fts5": [True, False],
|
||||
"enable_json1": [True, False],
|
||||
"enable_soundex": [True, False],
|
||||
"enable_preupdate_hook": [True, False],
|
||||
"enable_rtree": [True, False],
|
||||
"use_alloca": [True, False],
|
||||
"use_uri": [True, False],
|
||||
"omit_load_extension": [True, False],
|
||||
"omit_deprecated": [True, False],
|
||||
"enable_math_functions": [True, False],
|
||||
"enable_unlock_notify": [True, False],
|
||||
"enable_default_secure_delete": [True, False],
|
||||
"disable_gethostuuid": [True, False],
|
||||
"max_column": [None, "ANY"],
|
||||
"max_variable_number": [None, "ANY"],
|
||||
"max_blob_size": [None, "ANY"],
|
||||
"build_executable": [True, False],
|
||||
"enable_default_vfs": [True, False],
|
||||
"enable_dbpage_vtab": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"threadsafe": 1,
|
||||
"enable_column_metadata": True,
|
||||
"enable_dbstat_vtab": False,
|
||||
"enable_explain_comments": False,
|
||||
"enable_fts3": False,
|
||||
"enable_fts3_parenthesis": False,
|
||||
"enable_fts4": False,
|
||||
"enable_fts5": False,
|
||||
"enable_json1": False,
|
||||
"enable_soundex": False,
|
||||
"enable_preupdate_hook": False,
|
||||
"enable_rtree": True,
|
||||
"use_alloca": False,
|
||||
"use_uri": False,
|
||||
"omit_load_extension": False,
|
||||
"omit_deprecated": False,
|
||||
"enable_math_functions": True,
|
||||
"enable_unlock_notify": True,
|
||||
"enable_default_secure_delete": False,
|
||||
"disable_gethostuuid": False,
|
||||
"max_column": None, # Uses default value from source
|
||||
"max_variable_number": None, # Uses default value from source
|
||||
"max_blob_size": None, # Uses default value from source
|
||||
"build_executable": True,
|
||||
"enable_default_vfs": True,
|
||||
"enable_dbpage_vtab": False,
|
||||
}
|
||||
|
||||
exports_sources = "CMakeLists.txt"
|
||||
|
||||
@property
|
||||
def _has_enable_math_function_option(self):
|
||||
return Version(self.version) >= "3.35.0"
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
if not self._has_enable_math_function_option:
|
||||
del self.options.enable_math_functions
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
self.settings.rm_safe("compiler.cppstd")
|
||||
self.settings.rm_safe("compiler.libcxx")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def validate(self):
|
||||
if self.options.build_executable:
|
||||
if not self.options.enable_default_vfs:
|
||||
# Need to provide custom VFS code: https://www.sqlite.org/custombuild.html
|
||||
raise ConanInvalidConfiguration("build_executable=True cannot be combined with enable_default_vfs=False")
|
||||
if self.options.omit_load_extension:
|
||||
raise ConanInvalidConfiguration("build_executable=True requires omit_load_extension=True")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["SQLITE3_SRC_DIR"] = self.source_folder.replace("\\", "/")
|
||||
tc.variables["SQLITE3_VERSION"] = self.version
|
||||
tc.variables["SQLITE3_BUILD_EXECUTABLE"] = self.options.build_executable
|
||||
tc.variables["THREADSAFE"] = self.options.threadsafe
|
||||
tc.variables["ENABLE_COLUMN_METADATA"] = self.options.enable_column_metadata
|
||||
tc.variables["ENABLE_DBSTAT_VTAB"] = self.options.enable_dbstat_vtab
|
||||
tc.variables["ENABLE_EXPLAIN_COMMENTS"] = self.options.enable_explain_comments
|
||||
tc.variables["ENABLE_FTS3"] = self.options.enable_fts3
|
||||
tc.variables["ENABLE_FTS3_PARENTHESIS"] = self.options.enable_fts3_parenthesis
|
||||
tc.variables["ENABLE_FTS4"] = self.options.enable_fts4
|
||||
tc.variables["ENABLE_FTS5"] = self.options.enable_fts5
|
||||
tc.variables["ENABLE_JSON1"] = self.options.enable_json1
|
||||
tc.variables["ENABLE_PREUPDATE_HOOK"] = self.options.enable_preupdate_hook
|
||||
tc.variables["ENABLE_SOUNDEX"] = self.options.enable_soundex
|
||||
tc.variables["ENABLE_RTREE"] = self.options.enable_rtree
|
||||
tc.variables["ENABLE_UNLOCK_NOTIFY"] = self.options.enable_unlock_notify
|
||||
tc.variables["ENABLE_DEFAULT_SECURE_DELETE"] = self.options.enable_default_secure_delete
|
||||
tc.variables["USE_ALLOCA"] = self.options.use_alloca
|
||||
tc.variables["USE_URI"] = self.options.use_uri
|
||||
tc.variables["OMIT_LOAD_EXTENSION"] = self.options.omit_load_extension
|
||||
tc.variables["OMIT_DEPRECATED"] = self.options.omit_deprecated
|
||||
if self._has_enable_math_function_option:
|
||||
tc.variables["ENABLE_MATH_FUNCTIONS"] = self.options.enable_math_functions
|
||||
tc.variables["HAVE_FDATASYNC"] = True
|
||||
tc.variables["HAVE_GMTIME_R"] = True
|
||||
tc.variables["HAVE_LOCALTIME_R"] = self.settings.os != "Windows"
|
||||
tc.variables["HAVE_POSIX_FALLOCATE"] = not (self.settings.os in ["Windows", "Android"] or is_apple_os(self))
|
||||
tc.variables["HAVE_STRERROR_R"] = True
|
||||
tc.variables["HAVE_USLEEP"] = True
|
||||
tc.variables["DISABLE_GETHOSTUUID"] = self.options.disable_gethostuuid
|
||||
if self.options.max_column:
|
||||
tc.variables["MAX_COLUMN"] = self.options.max_column
|
||||
if self.options.max_variable_number:
|
||||
tc.variables["MAX_VARIABLE_NUMBER"] = self.options.max_variable_number
|
||||
if self.options.max_blob_size:
|
||||
tc.variables["MAX_BLOB_SIZE"] = self.options.max_blob_size
|
||||
tc.variables["DISABLE_DEFAULT_VFS"] = not self.options.enable_default_vfs
|
||||
tc.variables["ENABLE_DBPAGE_VTAB"] = self.options.enable_dbpage_vtab
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir))
|
||||
cmake.build()
|
||||
|
||||
def _extract_license(self):
|
||||
header = load(self, os.path.join(self.source_folder, "sqlite3.h"))
|
||||
license_content = header[3:header.find("***", 1)]
|
||||
return license_content
|
||||
|
||||
def package(self):
|
||||
save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license())
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
|
||||
# TODO: to remove in conan v2 once cmake_find_package_* generators removed
|
||||
# Indeed CMakeDeps uses 'cmake_file_name' property to qualify CMake variables
|
||||
self._create_cmake_module_variables(
|
||||
os.path.join(self.package_folder, self._module_file_rel_path)
|
||||
)
|
||||
|
||||
def _create_cmake_module_variables(self, module_file):
|
||||
content = textwrap.dedent("""\
|
||||
if(DEFINED SQLite_INCLUDE_DIRS)
|
||||
set(SQLite3_INCLUDE_DIRS ${SQLite_INCLUDE_DIRS})
|
||||
endif()
|
||||
if(DEFINED SQLite_LIBRARIES)
|
||||
set(SQLite3_LIBRARIES ${SQLite_LIBRARIES})
|
||||
endif()
|
||||
""")
|
||||
save(self, module_file, content)
|
||||
|
||||
@property
|
||||
def _module_file_rel_path(self):
|
||||
return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake")
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_find_mode", "both")
|
||||
self.cpp_info.set_property("cmake_file_name", "SQLite3")
|
||||
self.cpp_info.set_property("cmake_target_name", "SQLite::SQLite3")
|
||||
self.cpp_info.set_property("pkg_config_name", "sqlite3")
|
||||
|
||||
# TODO: back to global scope in conan v2 once cmake_find_package_* generators removed
|
||||
self.cpp_info.components["sqlite"].libs = ["sqlite3"]
|
||||
if self.options.omit_load_extension:
|
||||
self.cpp_info.components["sqlite"].defines.append("SQLITE_OMIT_LOAD_EXTENSION")
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
if self.options.threadsafe:
|
||||
self.cpp_info.components["sqlite"].system_libs.append("pthread")
|
||||
if not self.options.omit_load_extension:
|
||||
self.cpp_info.components["sqlite"].system_libs.append("dl")
|
||||
if self.options.enable_fts5 or self.options.get_safe("enable_math_functions"):
|
||||
self.cpp_info.components["sqlite"].system_libs.append("m")
|
||||
elif self.settings.os == "Windows":
|
||||
if self.options.shared:
|
||||
self.cpp_info.components["sqlite"].defines.append("SQLITE_API=__declspec(dllimport)")
|
||||
|
||||
# TODO: to remove in conan v2 once cmake_find_package_* generators removed
|
||||
self.cpp_info.filenames["cmake_find_package"] = "SQLite3"
|
||||
self.cpp_info.filenames["cmake_find_package_multi"] = "SQLite3"
|
||||
self.cpp_info.names["cmake_find_package"] = "SQLite"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "SQLite"
|
||||
self.cpp_info.components["sqlite"].names["cmake_find_package"] = "SQLite3"
|
||||
self.cpp_info.components["sqlite"].names["cmake_find_package_multi"] = "SQLite3"
|
||||
self.cpp_info.components["sqlite"].build_modules["cmake_find_package"] = [self._module_file_rel_path]
|
||||
self.cpp_info.components["sqlite"].build_modules["cmake_find_package"] = [self._module_file_rel_path]
|
||||
self.cpp_info.components["sqlite"].set_property("cmake_target_name", "SQLite::SQLite3")
|
||||
self.cpp_info.components["sqlite"].set_property("pkg_config_name", "sqlite3")
|
||||
if self.options.build_executable:
|
||||
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
|
||||
14
recipes/sqlite3/all/test_package/CMakeLists.txt
Normal file
14
recipes/sqlite3/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
option(USE_EMPTY_VFS "Using empty SQLite OS interface")
|
||||
|
||||
find_package(SQLite3 REQUIRED)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE SQLite::SQLite3)
|
||||
|
||||
if(USE_EMPTY_VFS)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_EMPTY_VFS)
|
||||
target_sources(${PROJECT_NAME} PRIVATE empty_vfs.c)
|
||||
endif()
|
||||
26
recipes/sqlite3/all/test_package/conanfile.py
Normal file
26
recipes/sqlite3/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
90
recipes/sqlite3/all/test_package/empty_vfs.c
Normal file
90
recipes/sqlite3/all/test_package/empty_vfs.c
Normal file
@@ -0,0 +1,90 @@
|
||||
#include <sqlite3.h>
|
||||
#include <stddef.h>
|
||||
|
||||
int empty_xOpen(sqlite3_vfs *vfs, const char *zName, sqlite3_file *f, int flags, int *pOutFlags)
|
||||
{
|
||||
// TODO: implement
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
int empty_xDelete(sqlite3_vfs *vfs, const char *zName, int syncDir)
|
||||
{
|
||||
// TODO: implement
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
int empty_xAccess(sqlite3_vfs *vfs, const char *zName, int flags, int *pResOut)
|
||||
{
|
||||
// TODO: implement
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
int empty_xFullPathname(sqlite3_vfs *vfs, const char *zName, int nOut, char *zOut)
|
||||
{
|
||||
// TODO: implement
|
||||
return SQLITE_OK;
|
||||
}
|
||||
int empty_xRandomness(sqlite3_vfs *vfs, int nByte, char *zOut)
|
||||
{
|
||||
// TODO: implement
|
||||
return SQLITE_OK;
|
||||
}
|
||||
int empty_xSleep(sqlite3_vfs *vfs, int microseconds)
|
||||
{
|
||||
// TODO: implement
|
||||
return SQLITE_OK;
|
||||
}
|
||||
int empty_xCurrentTime(sqlite3_vfs *vfs, double *t)
|
||||
{
|
||||
// TODO: implement
|
||||
return SQLITE_OK;
|
||||
}
|
||||
int empty_xGetLastError(sqlite3_vfs *vfs, int code, char *name)
|
||||
{
|
||||
// TODO: implement
|
||||
return SQLITE_OK;
|
||||
}
|
||||
int empty_xCurrentTimeInt64(sqlite3_vfs *vfs, sqlite3_int64 *t)
|
||||
{
|
||||
// TODO: implement
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
// empty VFS will be provided
|
||||
int sqlite3_os_init(void)
|
||||
{
|
||||
static sqlite3_vfs emptyVFS =
|
||||
{
|
||||
2, /* iVersion */
|
||||
0, /* szOsFile */
|
||||
100, /* mxPathname */
|
||||
NULL, /* pNext */
|
||||
"empty", /* zName */
|
||||
NULL, /* pAppData */
|
||||
empty_xOpen, /* xOpen */
|
||||
empty_xDelete, /* xDelete */
|
||||
empty_xAccess, /* xAccess */
|
||||
empty_xFullPathname, /* xFullPathname */
|
||||
NULL, /* xDlOpen */
|
||||
NULL, /* xDlError */
|
||||
NULL, /* xDlSym */
|
||||
NULL, /* xDlClose */
|
||||
empty_xRandomness, /* xRandomness */
|
||||
empty_xSleep, /* xSleep */
|
||||
empty_xCurrentTime, /* xCurrentTime */
|
||||
empty_xGetLastError, /* xGetLastError */
|
||||
empty_xCurrentTimeInt64, /* xCurrentTimeInt64 */
|
||||
NULL, /* xSetSystemCall */
|
||||
NULL, /* xGetSystemCall */
|
||||
NULL, /* xNextSystemCall */
|
||||
};
|
||||
|
||||
sqlite3_vfs_register(&emptyVFS, 1);
|
||||
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
int sqlite3_os_end(void)
|
||||
{
|
||||
return SQLITE_OK;
|
||||
}
|
||||
46
recipes/sqlite3/all/test_package/test_package.c
Normal file
46
recipes/sqlite3/all/test_package/test_package.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sqlite3.h>
|
||||
|
||||
#ifdef USE_EMPTY_VFS
|
||||
#define DB_NAME ":memory:"
|
||||
#else
|
||||
#define DB_NAME "bincrafters.db"
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
sqlite3* db_instance = NULL;
|
||||
char* errmsg = NULL;
|
||||
int result = 0;
|
||||
|
||||
printf("SQLite Version: %s\n", sqlite3_libversion());
|
||||
|
||||
printf("Creating new data base ...\n");
|
||||
result = sqlite3_open(DB_NAME, &db_instance);
|
||||
if (result != SQLITE_OK) {
|
||||
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db_instance));
|
||||
sqlite3_close(db_instance);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("Done!\n");
|
||||
|
||||
printf("Creating new table...\n");
|
||||
result = sqlite3_exec(db_instance, "CREATE TABLE IF NOT EXISTS package(ID INT PRIMARY KEY NOT NULL);", NULL, 0, &errmsg);
|
||||
if(result != SQLITE_OK) {
|
||||
fprintf(stderr, "SQL error: %s\n", errmsg);
|
||||
sqlite3_free(errmsg);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("Done!\n");
|
||||
|
||||
printf("Closing connection ...\n");
|
||||
sqlite3_close(db_instance);
|
||||
if(result != SQLITE_OK) {
|
||||
fprintf(stderr, "Connection error: %s\n", errmsg);
|
||||
sqlite3_free(errmsg);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf("Done!\n");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
8
recipes/sqlite3/all/test_v1_package/CMakeLists.txt
Normal file
8
recipes/sqlite3/all/test_v1_package/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package)
|
||||
18
recipes/sqlite3/all/test_v1_package/conanfile.py
Normal file
18
recipes/sqlite3/all/test_v1_package/conanfile.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from conans import ConanFile, CMake, tools
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "cmake", "cmake_find_package"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.definitions["USE_EMPTY_VFS"] = not self.options["sqlite3"].enable_default_vfs
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not tools.cross_building(self):
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run(bin_path, run_environment=True)
|
||||
55
recipes/sqlite3/config.yml
Normal file
55
recipes/sqlite3/config.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
versions:
|
||||
"3.47.1":
|
||||
folder: all
|
||||
"3.47.0":
|
||||
folder: all
|
||||
"3.46.1":
|
||||
folder: all
|
||||
"3.46.0":
|
||||
folder: all
|
||||
"3.45.3":
|
||||
folder: all
|
||||
"3.45.2":
|
||||
folder: all
|
||||
"3.45.1":
|
||||
folder: all
|
||||
"3.45.0":
|
||||
folder: all
|
||||
"3.44.2":
|
||||
folder: all
|
||||
"3.44.1":
|
||||
folder: all
|
||||
"3.44.0":
|
||||
folder: all
|
||||
"3.43.2":
|
||||
folder: all
|
||||
"3.43.1":
|
||||
folder: all
|
||||
"3.43.0":
|
||||
folder: all
|
||||
"3.42.0":
|
||||
folder: all
|
||||
"3.41.2":
|
||||
folder: all
|
||||
"3.41.1":
|
||||
folder: all
|
||||
"3.40.1":
|
||||
folder: all
|
||||
"3.40.0":
|
||||
folder: all
|
||||
"3.39.4":
|
||||
folder: all
|
||||
"3.39.3":
|
||||
folder: all
|
||||
"3.39.2":
|
||||
folder: all
|
||||
"3.39.1":
|
||||
folder: all
|
||||
"3.39.0":
|
||||
folder: all
|
||||
"3.38.5":
|
||||
folder: all
|
||||
"3.37.2":
|
||||
folder: all
|
||||
"3.36.0":
|
||||
folder: all
|
||||
Reference in New Issue
Block a user