Skip to content

Commit

Permalink
Add xcframework support
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpablo committed Jan 18, 2024
1 parent 315e45d commit f6e3d1c
Show file tree
Hide file tree
Showing 15 changed files with 173 additions and 441 deletions.
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
[submodule "rocksdb"]
path = rocksdb
url = https://github.com/facebook/rocksdb.git
[submodule "lz4"]
path = lz4
url = [email protected]:lz4/lz4.git
92 changes: 92 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/ObjectiveRocks.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ObjectiveRocks"
BuildableName = "ObjectiveRocks"
BlueprintName = "ObjectiveRocks"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ObjectiveRocksTests"
BuildableName = "ObjectiveRocksTests"
BlueprintName = "ObjectiveRocksTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ObjectiveRocksTests"
BuildableName = "ObjectiveRocksTests"
BlueprintName = "ObjectiveRocksTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ObjectiveRocks"
BuildableName = "ObjectiveRocks"
BlueprintName = "ObjectiveRocks"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
4 changes: 2 additions & 2 deletions Code/RocksDBBackupEngine.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#import "RocksDBBackupInfo.h"

#include <rocksdb/db.h>
#include <rocksdb/utilities/backupable_db.h>
#include <rocksdb/utilities/backup_engine.h>

#pragma mark - Informal Protocols

Expand Down Expand Up @@ -45,7 +45,7 @@ - (instancetype)initWithPath:(NSString *)path
if (self) {
_path = [path copy];
rocksdb::Status status = rocksdb::BackupEngine::Open(rocksdb::Env::Default(),
rocksdb::BackupableDBOptions(_path.UTF8String),
rocksdb::BackupEngineOptions(_path.UTF8String),
&_backupEngine);
if (!status.ok()) {
NSLog(@"Error opening database backup: %@", [RocksDBError errorWithRocksStatus:status]);
Expand Down
4 changes: 2 additions & 2 deletions Code/RocksDBComparator.mm
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ + (instancetype)comaparatorWithType:(RocksDBComparatorType)type
return [[self alloc] initWithName:@"objectiverocks.string.compare.asc" andBlock:^int(NSData *key1, NSData *key2) {
NSString *str1 = [[NSString alloc] initWithData:key1 encoding:NSUTF8StringEncoding];
NSString *str2 = [[NSString alloc] initWithData:key2 encoding:NSUTF8StringEncoding];
return [str1 compare:str2];
return (int)[str1 compare:str2];
}];

case RocksDBComparatorStringCompareDescending:
return [[self alloc] initWithName:@"objectiverocks.string.compare.desc" andBlock:^int(NSData *key1, NSData *key2) {
NSString *str1 = [[NSString alloc] initWithData:key1 encoding:NSUTF8StringEncoding];
NSString *str2 = [[NSString alloc] initWithData:key2 encoding:NSUTF8StringEncoding];
return -1 * [str1 compare:str2];
return -1 * (int)[str1 compare:str2];
}];
}
}
Expand Down
Loading

0 comments on commit f6e3d1c

Please sign in to comment.