Skip to content

Commit 7835272

Browse files
committed
fix missing find_library emit with -2
1 parent e035efc commit 7835272

File tree

4 files changed

+122
-100
lines changed

4 files changed

+122
-100
lines changed

README.md

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -230,74 +230,7 @@ src/PBXWriting/PBXObject+PBXEncoding.m
230230

231231
This is basically a stripped down version of `mulle_xcode_utility`.
232232

233-
234-
### Releasenotes
235-
236-
##### 0.6.1
237-
238-
* improve sexport reminder
239-
240-
##### 0.6.0
241-
242-
* there is a new option `-2`. It generates a `CMakeLists.txt` that includes
243-
a file called `CMakeSourcesAndHeaders.txt`. This is a file that you can generate
244-
with an additional run of `mulle-xcode-to-cmake sexport`.
245-
246-
##### 0.5.4
247-
248-
* the reminder is now more readable
249-
250-
##### 0.5.3
251-
252-
* added another little hack for mulle-objc
253-
* output commandline arguments in the reminder
254-
* sexport now also prints the reminder
255-
256-
##### 0.5.2
257-
258-
* add sexport command for generating source and header file lists
259-
* added -l switch, also for mulle-objc to specify the project language
260-
* fix a bug, when files are not group relative in Xcode
261-
262-
##### 0.4.1
263-
264-
* add a reminder how this file was generated. Actually useful sometimes.
265-
266-
##### 0.4.0
267-
268-
* whitespace in target names is converted to '-'
269-
* bundle targets are supported now
270-
* added -n flag
271-
* fix framework resource copy stage
272-
273-
274-
##### 0.3.0
275-
276-
* don't emit link commands for static library targets
277-
* add -s option
278-
* slight reorganization of code
279-
* output filepaths sorted
280-
* fix some bugs
281-
* improved boiler-plate code
282-
283-
284-
##### 0.2.0
285-
286-
* output resources too
287-
* allow to specify multiple targets
288-
* fix more bugs
289-
* add -u option, but iOS builds don't work anway
290-
* somewhat half hearted attempt to also support applications and bundles
291-
* quote paths with whitespace
292-
293-
##### 0.1.0
294-
295-
* Fix some bugs. Add -p and -f options.
296-
297-
298-
#### 0.0
299-
300-
* Quickly hacked together from mulle-xcode-settings.
233+
See the [RELEASENOTES.md](RELEASENOTES.md) for what has changed.
301234

302235

303236

RELEASENOTES.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
### Releasenotes
2+
3+
##### 0.6.2
4+
5+
* improve Framework target output for not APPLE case
6+
* split off Releasenotes into separate file
7+
* fixed missing `find_library` and `target_include_directories` emission when using -2
8+
9+
##### 0.6.1
10+
11+
* improve sexport reminder
12+
13+
##### 0.6.0
14+
15+
* there is a new option `-2`. It generates a `CMakeLists.txt` that includes
16+
a file called `CMakeSourcesAndHeaders.txt`. This is a file that you can generate
17+
with an additional run of `mulle-xcode-to-cmake sexport`.
18+
19+
##### 0.5.4
20+
21+
* the reminder is now more readable
22+
23+
##### 0.5.3
24+
25+
* added another little hack for mulle-objc
26+
* output commandline arguments in the reminder
27+
* sexport now also prints the reminder
28+
29+
##### 0.5.2
30+
31+
* add sexport command for generating source and header file lists
32+
* added -l switch, also for mulle-objc to specify the project language
33+
* fix a bug, when files are not group relative in Xcode
34+
35+
##### 0.4.1
36+
37+
* add a reminder how this file was generated. Actually useful sometimes.
38+
39+
##### 0.4.0
40+
41+
* whitespace in target names is converted to '-'
42+
* bundle targets are supported now
43+
* added -n flag
44+
* fix framework resource copy stage
45+
46+
47+
##### 0.3.0
48+
49+
* don't emit link commands for static library targets
50+
* add -s option
51+
* slight reorganization of code
52+
* output filepaths sorted
53+
* fix some bugs
54+
* improved boiler-plate code
55+
56+
57+
##### 0.2.0
58+
59+
* output resources too
60+
* allow to specify multiple targets
61+
* fix more bugs
62+
* add -u option, but iOS builds don't work anway
63+
* somewhat half hearted attempt to also support applications and bundles
64+
* quote paths with whitespace
65+
66+
##### 0.1.0
67+
68+
* Fix some bugs. Add -p and -f options.
69+
70+
71+
#### 0.0
72+
73+
* Quickly hacked together from mulle-xcode-settings.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
4101507214431CD70019AB2E /* PBXProjectProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBXProjectProxy.m; sourceTree = "<group>"; };
6363
410F65C512C90A6D007EA949 /* PBXProject+Settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PBXProject+Settings.h"; sourceTree = "<group>"; };
6464
410F65C612C90A6D007EA949 /* PBXProject+Settings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "PBXProject+Settings.m"; sourceTree = "<group>"; };
65+
411386D61E9E7F12001B50D1 /* RELEASENOTES.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = RELEASENOTES.md; sourceTree = "<group>"; };
6566
411FA53A12DA484F005C2979 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
6667
4121674E12D897FB00D49F14 /* NSString+KeyFromSetterSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+KeyFromSetterSelector.h"; sourceTree = "<group>"; };
6768
4121674F12D897FB00D49F14 /* NSString+KeyFromSetterSelector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+KeyFromSetterSelector.m"; sourceTree = "<group>"; };
@@ -117,6 +118,7 @@
117118
isa = PBXGroup;
118119
children = (
119120
41795C0F1BCA80CC00CEB1CE /* README.md */,
121+
411386D61E9E7F12001B50D1 /* RELEASENOTES.md */,
120122
41F6FBB51BC40248000C60B2 /* src */,
121123
08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */,
122124
1AB674ADFE9D54B511CA2CBB /* Products */,

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

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,7 @@ static void print_paths( NSArray *paths,
432432
}
433433

