Skip to content

Commit dee50f4

Browse files
committed
add -w option
1 parent 2189d8c commit dee50f4

File tree

3 files changed

+49
-8
lines changed

3 files changed

+49
-8
lines changed

RELEASENOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#### 0.6.4
2+
3+
* added -w option, so that I can place MulleObjCLoader files last in sorted lists
4+
15
#### 0.6.3
26

37
* added -i option, mainly to output `include_directories` in `CMakeSourcesAndHeaders.txt`

mulle-xcode-to-cmake.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,10 @@
369369
1DEB927908733DD40010E9CD /* Debug */ = {
370370
isa = XCBuildConfiguration;
371371
buildSettings = {
372-
CURRENT_PROJECT_VERSION = 0.6.3;
372+
CURRENT_PROJECT_VERSION = 0.6.4;
373373
DEBUG_INFORMATION_FORMAT = dwarf;
374374
DYLIB_COMPATIBILITY_VERSION = "$(CURRENT_PROJECT_VERSION)";
375-
DYLIB_CURRENT_VERSION = 0.0.0;
375+
DYLIB_CURRENT_VERSION = "${CURRENT_PROJECT_VERSION}";
376376
GCC_OPTIMIZATION_LEVEL = 0;
377377
GCC_PREPROCESSOR_DEFINITIONS = "";
378378
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -390,10 +390,10 @@
390390
1DEB927A08733DD40010E9CD /* Release */ = {
391391
isa = XCBuildConfiguration;
392392
buildSettings = {
393-
CURRENT_PROJECT_VERSION = 0.6.3;
393+
CURRENT_PROJECT_VERSION = 0.6.4;
394394
DEBUG_INFORMATION_FORMAT = dwarf;
395395
DYLIB_COMPATIBILITY_VERSION = "$(CURRENT_PROJECT_VERSION)";
396-
DYLIB_CURRENT_VERSION = 0.0.0;
396+
DYLIB_CURRENT_VERSION = "${CURRENT_PROJECT_VERSION}";
397397
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
398398
GCC_PREPROCESSOR_DEFINITIONS = "";
399399
GCC_WARN_UNUSED_VARIABLE = YES;

src/mulle-xcode-to-cmake/main.m

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static void usage()
5252
"\t-s <suffix> : create standalone test library (framework/shared)\n"
5353
"\t-t <target> : target to export\n"
5454
"\t-u : add UIKIt\n"
55+
"\t-w <name> : add weight to name for sorting"
5556
"\n"
5657
"Commands:\n"
5758
"\texport : export CMakeLists.txt to stdout\n"
@@ -155,10 +156,33 @@ static void usage()
155156
static BOOL suppressUIKit = YES;
156157
static enum CompilerLanguage language=ObjC_Language;
157158

158-
static NSString *hackPrefix = @"";
159-
static NSString *standaloneSuffix = nil;
159+
static NSString *hackPrefix = @"";
160+
static NSString *standaloneSuffix = nil;
161+
static NSMutableArray *heavyStrings;
160162

161163

164+
@implementation NSString( XcodeWeightedCompare)
165+
166+
- (NSComparisonResult) xcodeWeightedCompare:(id) other
167+
{
168+
NSComparisonResult result;
169+
170+
result = [self compare:other];
171+
if( [heavyStrings containsObject:other])
172+
{
173+
if( [heavyStrings containsObject:self])
174+
return( result);
175+
176+
return( NSOrderedAscending);
177+
}
178+
179+
if( [heavyStrings containsObject:self])
180+
return( NSOrderedDescending);
181+
return( result);
182+
}
183+
184+
@end
185+
162186
#pragma mark - Global Storage
163187

164188
static NSMutableDictionary *staticLibraries;
@@ -429,7 +453,7 @@ static void print_paths( NSArray *paths,
429453
printf( "\n"
430454
"set( %s\n", [name UTF8String]);
431455

432-
rover = [[paths sortedArrayUsingSelector:@selector( compare:)] objectEnumerator];
456+
rover = [[paths sortedArrayUsingSelector:@selector( xcodeWeightedCompare:)] objectEnumerator];
433457
while( path = [rover nextObject])
434458
printf( "%s\n", [quotedPathIfNeeded( path) UTF8String]);
435459

@@ -1328,6 +1352,7 @@ static int _main( int argc, const char * argv[])
13281352
NSString *file;
13291353
NSString *s;
13301354
NSString *target;
1355+
NSString *name;
13311356
id root;
13321357
id targetNames;
13331358
unsigned int i, n;
@@ -1484,7 +1509,6 @@ static int _main( int argc, const char * argv[])
14841509
[targetNames addObject:target];
14851510
continue;
14861511
}
1487-
14881512

14891513
if( [s isEqualToString:@"-u"] ||
14901514
[s isEqualToString:@"--add-uikit"])
@@ -1493,6 +1517,19 @@ static int _main( int argc, const char * argv[])
14931517
continue;
14941518
}
14951519

1520+
if( [s isEqualToString:@"-w"] ||
1521+
[s isEqualToString:@"--weighted-name"])
1522+
{
1523+
if( ++i >= n)
1524+
usage();
1525+
1526+
name = [arguments objectAtIndex:i];
1527+
if( ! heavyStrings)
1528+
heavyStrings = [NSMutableArray array];
1529+
[heavyStrings addObject:name];
1530+
continue;
1531+
}
1532+
14961533
// commands
14971534
if( ! targetNames)
14981535
targetNames = all_target_names( root);

0 commit comments

Comments
 (0)