Skip to content

Commit

Permalink
Split into standard / standalone subspecs
Browse files Browse the repository at this point in the history
The standard subspec is the default and behaves
as previously; the standalone subspec adds a
dependency to the sqlite3 pod which downloads and
compiles a version of SQLite instead of using the
system-supplied version.

The version of SQLite used can be further customized
by requiring another sqlite3 subspec from the main
Podfile.
  • Loading branch information
jberkel committed May 12, 2016
1 parent d93f37b commit 0eeedfe
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 14 deletions.
39 changes: 25 additions & 14 deletions SQLite.swift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,30 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = "9.0"
s.osx.deployment_target = "10.9"
s.watchos.deployment_target = "2.0"
s.default_subspec = 'standard'

s.preserve_paths = 'CocoaPods/**/*'
s.pod_target_xcconfig = {
'SWIFT_INCLUDE_PATHS[sdk=macosx*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/macosx',
'SWIFT_INCLUDE_PATHS[sdk=iphoneos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/iphoneos',
'SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/iphonesimulator',
'SWIFT_INCLUDE_PATHS[sdk=appletvos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/appletvos',
'SWIFT_INCLUDE_PATHS[sdk=appletvsimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/appletvsimulator',
'SWIFT_INCLUDE_PATHS[sdk=watchos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/watchos',
'SWIFT_INCLUDE_PATHS[sdk=watchsimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/watchsimulator'
}

s.libraries = 'sqlite3'
s.source_files = 'SQLite/**/*.{c,h,m,swift}'
s.private_header_files = 'SQLite/Core/fts3_tokenizer.h'
s.subspec 'standard' do |ss|
ss.source_files = 'SQLite/**/*.{c,h,m,swift}'
ss.private_header_files = 'SQLite/Core/fts3_tokenizer.h'

ss.library = 'sqlite3'
ss.preserve_paths = 'CocoaPods/**/*'
ss.pod_target_xcconfig = {
'SWIFT_INCLUDE_PATHS[sdk=macosx*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/macosx',
'SWIFT_INCLUDE_PATHS[sdk=iphoneos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/iphoneos',
'SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/iphonesimulator',
'SWIFT_INCLUDE_PATHS[sdk=appletvos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/appletvos',
'SWIFT_INCLUDE_PATHS[sdk=appletvsimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/appletvsimulator',
'SWIFT_INCLUDE_PATHS[sdk=watchos*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/watchos',
'SWIFT_INCLUDE_PATHS[sdk=watchsimulator*]' => '$(SRCROOT)/SQLite.swift/CocoaPods/watchsimulator'
}
end

s.subspec 'standalone' do |ss|
ss.source_files = 'SQLite/**/*.{c,h,m,swift}'
ss.private_header_files = 'SQLite/Core/fts3_tokenizer.h'
ss.xcconfig = { 'OTHER_SWIFT_FLAGS' => '$(inherited) -DSQLITE_SWIFT_STANDALONE' }

ss.dependency 'sqlite3'
end
end
4 changes: 4 additions & 0 deletions SQLite/Core/Connection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
//

import Dispatch
#if SQLITE_SWIFT_STANDALONE
import sqlite3
#else
import CSQLite
#endif

/// A connection to SQLite.
public final class Connection {
Expand Down
4 changes: 4 additions & 0 deletions SQLite/Core/Statement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
// THE SOFTWARE.
//

#if SQLITE_SWIFT_STANDALONE
import sqlite3
#else
import CSQLite
#endif

/// A single SQL statement.
public final class Statement {
Expand Down
4 changes: 4 additions & 0 deletions SQLite/Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
// THE SOFTWARE.
//

#if SQLITE_SWIFT_STANDALONE
import sqlite3
#else
import CSQLite
#endif

public typealias Star = (Expression<Binding>?, Expression<Binding>?) -> Expression<Void>

Expand Down

0 comments on commit 0eeedfe

Please sign in to comment.