Skip to content

Commit

Permalink
Fixes sqlcipher compilation on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ospfranco committed Mar 16, 2024
1 parent 9018a70 commit eed623e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
22 changes: 11 additions & 11 deletions example/ios/OPSQLiteExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
objects = {

/* Begin PBXBuildFile section */
022AA638EE144393ADDCAEC0 /* sample.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = 96FD9FD0FC4F4540AC7A9CE6 /* sample.sqlite */; };
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
3B5A9E3FD2C56B364AF5A4F3 /* libPods-OPSQLiteExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EE3066EB7AAB7E17B1CAB50 /* libPods-OPSQLiteExample.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
022AA638EE144393ADDCAEC0 /* sample.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = 96FD9FD0FC4F4540AC7A9CE6 /* sample.sqlite */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -29,8 +29,8 @@
6EE3066EB7AAB7E17B1CAB50 /* libPods-OPSQLiteExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-OPSQLiteExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = OPSQLiteExample/LaunchScreen.storyboard; sourceTree = "<group>"; };
89C6BE57DB24E9ADA2F236DE /* Pods-OPSQLiteExample-OPSQLiteExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OPSQLiteExample-OPSQLiteExampleTests.release.xcconfig"; path = "Target Support Files/Pods-OPSQLiteExample-OPSQLiteExampleTests/Pods-OPSQLiteExample-OPSQLiteExampleTests.release.xcconfig"; sourceTree = "<group>"; };
96FD9FD0FC4F4540AC7A9CE6 /* sample.sqlite */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = sample.sqlite; path = ../assets/sample.sqlite; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
96FD9FD0FC4F4540AC7A9CE6 /* sample.sqlite */ = {isa = PBXFileReference; name = "sample.sqlite"; path = "../assets/sample.sqlite"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -98,6 +98,15 @@
name = Products;
sourceTree = "<group>";
};
A9BA4AF2CBC44B9BB28B8ABA /* Resources */ = {
isa = PBXGroup;
children = (
96FD9FD0FC4F4540AC7A9CE6 /* sample.sqlite */,
);
name = Resources;
path = "";
sourceTree = "<group>";
};
BBD78D7AC51CEA395F1C20DB /* Pods */ = {
isa = PBXGroup;
children = (
Expand All @@ -109,15 +118,6 @@
path = Pods;
sourceTree = "<group>";
};
A9BA4AF2CBC44B9BB28B8ABA /* Resources */ = {
isa = "PBXGroup";
children = (
96FD9FD0FC4F4540AC7A9CE6 /* sample.sqlite */,
);
name = Resources;
sourceTree = "<group>";
path = "";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down
2 changes: 1 addition & 1 deletion example/ios/OPSQLiteExample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string/>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
10 changes: 7 additions & 3 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ PODS:
- hermes-engine/Pre-built (= 0.73.1)
- hermes-engine/Pre-built (0.73.1)
- libevent (2.1.12)
- op-sqlite (3.0.1):
- op-sqlite (3.0.3):
- OpenSSL-Universal
- React
- React-callinvoker
- React-Core
- OpenSSL-Universal (1.1.2200)
- RCT-Folly (2022.05.16.00):
- boost
- DoubleConversion
Expand Down Expand Up @@ -1124,6 +1126,7 @@ SPEC REPOS:
trunk:
- fmt
- libevent
- OpenSSL-Universal
- SocketRocket

EXTERNAL SOURCES:
Expand Down Expand Up @@ -1240,7 +1243,8 @@ SPEC CHECKSUMS:
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
hermes-engine: 34df9d5034e90bd9bf1505e1ca198760373935af
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
op-sqlite: 24443c22e059972abf4109b4e781d3f03336a761
op-sqlite: 0863e28c8cb854b0efff62b6e04f99a9e102229c
OpenSSL-Universal: 6e1ae0555546e604dbc632a2b9a24a9c46c41ef6
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
RCTRequired: 6dda55e483f75d2b43781d8ad5bd7df276a50981
RCTTypeSafety: df0f2632f4e89938b9b9f6152b5e6c66fc6e969e
Expand Down Expand Up @@ -1289,4 +1293,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 0ab74fecad6ac2e35f8eab32fe5772c19d2015b2

COCOAPODS: 1.14.3
COCOAPODS: 1.15.2
2 changes: 1 addition & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function App() {
};

const copyDbPathToClipboad = async () => {
const db = await open({name: 'dbPath.sqlite'});
const db = await open({name: 'dbPath.sqlite', encryptionKey: 'test'});
db.execute(
'CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY AUTOINCREMENT)',
);
Expand Down
5 changes: 2 additions & 3 deletions op-sqlite.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Pod::Spec.new do |s|
if ENV['OP_SQLITE_USE_SQLCIPHER'] == '1' then
puts "OP-SQLITE using SQLCipher! 🔒\n"
s.exclude_files = "cpp/sqlite3.c", "cpp/sqlite3.h"
xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_SQLCIPHER=1"
xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_SQLCIPHER=1 HAVE_FULLFSYNC=1 SQLITE_HAS_CODEC SQLITE_TEMP_STORE=2"
s.dependency "OpenSSL-Universal"
else
puts "OP-SQLITE using SQLite! 📦\n"
s.exclude_files = "cpp/sqlcipher/sqlite3.c", "cpp/sqlcipher/sqlite3.h"
Expand All @@ -46,8 +47,6 @@ Pod::Spec.new do |s|

optimizedCflags = other_cflags + '$(inherited) -DSQLITE_DQS=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS=1 -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_OMIT_DEPRECATED=1 -DSQLITE_OMIT_PROGRESS_CALLBACK=1 -DSQLITE_OMIT_SHARED_CACHE=1 -DSQLITE_USE_ALLOCA=1'



if ENV['OP_SQLITE_USE_PHONE_VERSION'] == '1' then
puts "OP-SQLITE using iOS embedded SQLite! 📱\n"
xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_PHONE_VERSION=1"
Expand Down

0 comments on commit eed623e

Please sign in to comment.