-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6187 from realm/tg/spm
Add a SwiftPM package
- Loading branch information
Showing
116 changed files
with
1,389 additions
and
798 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#include "Tests.xcconfig" | ||
|
||
CONFIGURATION_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static; | ||
CONFIGURATION_TEMP_DIR = $(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static; | ||
IPHONEOS_DEPLOYMENT_TARGET = 8.0; | ||
|
||
TEST_HOST[sdk=iphone*] = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/TestHost.app/TestHost; | ||
TEST_HOST[sdk=iphone*] = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static/TestHost static.app/TestHost static; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "TestHost.xcconfig" | ||
|
||
CONFIGURATION_BUILD_DIR = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static; | ||
CONFIGURATION_TEMP_DIR = $(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)-static; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
// swift-tools-version:5.0 | ||
|
||
import PackageDescription | ||
import Foundation | ||
|
||
let coreVersionStr = "5.20.0" | ||
let cocoaVersionStr = "3.16.2" | ||
|
||
let coreVersionPieces = coreVersionStr.split(separator: ".") | ||
let cxxSettings: [CXXSetting] = [ | ||
.headerSearchPath("."), | ||
.headerSearchPath("include"), | ||
.headerSearchPath("Realm/ObjectStore/src"), | ||
.define("REALM_SPM", to: "1"), | ||
.define("REALM_COCOA_VERSION", to: "@\"\(cocoaVersionStr)\""), | ||
.define("REALM_VERSION", to: "\"\(coreVersionStr)\""), | ||
|
||
.define("REALM_NO_CONFIG"), | ||
.define("REALM_INSTALL_LIBEXECDIR", to: ""), | ||
.define("REALM_ENABLE_ASSERTIONS", to: "1"), | ||
.define("REALM_ENABLE_ENCRYPTION", to: "1"), | ||
|
||
.define("REALM_VERSION_MAJOR", to: String(coreVersionPieces[0])), | ||
.define("REALM_VERSION_MINOR", to: String(coreVersionPieces[1])), | ||
.define("REALM_VERSION_PATCH", to: String(coreVersionPieces[2])), | ||
.define("REALM_VERSION_EXTRA", to: "\"\""), | ||
.define("REALM_VERSION_STRING", to: "\"\(coreVersionStr)\""), | ||
] | ||
|
||
let package = Package( | ||
name: "Realm", | ||
products: [ | ||
.library( | ||
name: "Realm", | ||
targets: ["Realm"]), | ||
.library( | ||
name: "RealmSwift", | ||
targets: ["Realm", "RealmSwift"]), | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/realm/realm-core", .branch("master")), | ||
], | ||
targets: [ | ||
.target( | ||
name: "Realm", | ||
dependencies: ["RealmCore"], | ||
path: ".", | ||
exclude: [ | ||
"Realm/NSError+RLMSync.m", | ||
"Realm/RLMJSONModels.m", | ||
"Realm/RLMNetworkClient.mm", | ||
"Realm/RLMRealm+Sync.mm", | ||
"Realm/RLMRealmConfiguration+Sync.mm", | ||
"Realm/RLMSyncConfiguration.mm", | ||
"Realm/RLMSyncCredentials.m", | ||
"Realm/RLMSyncManager.mm", | ||
"Realm/RLMSyncPermission.mm", | ||
"Realm/RLMSyncPermissionResults.mm", | ||
"Realm/RLMSyncSession.mm", | ||
"Realm/RLMSyncSessionRefreshHandle.mm", | ||
"Realm/RLMSyncSubscription.mm", | ||
"Realm/RLMSyncUser.mm", | ||
"Realm/RLMSyncUtil.mm", | ||
|
||
"Realm/ObjectServerTests", | ||
"Realm/Swift", | ||
"Realm/Tests", | ||
"Realm/TestUtils", | ||
"Realm/ObjectStore/external", | ||
"Realm/ObjectStore/tests", | ||
"Realm/ObjectStore/src/server", | ||
"Realm/ObjectStore/src/sync", | ||
"Realm/ObjectStore/src/impl/generic", | ||
"Realm/ObjectStore/src/impl/epoll", | ||
"Realm/ObjectStore/src/impl/android", | ||
"Realm/ObjectStore/src/impl/windows", | ||
], | ||
sources: ["Realm"], | ||
publicHeadersPath: "include", | ||
cxxSettings: cxxSettings | ||
), | ||
.target( | ||
name: "RealmSwift", | ||
dependencies: ["Realm"], | ||
path: "RealmSwift", | ||
exclude: [ | ||
"Sync.swift", | ||
"ObjectiveCSupport+Sync.swift", | ||
"Tests", | ||
] | ||
), | ||
.target( | ||
name: "RealmTestSupport", | ||
dependencies: ["Realm"], | ||
path: "Realm/TestUtils", | ||
cxxSettings: cxxSettings + [ | ||
// Command-line `swift build` resolves header search paths | ||
// relative to the package root, while Xcode resolves them | ||
// relative to the target root, so we need both. | ||
.headerSearchPath("Realm"), | ||
.headerSearchPath(".."), | ||
] | ||
), | ||
.testTarget( | ||
name: "RealmTests", | ||
dependencies: ["Realm", "RealmTestSupport"], | ||
path: "Realm/Tests", | ||
exclude: [ | ||
"Swift", | ||
"TestHost", | ||
"PrimitiveArrayPropertyTests.tpl.m", | ||
], | ||
cxxSettings: cxxSettings + [ | ||
.headerSearchPath("Realm"), | ||
.headerSearchPath(".."), | ||
.headerSearchPath("../ObjectStore/src"), | ||
] | ||
), | ||
.testTarget( | ||
name: "RealmObjcSwiftTests", | ||
dependencies: ["Realm", "RealmTestSupport"], | ||
path: "Realm/Tests/Swift" | ||
), | ||
.testTarget( | ||
name: "RealmSwiftTests", | ||
dependencies: ["RealmSwift", "RealmTestSupport"], | ||
path: "RealmSwift/Tests", | ||
exclude: ["TestUtils.mm"] | ||
) | ||
], | ||
cxxLanguageStandard: .cxx14 | ||
) |
Oops, something went wrong.