Skip to content

Commit

Permalink
Add framework search path.
Browse files Browse the repository at this point in the history
You can now add third part framework to Xcode project. Add the .framework file to XUPorter's iOS/ folder and add it to file section in projmods file.
  • Loading branch information
onevcat committed Jul 15, 2013
1 parent 8b2f056 commit cd5d17d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
6 changes: 6 additions & 0 deletions XCBuildConfiguration.cs
Expand Up @@ -8,6 +8,7 @@ public class XCBuildConfiguration : PBXObject
protected const string BUILDSETTINGS_KEY = "buildSettings";
protected const string HEADER_SEARCH_PATHS_KEY = "HEADER_SEARCH_PATHS";
protected const string LIBRARY_SEARCH_PATHS_KEY = "LIBRARY_SEARCH_PATHS";
protected const string FRAMEWORK_SEARCH_PATHS_KEY = "FRAMEWORK_SEARCH_PATHS";
protected const string OTHER_C_FLAGS_KEY = "OTHER_CFLAGS";
protected const string OTHER_LDFLAGS_KEY = "OTHER_LDFLAGS";

Expand Down Expand Up @@ -70,6 +71,11 @@ public bool AddLibrarySearchPaths( PBXList paths, bool recursive = true )
{
return this.AddSearchPaths( paths, LIBRARY_SEARCH_PATHS_KEY, recursive );
}

public bool AddFrameworkSearchPaths( PBXList paths, bool recursive = true )
{
return this.AddSearchPaths( paths, FRAMEWORK_SEARCH_PATHS_KEY, recursive );
}

public bool AddOtherCFlags( string flag )
{
Expand Down
23 changes: 21 additions & 2 deletions XCProject.cs
Expand Up @@ -283,6 +283,20 @@ public bool AddLibrarySearchPaths( PBXList paths )
return modified;
}

public bool AddFrameworkSearchPaths( string path )
{
return AddFrameworkSearchPaths( new PBXList( path ) );
}

public bool AddFrameworkSearchPaths( PBXList paths )
{
foreach( KeyValuePair<string, XCBuildConfiguration> buildConfig in buildConfigurations ) {
buildConfig.Value.AddFrameworkSearchPaths( paths );
}
modified = true;
return modified;
}

public object GetObject( string guid )
{
return _objects[guid];
Expand Down Expand Up @@ -334,9 +348,14 @@ public PBXDictionary AddFile( string filePath, PBXGroup parent = null, string tr
foreach( KeyValuePair<string, PBXFrameworksBuildPhase> currentObject in frameworkBuildPhases ) {
BuildAddFile(fileReference,currentObject,weak);
}
if ( !string.IsNullOrEmpty( absPath ) && ( tree.CompareTo( "SOURCE_ROOT" ) == 0 ) && File.Exists( absPath ) ) {
if ( !string.IsNullOrEmpty( absPath ) && ( tree.CompareTo( "SOURCE_ROOT" ) == 0 )) {
string libraryPath = Path.Combine( "$(SRCROOT)", Path.GetDirectoryName( filePath ) );
this.AddLibrarySearchPaths( new PBXList( libraryPath ) );
if (File.Exists(absPath)) {
this.AddLibrarySearchPaths( new PBXList( libraryPath ) );
} else {
this.AddFrameworkSearchPaths( new PBXList( libraryPath ) );
}

}
break;
case "PBXResourcesBuildPhase":
Expand Down

0 comments on commit cd5d17d

Please sign in to comment.