Skip to content
Closed
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
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.
  • Loading branch information
bmwalters committed Nov 15, 2019
commit ef3f88f7d02116c95088d7c5dae9a0af42f4dbfc
3 changes: 2 additions & 1 deletion SQLite.swift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Pod::Spec.new do |s|
ss.private_header_files = 'Sources/SQLiteObjc/*.h'

ss.xcconfig = {
'OTHER_SWIFT_FLAGS' => '$(inherited) -DSQLITE_SWIFT_STANDALONE'
'OTHER_SWIFT_FLAGS' => '$(inherited) -DSQLITE_SWIFT_STANDALONE',
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SQLITE_SWIFT_STANDALONE=1'
}
ss.dependency 'sqlite3'

Expand Down
4 changes: 4 additions & 0 deletions Sources/SQLiteObjc/include/SQLiteObjc.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
//

@import Foundation;
#if defined(SQLITE_SWIFT_STANDALONE)
@import sqlite3;
#else
@import SQLite3;
#endif

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