434434

435-
static void print_files( NSArray *files,
436-
NSString *name,
437-
enum Command cmd,
438-
BOOL isHeader)
435+
static NSArray *collect_paths( NSArray *files, BOOL isHeader)
439436
{
440437
NSEnumerator *rover;
441438
NSMutableArray *paths;
@@ -468,8 +465,7 @@ static void print_files( NSArray *files,
468465

469466
[paths addObject:path];
470467
}
471-
472-
print_paths( paths, name);
468+
return( paths);
473469
}
474470

475471

@@ -486,8 +482,8 @@ static void print_files( NSArray *files,
486482

487483

488484
static void print_libraries( NSArray *libraries,
489-
NSString *prefix,
490-
BOOL isStatic)
485+
NSString *prefix,
486+
BOOL isStatic)
491487
{
492488
NSEnumerator *rover;
493489
NSString *path;
@@ -728,12 +724,18 @@ static void printcontext_target_properties( struct printcontext *ctxt)
728724
")\n"
729725
"\n"
730726
" install( TARGETS %s DESTINATION \"Frameworks\")\n"
731-
"endif()\n",
727+
"else()\n"
728+
" install( TARGETS %s DESTINATION \"lib\" )\n"
729+
" install( FILES ${PUBLIC_HEADERS} DESTINATION \"include/%s\")\n"
730+
"endif()\n"
731+
"\n",
732732
ctxt->s_target_name,
733733
ctxt->s_target_name,
734734
[headersName UTF8String],
735735
[privheadersName UTF8String],
736736
[resourcesName UTF8String],
737+
ctxt->s_target_name,
738+
ctxt->s_target_name,
737739
ctxt->s_target_name);
738740
break;
739741

@@ -983,50 +985,67 @@ static void export_headers_phase( PBXHeadersBuildPhase *pbxphase,
983985
NSString *prefix)
984986
{
985987
NSString *name;
988+
NSArray *paths;
989+
BOOL shouldPrint;
990+
991+
shouldPrint = (cmd == SourceExport) || ! twoStageCMakeLists;
986992

987993
name = @"PUBLIC_HEADERS";
988994
if( [prefix length])
989995
name = [NSString stringWithFormat:@"%@_%@", prefix, name];
990-
print_files( [pbxphase publicHeaders], name, cmd, YES);
996+
paths = collect_paths( [pbxphase publicHeaders], YES);
997+
if( shouldPrint)
998+
print_paths( paths, name);
991999

992-
if( cmd == SourceExport)
993-
return;
994-
9951000
name = @"PROJECT_HEADERS";
9961001
if( [prefix length])
9971002
name = [NSString stringWithFormat:@"%@_%@", prefix, name];
998-
print_files( [pbxphase projectHeaders], name, cmd, YES);
1003+
paths = collect_paths( [pbxphase projectHeaders], YES);
1004+
if( shouldPrint)
1005+
print_paths( paths, name);
9991006

10001007
name = @"PRIVATE_HEADERS";
10011008
if( [prefix length])
10021009
name = [NSString stringWithFormat:@"%@_%@", prefix, name];
1003-
print_files( [pbxphase privateHeaders], name, cmd, YES);
1010+
paths = collect_paths( [pbxphase privateHeaders], YES);
1011+
if( shouldPrint)
1012+
print_paths( paths, name);
10041013
}
10051014

