Skip to content

Commit ef3f88f

Browse files
committed
Fix building with standalone sqlite3 >= 3.30.0
SQLite 3.30.0 changed the definition of SQLITE_DETERMINISTIC: `-#define SQLITE_DETERMINISTIC 0x800` `+#define SQLITE_DETERMINISTIC 0x000000800` Meaning that the (older) system sqlite3 library and the pod have different definitions, even though they're the same value. We've been importing the system sqlite3 module in SQLiteObjc.h even when linking against standalone sqlite. I added a check to SQLiteObjc.h to import the sqlite3 pod when we're using it, instead of always importing the system module. This leads to there being only one definition in scope.
1 parent 0a9893e commit ef3f88f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

SQLite.swift.podspec

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ Pod::Spec.new do |s|
5050
ss.private_header_files = 'Sources/SQLiteObjc/*.h'
5151

5252
ss.xcconfig = {
53-
'OTHER_SWIFT_FLAGS' => '$(inherited) -DSQLITE_SWIFT_STANDALONE'
53+
'OTHER_SWIFT_FLAGS' => '$(inherited) -DSQLITE_SWIFT_STANDALONE',
54+
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SQLITE_SWIFT_STANDALONE=1'
5455
}
5556
ss.dependency 'sqlite3'
5657

Sources/SQLiteObjc/include/SQLiteObjc.h

+4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
//
2424

2525
@import Foundation;
26+
#if defined(SQLITE_SWIFT_STANDALONE)
27+
@import sqlite3;
28+
#else
2629
@import SQLite3;
30+
#endif
2731

2832
NS_ASSUME_NONNULL_BEGIN
2933
typedef NSString * _Nullable (^_SQLiteTokenizerNextCallback)(const char *input, int *inputOffset, int *inputLength);

0 commit comments

Comments
 (0)