Create mm sections in makefiles for Objective-C++

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@38250 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Riccardo Mottola 2014-12-14 22:36:09 +00:00
parent f4110f9817
commit 4111197fd7
2 changed files with 64 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2014-12-15 Riccardo Mottola <rm@gnu.org>
* Framework/PCMakefileFactory.m
Create mm sections in makefiles for Objective-C++
2014-12-08 Riccardo Mottola <rm@gnu.org>
* Framework/PCProject.m

View file

@ -1,10 +1,11 @@
/*
GNUstep ProjectCenter - http://www.gnustep.org/experience/ProjectCenter.html
Copyright (C) 2002-2010 Free Software Foundation
Copyright (C) 2002-2014 Free Software Foundation
Authors: Philippe C.D. Robert
Serg Stoyan
Riccardo Mottola
This file is part of GNUstep.
@ -33,7 +34,8 @@
#define COMMENT_HEADERS @"\n\n#\n# Header files\n#\n"
#define COMMENT_RESOURCES @"\n\n#\n# Resource files\n#\n"
#define COMMENT_CLASSES @"\n\n#\n# Class files\n#\n"
#define COMMENT_CLASSES @"\n\n#\n# Objective-C Class files\n#\n"
#define COMMENT_OCPPCLASSES @"\n\n#\n# Objective-C++ Class files\n#\n"
#define COMMENT_CFILES @"\n\n#\n# Other sources\n#\n"
#define COMMENT_SUBPROJECTS @"\n\n#\n# Subprojects\n#\n"
#define COMMENT_APP @"\n\n#\n# Main application\n#\n"
@ -337,16 +339,48 @@ static PCMakefileFactory *_factory = nil;
- (void)appendClasses:(NSArray *)array forTarget:(NSString *)target
{
NSEnumerator *oenum;
NSMutableArray *marray = nil;
NSMutableArray *mmarray = nil;
NSString *file;
if (array == nil || [array count] == 0)
{
return;
}
oenum = [array objectEnumerator];
while ((file = [oenum nextObject]))
{
if ([file hasSuffix: @".m"])
{
if (marray == nil)
{
marray = [NSMutableArray array];
}
[marray addObject: file];
}
else if ([file hasSuffix: @".mm"])
{
if (mmarray == nil)
{
mmarray = [NSMutableArray array];
}
[mmarray addObject: file];
}
}
[self appendString:COMMENT_CLASSES];
[self appendString:
[NSString stringWithFormat: @"%@_OBJC_FILES = \\\n",target]];
[self appendString: [array componentsJoinedByString: @" \\\n"]];
[self appendString: [marray componentsJoinedByString: @" \\\n"]];
[self appendString:COMMENT_OCPPCLASSES];
[self appendString:
[NSString stringWithFormat: @"%@_OBJCC_FILES = \\\n",target]];
[self appendString: [mmarray componentsJoinedByString: @" \\\n"]];
}
- (void)appendOtherSources:(NSArray *)array
@ -362,6 +396,7 @@ static PCMakefileFactory *_factory = nil;
- (void)appendOtherSources:(NSArray *)array forTarget: (NSString *)target
{
NSMutableArray *marray = nil;
NSMutableArray *mmarray = nil;
NSMutableArray *oarray = nil;
NSEnumerator *oenum;
NSString *file;
@ -383,6 +418,14 @@ static PCMakefileFactory *_factory = nil;
}
[marray addObject: file];
}
else if ([file hasSuffix: @".mm"])
{
if (mmarray == nil)
{
mmarray = [NSMutableArray array];
}
[mmarray addObject: file];
}
else // non .m file
{
if (oarray == nil)
@ -416,6 +459,19 @@ static PCMakefileFactory *_factory = nil;
[self appendString: [NSString stringWithFormat: @"%@_OBJC_FILES += ",pnme]];
while ((file = [oenum nextObject]))
{
[self appendString: [NSString stringWithFormat: @"\\\n%@ ", file]];
}
}
// Add .mm files if any
if (mmarray && [marray count] != 0)
{
oenum = [mmarray objectEnumerator];
[self appendString: [NSString stringWithFormat: @"%@_OBJCC_FILES += ",pnme]];
while ((file = [oenum nextObject]))
{
[self appendString: [NSString stringWithFormat: @"\\\n%@ ", file]];