@@ -258,7 +258,25 @@ public bool AddOtherLDFlags( PBXList flags )
258258 modified = true ;
259259 return modified ;
260260 }
261-
261+
262+ public bool GccEnableCppExceptions ( string value )
263+ {
264+ foreach ( KeyValuePair < string , XCBuildConfiguration > buildConfig in buildConfigurations ) {
265+ buildConfig . Value . GccEnableCppExceptions ( value ) ;
266+ }
267+ modified = true ;
268+ return modified ;
269+ }
270+
271+ public bool GccEnableObjCExceptions ( string value )
272+ {
273+ foreach ( KeyValuePair < string , XCBuildConfiguration > buildConfig in buildConfigurations ) {
274+ buildConfig . Value . GccEnableObjCExceptions ( value ) ;
275+ }
276+ modified = true ;
277+ return modified ;
278+ }
279+
262280 public bool AddHeaderSearchPaths ( string path )
263281 {
264282 return AddHeaderSearchPaths ( new PBXList ( path ) ) ;
@@ -354,12 +372,12 @@ public PBXDictionary AddFile( string filePath, PBXGroup parent = null, string tr
354372// Debug.Log( "Is rooted: " + absPath );
355373 }
356374 else if ( tree . CompareTo ( "SDKROOT" ) != 0 ) {
357- absPath = Path . Combine ( Application . dataPath , filePath ) ;
375+ absPath = Path . Combine ( Application . dataPath . Replace ( "Assets" , "" ) , filePath ) ;
358376// Debug.Log( "RElative: " + absPath );
359377 }
360378
361379 if ( ! ( File . Exists ( absPath ) || Directory . Exists ( absPath ) ) && tree . CompareTo ( "SDKROOT" ) != 0 ) {
362- Debug . Log ( "Missing file: " + filePath ) ;
380+ Debug . Log ( "Missing file: " + absPath + " > " + filePath ) ;
363381 return results ;
364382 }
365383 else if ( tree . CompareTo ( "SOURCE_ROOT" ) == 0 || tree . CompareTo ( "GROUP" ) == 0 ) {
@@ -402,7 +420,7 @@ public PBXDictionary AddFile( string filePath, PBXGroup parent = null, string tr
402420 }
403421
404422 if ( ! string . IsNullOrEmpty ( absPath ) && File . Exists ( absPath ) && tree . CompareTo ( "SOURCE_ROOT" ) == 0 ) {
405- Debug . LogError ( absPath ) ;
423+ // Debug.LogError(absPath);
406424 string libraryPath = Path . Combine ( "$(SRCROOT)" , Path . GetDirectoryName ( filePath ) ) ;
407425 this . AddLibrarySearchPaths ( new PBXList ( libraryPath ) ) ;
408426 }
@@ -509,9 +527,10 @@ public bool AddFolder( string folderPath, PBXGroup parent = null, string[] exclu
509527 if ( ! Directory . Exists ( folderPath ) )
510528 return false ;
511529 DirectoryInfo sourceDirectoryInfo = new DirectoryInfo ( folderPath ) ;
512-
530+
513531 if ( exclude == null )
514532 exclude = new string [ ] { } ;
533+ string regexExclude = string . Format ( @"{0}" , string . Join ( "|" , exclude ) ) ;
515534
516535 PBXDictionary results = new PBXDictionary ( ) ;
517536
@@ -524,6 +543,10 @@ public bool AddFolder( string folderPath, PBXGroup parent = null, string[] exclu
524543
525544 foreach ( string directory in Directory . GetDirectories ( folderPath ) )
526545 {
546+ if ( Regex . IsMatch ( directory , regexExclude ) ) {
547+ continue ;
548+ }
549+
527550// special_folders = ['.bundle', '.framework', '.xcodeproj']
528551 Debug . Log ( "DIR: " + directory ) ;
529552 if ( directory . EndsWith ( ".bundle" ) ) {
@@ -539,18 +562,15 @@ public bool AddFolder( string folderPath, PBXGroup parent = null, string[] exclu
539562 AddFolder ( directory , newGroup , exclude , recursive , createBuildFile ) ;
540563 }
541564 }
542-
543565 // Adding files.
544- string regexExclude = string . Format ( @"{0}" , string . Join ( "|" , exclude ) ) ;
545566 foreach ( string file in Directory . GetFiles ( folderPath ) ) {
546567 if ( Regex . IsMatch ( file , regexExclude ) ) {
547568 continue ;
548569 }
549- // Debug.Log( "--> " + file + ", " + newGroup );
570+ // Debug.Log( "--> " + file + ", " + newGroup );
550571 AddFile ( file , newGroup , "SOURCE_ROOT" , createBuildFile ) ;
551572 }
552-
553-
573+
554574 modified = true ;
555575 return modified ;
556576// def add_folder(self, os_path, parent=None, excludes=None, recursive=True, create_build_files=True):
@@ -947,14 +967,33 @@ public void ApplyMod( XCMod mod )
947967 this . AddHeaderSearchPaths ( absoluteHeaderPath ) ;
948968 }
949969
950- Debug . Log ( "Adding other linker flags..." ) ;
951- foreach ( string linker in mod . linkers ) {
952- string _linker = linker ;
953- if ( ! _linker . StartsWith ( "-" ) )
954- _linker = "-" + _linker ;
955- this . AddOtherLDFlags ( _linker ) ;
970+ Debug . Log ( "Configure build settings..." ) ;
971+ Hashtable buildSettings = mod . buildSettings ;
972+ if ( buildSettings . ContainsKey ( "OTHER_LDFLAGS" ) )
973+ {
974+ Debug . Log ( " Adding other linker flags..." ) ;
975+ ArrayList otherLinkerFlags = ( ArrayList ) buildSettings [ "OTHER_LDFLAGS" ] ;
976+ foreach ( string linker in otherLinkerFlags )
977+ {
978+ string _linker = linker ;
979+ if ( ! _linker . StartsWith ( "-" ) )
980+ _linker = "-" + _linker ;
981+ this . AddOtherLDFlags ( _linker ) ;
982+ }
983+ }
984+
985+ if ( buildSettings . ContainsKey ( "GCC_ENABLE_CPP_EXCEPTIONS" ) )
986+ {
987+ Debug . Log ( " GCC_ENABLE_CPP_EXCEPTIONS = " + buildSettings [ "GCC_ENABLE_CPP_EXCEPTIONS" ] ) ;
988+ this . GccEnableCppExceptions ( ( string ) buildSettings [ "GCC_ENABLE_CPP_EXCEPTIONS" ] ) ;
956989 }
957-
990+
991+ if ( buildSettings . ContainsKey ( "GCC_ENABLE_OBJC_EXCEPTIONS" ) )
992+ {
993+ Debug . Log ( " GCC_ENABLE_OBJC_EXCEPTIONS = " + buildSettings [ "GCC_ENABLE_OBJC_EXCEPTIONS" ] ) ;
994+ this . GccEnableObjCExceptions ( ( string ) buildSettings [ "GCC_ENABLE_OBJC_EXCEPTIONS" ] ) ;
995+ }
996+
958997 this . Consolidate ( ) ;
959998 }
960999
0 commit comments