Skip to content

Commit

Permalink
add -w option
Browse files Browse the repository at this point in the history
  • Loading branch information
codeon-nat committed Jun 16, 2017
1 parent 2189d8c commit dee50f4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
4 changes: 4 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#### 0.6.4

* added -w option, so that I can place MulleObjCLoader files last in sorted lists

#### 0.6.3

* added -i option, mainly to output `include_directories` in `CMakeSourcesAndHeaders.txt`
Expand Down
8 changes: 4 additions & 4 deletions mulle-xcode-to-cmake.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,10 @@
1DEB927908733DD40010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CURRENT_PROJECT_VERSION = 0.6.3;
CURRENT_PROJECT_VERSION = 0.6.4;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = "$(CURRENT_PROJECT_VERSION)";
DYLIB_CURRENT_VERSION = 0.0.0;
DYLIB_CURRENT_VERSION = "${CURRENT_PROJECT_VERSION}";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = "";
GCC_WARN_UNUSED_VARIABLE = YES;
Expand All @@ -390,10 +390,10 @@
1DEB927A08733DD40010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CURRENT_PROJECT_VERSION = 0.6.3;
CURRENT_PROJECT_VERSION = 0.6.4;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = "$(CURRENT_PROJECT_VERSION)";
DYLIB_CURRENT_VERSION = 0.0.0;
DYLIB_CURRENT_VERSION = "${CURRENT_PROJECT_VERSION}";
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = "";
GCC_WARN_UNUSED_VARIABLE = YES;
Expand Down
45 changes: 41 additions & 4 deletions src/mulle-xcode-to-cmake/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static void usage()
"\t-s <suffix> : create standalone test library (framework/shared)\n"
"\t-t <target> : target to export\n"
"\t-u : add UIKIt\n"
"\t-w <name> : add weight to name for sorting"
"\n"
"Commands:\n"
"\texport : export CMakeLists.txt to stdout\n"
Expand Down Expand Up @@ -155,10 +156,33 @@ static void usage()
static BOOL suppressUIKit = YES;
static enum CompilerLanguage language=ObjC_Language;

static NSString *hackPrefix = @"";
static NSString *standaloneSuffix = nil;
static NSString *hackPrefix = @"";
static NSString *standaloneSuffix = nil;
static NSMutableArray *heavyStrings;


@implementation NSString( XcodeWeightedCompare)

- (NSComparisonResult) xcodeWeightedCompare:(id) other
{
NSComparisonResult result;

result = [self compare:other];
if( [heavyStrings containsObject:other])
{
if( [heavyStrings containsObject:self])
return( result);

return( NSOrderedAscending);
}

if( [heavyStrings containsObject:self])
return( NSOrderedDescending);
return( result);
}

@end

#pragma mark - Global Storage

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

rover = [[paths sortedArrayUsingSelector:@selector( compare:)] objectEnumerator];
rover = [[paths sortedArrayUsingSelector:@selector( xcodeWeightedCompare:)] objectEnumerator];
while( path = [rover nextObject])
printf( "%s\n", [quotedPathIfNeeded( path) UTF8String]);

Expand Down Expand Up @@ -1328,6 +1352,7 @@ static int _main( int argc, const char * argv[])
NSString *file;
NSString *s;
NSString *target;
NSString *name;
id root;
id targetNames;
unsigned int i, n;
Expand Down Expand Up @@ -1484,7 +1509,6 @@ static int _main( int argc, const char * argv[])
[targetNames addObject:target];
continue;
}


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

if( [s isEqualToString:@"-w"] ||
[s isEqualToString:@"--weighted-name"])
{
if( ++i >= n)
usage();

name = [arguments objectAtIndex:i];
if( ! heavyStrings)
heavyStrings = [NSMutableArray array];
[heavyStrings addObject:name];
continue;
}

// commands
if( ! targetNames)
targetNames = all_target_names( root);
Expand Down

0 comments on commit dee50f4

Please sign in to comment.