10061015

10071016
static void export_sources_phase( PBXSourcesBuildPhase *pbxphase,
10081017
enum Command cmd,
10091018
NSString *prefix)
10101019
{
1011-
NSString *name;
1020+
NSString *name;
1021+
NSArray *paths;
1022+
1023+
if( cmd == Export && twoStageCMakeLists)
1024+
return;
10121025

10131026
name = @"SOURCES";
10141027
if( [prefix length])
10151028
name = [NSString stringWithFormat:@"%@_%@", prefix, name];
1016-
print_files( [pbxphase files], name, cmd, NO);
1029+
paths = collect_paths( [pbxphase files], NO);
1030+
print_paths( paths, name);
10171031
}
10181032

10191033

10201034
static void export_resources_phase( PBXResourcesBuildPhase *pbxphase,
10211035
enum Command cmd,
10221036
NSString *prefix)
10231037
{
1024-
NSString *name;
1038+
NSString *name;
1039+
NSArray *paths;
1040+
1041+
if( cmd == Export && twoStageCMakeLists)
1042+
return;
10251043

10261044
name = @"RESOURCES";
10271045
if( [prefix length])
10281046
name = [NSString stringWithFormat:@"%@_%@", prefix, name];
1029-
print_files( [pbxphase files], name, cmd, NO);
1047+
paths = collect_paths( [pbxphase files], NO);
1048+
print_paths( paths, name);
10301049
}
10311050

10321051

@@ -1057,9 +1076,7 @@ static void collect_libraries( PBXFrameworksBuildPhase *pbxphase,
10571076
}
10581077
else
10591078
if( ! isStatic)
1060-
{
10611079
addSharedLibrariesToFind( path, libraryName);
1062-
}
10631080
}
10641081
}
10651082

@@ -1134,7 +1151,7 @@ static void add_implicit_frameworks_if_needed( PBXTarget *pbxtarget)
11341151

11351152
if( addFoundation)
11361153
{
1137-
printf( "# uncomment this for mulle-objc\n"
1154+
printf( "# uncomment this for mulle-objc to search libraries first\n"
11381155
"# set( CMAKE_FIND_FRAMEWORK \"LAST\")\n");
11391156

11401157
addSharedLibrariesToFind( @"Foundation", @"FOUNDATION");
@@ -1165,9 +1182,7 @@ static void file_exporter( PBXTarget *pbxtarget,
11651182

11661183
rover = [[pbxtarget buildPhases] objectEnumerator];
11671184
while( phase = [rover nextObject])
1168-
{
11691185
export_phase( phase, cmd, multipleTargets ? makeMacroName( [pbxtarget name]) : nil);
1170-
}
11711186
}
11721187

11731188

@@ -1255,16 +1270,15 @@ static void exporter( PBXProject *root,
12551270
"\n"
12561271
"include( CMakeSourcesAndHeaders.txt)\n");
12571272
}
1258-
else
1273+
1274+
rover = [targets objectEnumerator];
1275+
while( pbxtarget = [rover nextObject])
12591276
{
1260-
rover = [targets objectEnumerator];
1261-
while( pbxtarget = [rover nextObject])
1262-
{
1263-
if( cmd == Export || cmd == SourceExport)
1264-
print_files_header_comment( [pbxtarget name]);
1265-
file_exporter( pbxtarget, cmd, multipleTargets);
1266-
}
1277+
if( (cmd == Export && ! twoStageCMakeLists) || cmd == SourceExport)
1278+
print_files_header_comment( [pbxtarget name]);
1279+
file_exporter( pbxtarget, cmd, multipleTargets);
12671280
}
1281+
12681282
// ugliness ensues...
12691283

12701284
if( cmd != Export)

0 commit comments

Comments
 (0)