Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ if (USE_SQLCIPHER)
include_directories(../cpp/sqlcipher)
endif()

if (USE_LIBSQL)
if (USE_LIBSQL)
include_directories(src/main/jniLibs/include)
endif()

separate_arguments(SQLITE_FLAGS_LIST UNIX_COMMAND "${SQLITE_FLAGS}")

add_definitions(
${SQLITE_FLAGS}
${SQLITE_FLAGS_LIST}
)

add_library(
Expand All @@ -42,11 +44,11 @@ if (USE_SQLCIPHER)
-DSQLITE_EXTRA_INIT=sqlcipher_extra_init
-DSQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown
)

find_package(openssl REQUIRED CONFIG)
elseif (USE_LIBSQL)
target_sources(${PACKAGE_NAME} PRIVATE ../cpp/libsql/bridge.cpp)

add_definitions(
-DOP_SQLITE_USE_LIBSQL=1
)
Expand Down Expand Up @@ -89,7 +91,7 @@ if (USE_SQLCIPHER)
elseif (USE_LIBSQL)
cmake_path(SET LIBSQL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libsql_experimental.so NORMALIZE)
add_library(libsql_experimental SHARED IMPORTED)
set_target_properties(libsql_experimental PROPERTIES
set_target_properties(libsql_experimental PROPERTIES
IMPORTED_LOCATION ${LIBSQL_PATH}
IMPORTED_NO_SONAME TRUE
)
Expand All @@ -110,4 +112,4 @@ else ()
ReactAndroid::jsi
fbjni::fbjni
)
endif()
endif()
8 changes: 5 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (isUserApp) {
// Start from the root + 1 level up (to avoid detecting the op-sqlite/package.json) and traverse upwards to find the first package.json
File currentDir = new File("$rootDir/../")
packageJsonFile = null

// Try to find package.json by traversing upwards
while (currentDir != null) {
File potential = new File(currentDir, "package.json")
Expand All @@ -70,6 +70,7 @@ if(opsqliteConfig) {
useSQLCipher = opsqliteConfig["sqlcipher"]
useCRSQLite = opsqliteConfig["crsqlite"]
useSqliteVec = opsqliteConfig["sqliteVec"]

performanceMode = opsqliteConfig["performanceMode"]
sqliteFlags = opsqliteConfig["sqliteFlags"] ? opsqliteConfig["sqliteFlags"] : ""
enableFTS5 = opsqliteConfig["fts5"]
Expand All @@ -82,7 +83,7 @@ if(useSQLCipher) {
println "[OP-SQLITE] using sqlcipher."
} else if(useLibsql) {
println "[OP-SQLITE] using libsql. Report any issues to Turso"
}
}

if(useCRSQLite) {
println "[OP-SQLITE] using CR-SQLite"
Expand All @@ -108,7 +109,7 @@ if(!tokenizers.isEmpty()) {
if(useLibsql) {
throw new GradleException("[OP-SQLITE] Error: libsql does not support tokenizers. Please disable tokenizers or do not enable libsql.")
}

println "[OP-SQLITE] Tokenizers enabled. Detected tokenizers: " + tokenizers
}

Expand Down Expand Up @@ -168,6 +169,7 @@ android {
}

cppFlags "-O3 -frtti -fexceptions -Wall -fstack-protector-all"

arguments "-DANDROID_STL=c++_shared",
"-DSQLITE_FLAGS='$sqliteFlags'",
"-DUSE_SQLCIPHER=${useSQLCipher ? 1 : 0}",
Expand Down
Loading