diff --git a/Package.swift b/Package.swift index cf7e3e7..d301e82 100644 --- a/Package.swift +++ b/Package.swift @@ -1,5 +1,11 @@ // swift-tools-version: 6.0 import PackageDescription +import Foundation + +var toolchainCSettings: [CSetting] = [] +if ProcessInfo.processInfo.environment["SQLITE_ENABLE_FTS5"] == "1" { + toolchainCSettings.append(.define("SQLITE_ENABLE_FTS5")) +} let package = Package( name: "swift-toolchain-sqlite", @@ -37,6 +43,7 @@ let package = Package( name: "SwiftToolchainCSQLite", path: "Sources/CSQLite", publicHeadersPath: "include", + cSettings: toolchainCSettings, linkerSettings: [ // Needed for swift_addNewDSOImage .linkedLibrary("swiftCore", .when(platforms: [.windows, .wasi])) diff --git a/README.md b/README.md index 82ac56f..e7ac5cf 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ It is not intended as a general-purpose SQLite package, nor does it aim to provi This build of this package has been validated for macOS, iOS, tvOS, watchOS, visionOS, Mac Catalyst, Linux, Android, Windows, WebAssembly, and FreeBSD. On most platforms, the Swift toolchain uses a copy of SQLite provided by the platform SDK or package manager instead of this package. +### Compile-time Options + +Set the following environment variables to enable the corresponding compile-time options. + +- `SQLITE_ENABLE_FTS5=1` to enable [FTS5](https://www.sqlite.org/fts5.html) Contributing to /swift-toolchain-sqlite -------------