Author: matt
Date: 2011-08-06 14:49:08 -0700 (Sat, 06 Aug 2011)
New Revision: 8920
Log:
Fluid3: more Xcode4 support

Modified:
   branches/branch-3.0/fltk.flw
   branches/branch-3.0/fluid/Fl_Type.cxx
   branches/branch-3.0/fluid/file_xcode.cxx
   branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj
   branches/branch-3.0/ide/templates/Xcode4.tmpl

Modified: branches/branch-3.0/fltk.flw
===================================================================
--- branches/branch-3.0/fltk.flw        2011-08-06 21:22:00 UTC (rev 8919)
+++ branches/branch-3.0/fltk.flw        2011-08-06 21:49:08 UTC (rev 8920)
@@ -206,6 +206,7 @@
     uuid_Xcode4_BuildConfigurationList {F8A317C2-0F96-4681-8A97-DA6FDEF118E2}
     uuid_Xcode4_DebugBuildConfiguration {034870F2-FE15-4D23-AD0D-62ED38449392}
     uuid_Xcode4_ReleaseBuildConfiguration 
{D584B52C-FED3-4E71-A47E-A60BA05375B9}
+    uuid_Xcode4_ResourcesBuildPhase {1DAA0C25-90AF-445C-A814-DB4C66428D29}
   } {
     folder Headers {open
     } {

Modified: branches/branch-3.0/fluid/Fl_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.cxx       2011-08-06 21:22:00 UTC (rev 
8919)
+++ branches/branch-3.0/fluid/Fl_Type.cxx       2011-08-06 21:49:08 UTC (rev 
8920)
@@ -1260,6 +1260,7 @@
   return 0L;
 }
 
+// throws a null exception!
 Fl_Target_Type *Fl_Target_Type::find(const char *name, char end) {
   // find a partial string, if 'end' is set to a character
   char buf[2048];
@@ -1275,6 +1276,7 @@
       return (Fl_Target_Type*)tgt;
     tgt = tgt->next;
   }
+  throw "Target not found";
   return 0;
 }
 

Modified: branches/branch-3.0/fluid/file_xcode.cxx
===================================================================
--- branches/branch-3.0/fluid/file_xcode.cxx    2011-08-06 21:22:00 UTC (rev 
8919)
+++ branches/branch-3.0/fluid/file_xcode.cxx    2011-08-06 21:49:08 UTC (rev 
8920)
@@ -185,13 +185,51 @@
   return 0;
 }
 
-static int writeNativeTarget(FILE *out, const char *listKey, const char 
*productName) {
-  // currently writes only one entry inside the native target!
-  fprintf(out, "\t\t\tbuildConfigurationList = %s /* Build configuration list 
for PBXNativeTarget \"%s\" */;", listKey, productName);
+static int writeResourcesBuildPhase(FILE *out, const char *key, const char 
*productName) {
+  fprintf(out, "\t\t%s /* Resources */ = {\n", key);
+  fprintf(out, "\t\t\tisa = PBXResourcesBuildPhase;\n");
+  fprintf(out, "\t\t\tbuildActionMask = 2147483647;\n");
+  fprintf(out, "\t\t\tfiles = (\n");
+  fprintf(out, "\t\t\t);\n");
+  fprintf(out, "\t\t\trunOnlyForDeploymentPostprocessing = 0;\n");
+  fprintf(out, "\t\t};\n");
   return 0;
 }
 
 
+static int writeNativeTarget(FILE *out, Fl_Target_Type *tgt) {
+  // currently we still have a bunch of fixed UUIDs in here!
+
+  char buildConfigurationList[32]; strcpy(buildConfigurationList, 
tgt->get_UUID_Xcode("Xcode4_BuildConfigurationList"));
+  char ResourcesBuildPhase[32]; strcpy(ResourcesBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_ResourcesBuildPhase"));
+
+  fprintf(out, "\t\tA57FDE871C99A52BEEDEE68C /* %s */ = {\n", tgt->name());    
 // FIXME: use generated key
+  fprintf(out, "\t\t\tisa = PBXNativeTarget;\n");
+  fprintf(out, "\t\t\tbuildConfigurationList = %s /* Build configuration list 
for PBXNativeTarget \"%s\" */;", buildConfigurationList, tgt->name());
+  fprintf(out, "\t\t\tbuildPhases = (\n");
+  fprintf(out, "\t\t\t\t%s /* Resources */,\n", ResourcesBuildPhase);
+  fprintf(out, "\t\t\t\tC9EDD5C81274C6BA00ADB21C /* Headers */,\n");           
 // FIXME: use generated key
+  fprintf(out, "\t\t\t\tC9EDD42D1274B84100ADB21C /* CopyFiles */,\n");         
 // FIXME: use generated key
+  fprintf(out, "\t\t\t\tC9EDD4DD1274BB4100ADB21C /* CopyFiles */,\n");         
 // FIXME: use generated key
+  fprintf(out, "\t\t\t\t4DA82C38AA0403E56A1E3545 /* Sources */,\n");           
 // FIXME: use generated key
+  fprintf(out, "\t\t\t\tD2A1AD2D93B0EED43F624520 /* Frameworks */,\n");        
 // FIXME: use generated key
+  fprintf(out, "\t\t\t);\n");
+  fprintf(out, "\t\tbuildRules = (\n");
+  fprintf(out, "\t\t\t\tEFFAAB905A54B0BFE13CB56C /* PBXBuildRule */,\n");      
 // FIXME: use generated key
+  fprintf(out, "\t\t\t);\n");
+  fprintf(out, "\t\t\tdependencies = (\n");
+  fprintf(out, "\t\t\t);\n");
+  fprintf(out, "\t\t\tname = %s;\n", tgt->name());
+  fprintf(out, "\t\t\tproductName = %s;\n", tgt->name());
+  fprintf(out, "\t\t\tproductReference = FEB0F8FE6383384180570D94 /* 
%s.framework */;\n", tgt->name()); // FIXME: use generated key
+  fprintf(out, "\t\t\tproductType = \"com.apple.product-type.framework\";\n");
+  fprintf(out, "\t\t};\n");
+  
+  
+  return 0;
+}
+
+
 int write_fltk_ide_xcode4() {
   // for now, we use a template file in FLTK/ide/templates/VisualC2008.tmpl .
   // When done, everything will likely be integrated into the executable to 
make one compact package.
@@ -241,10 +279,6 @@
           hash = strchr(hash, ';')+1;
       } else if (strncmp(hash, "#BuildFileReferences(", 21)==0) {
           Fl_Type *tgt = Fl_Target_Type::find(hash+21, ')'); // keep tgt local
-          if (!tgt) {
-            printf("ERROR writing Xcode 4 file: target not found!");
-            return -1;
-          }
           Fl_File_Type *f;
           for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
             if (f->builds_in(FL_ENV_XC4)) {
@@ -261,10 +295,6 @@
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#FileReferences(", 16)==0) {
           Fl_Type *tgt = Fl_Target_Type::find(hash+16, ')');
-          if (!tgt) {
-            printf("ERROR writing Xcode 4 file: target not found!");
-            return -1;
-          }
           Fl_File_Type *f;
           for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
             // FIXME: write a file type converter!
@@ -281,10 +311,6 @@
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#HeadersGroup(", 14)==0) {
           Fl_Type *tgt = Fl_Target_Type::find(hash+14, ')');
-          if (!tgt) {
-            printf("ERROR writing Xcode 4 file: target not found!");
-            return -1;
-          }
           Fl_File_Type *f;
           for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
             if (f->lists_in(FL_ENV_XC4) && f->is_header()) {
@@ -297,10 +323,6 @@
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#SourcesGroup(", 14)==0) {
           Fl_Type *tgt = Fl_Target_Type::find(hash+14, ')');
-          if (!tgt) {
-            printf("ERROR writing Xcode 4 file: target not found!");
-            return -1;
-          }
           Fl_File_Type *f;
           for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
             if (f->lists_in(FL_ENV_XC4) && f->is_code()) {
@@ -313,10 +335,6 @@
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#HeadersBuildPhase(", 19)==0) {
           Fl_Type *tgt = Fl_Target_Type::find(hash+19, ')');
-          if (!tgt) {
-            printf("ERROR writing Xcode 4 file: target not found!");
-            return -1;
-          }
           Fl_File_Type *f;
           for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
             if (f->builds_in(FL_ENV_XC4) && f->is_header()) {
@@ -330,10 +348,6 @@
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#SourcesBuildPhase(", 19)==0) {
           Fl_Type *tgt = Fl_Target_Type::find(hash+19, ')');
-          if (!tgt) {
-            printf("ERROR writing Xcode 4 file: target not found!");
-            return -1;
-          }
           Fl_File_Type *f;
           for (f = Fl_File_Type::first_file(tgt); f; f = f->next_file(tgt)) {
             if (f->builds_in(FL_ENV_XC4) && f->is_code()) {
@@ -347,33 +361,25 @@
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#BuildConfigurations(", 21)==0) {
           Fl_Target_Type *tgt = Fl_Target_Type::find(hash+21, ')');
-          if (!tgt) {
-            printf("ERROR writing Xcode 4 file: target not found!");
-            return -1;
-          }
           char debugKey[32]; strcpy(debugKey, 
tgt->get_UUID_Xcode("Xcode4_DebugBuildConfiguration"));
           char releaseKey[32]; strcpy(releaseKey, 
tgt->get_UUID_Xcode("Xcode4_ReleaseBuildConfiguration"));
           writeBuildConfigurations(out, debugKey, releaseKey, tgt->name());
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#BuildConfigurationList(", 24)==0) {
           Fl_Target_Type *tgt = Fl_Target_Type::find(hash+24, ')');
-          if (!tgt) {
-            printf("ERROR writing Xcode 4 file: target not found!");
-            return -1;
-          }
           char listKey[32]; strcpy(listKey, 
tgt->get_UUID_Xcode("Xcode4_BuildConfigurationList"));
           char debugKey[32]; strcpy(debugKey, 
tgt->get_UUID_Xcode("Xcode4_DebugBuildConfiguration"));
           char releaseKey[32]; strcpy(releaseKey, 
tgt->get_UUID_Xcode("Xcode4_ReleaseBuildConfiguration"));
           writeBuildConfigurationList(out, listKey, debugKey, releaseKey, 
tgt->name());
           hash = strchr(hash, ';')+1;
+        } else if (strncmp(hash, "#ResourcesBuildPhase(", 21)==0) {
+          Fl_Target_Type *tgt = Fl_Target_Type::find(hash+21, ')');
+          char key[32]; strcpy(key, 
tgt->get_UUID_Xcode("Xcode4_ResourcesBuildPhase"));
+          writeResourcesBuildPhase(out, key, tgt->name());
+          hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#NativeTarget(", 14)==0) {
           Fl_Target_Type *tgt = Fl_Target_Type::find(hash+14, ')');
-          if (!tgt) {
-            printf("ERROR writing Xcode 4 file: target not found!");
-            return -1;
-          }
-          char listKey[32]; strcpy(listKey, 
tgt->get_UUID_Xcode("Xcode4_BuildConfigurationList"));
-          writeNativeTarget(out, listKey, tgt->name());
+          writeNativeTarget(out, tgt);
           hash = strchr(hash, ';')+1;
         } else {
 #if 0
@@ -381,13 +387,13 @@
           
           rootObject = 4BF1A7FFEACF5F31B4127482, contains fltk as a target
             fltk (NativeTarget) = A57FDE871C99A52BEEDEE68C
-              buildConfigurationList (ConfigurationList) = 
3BD5FFB6FCC8F21A23C23DF4 /* Build configuration list for PBXNativeTarget "fltk" 
*/;
-                Debug (BuildConfiguration) = 78446623B2E9921ED6B05986
-                Release (BuildConfiguration) = BFEB622BA8B40E851AF0E91F
+              -buildConfigurationList (ConfigurationList) = 
3BD5FFB6FCC8F21A23C23DF4 /* Build configuration list for PBXNativeTarget "fltk" 
*/;
+                -Debug (BuildConfiguration) = 78446623B2E9921ED6B05986
+                -Release (BuildConfiguration) = BFEB622BA8B40E851AF0E91F
               Resources build phase (ResourcesBuildPhase) = 
6715D162BEFF87372B2A31E0 (can reference files (BuildFile))
               Headers build phase (HeadersBuildPhas) = 
C9EDD5C81274C6BA00ADB21C (can reference files (BuildFile))
-              CopyFilesBuildPhase = C9EDD42D1274B84100ADB21C /* CopyFiles */,
-              CopyFilesBuildPhase = C9EDD4DD1274BB4100ADB21C /* CopyFiles */,
+              CopyFilesBuildPhase = C9EDD42D1274B84100ADB21C /* CopyFiles */, 
(copying header files around that shouldn`t)
+              CopyFilesBuildPhase = C9EDD4DD1274BB4100ADB21C /* CopyFiles */, 
(copying header files around that shouldn`t)
               SourcesBuildPhase = 4DA82C38AA0403E56A1E3545 /* Sources */,
               FrameworksBuildPhase = D2A1AD2D93B0EED43F624520
                 Cocoa.framework = C96290C21274D0CF007D3CFE (BuildFile -> 
FileReference)

Modified: branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj
===================================================================
--- branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj       
2011-08-06 21:22:00 UTC (rev 8919)
+++ branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj       
2011-08-06 21:49:08 UTC (rev 8920)
@@ -8497,14 +8497,14 @@
                A57FDE871C99A52BEEDEE68C /* fltk */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = F8A317C2491750F8DEF118E2 /* 
Build configuration list for PBXNativeTarget "fltk" */;                    
buildPhases = (
-                               6715D162BEFF87372B2A31E0 /* Resources */,
+                               1DAA0C25D4F3735866428D29 /* Resources */,
                                C9EDD5C81274C6BA00ADB21C /* Headers */,
                                C9EDD42D1274B84100ADB21C /* CopyFiles */,
                                C9EDD4DD1274BB4100ADB21C /* CopyFiles */,
                                4DA82C38AA0403E56A1E3545 /* Sources */,
                                D2A1AD2D93B0EED43F624520 /* Frameworks */,
                        );
-                       buildRules = (
+               buildRules = (
                                EFFAAB905A54B0BFE13CB56C /* PBXBuildRule */,
                        );
                        dependencies = (
@@ -9525,7 +9525,7 @@
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               6715D162BEFF87372B2A31E0 /* Resources */ = {
+               1DAA0C25D4F3735866428D29 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (

Modified: branches/branch-3.0/ide/templates/Xcode4.tmpl
===================================================================
--- branches/branch-3.0/ide/templates/Xcode4.tmpl       2011-08-06 21:22:00 UTC 
(rev 8919)
+++ branches/branch-3.0/ide/templates/Xcode4.tmpl       2011-08-06 21:49:08 UTC 
(rev 8920)
@@ -7374,27 +7374,7 @@
                        productReference = E1BF46F43DB886EB2301F83A /* 
fast_slow.app */;
                        productType = "com.apple.product-type.application";
                };
-               A57FDE871C99A52BEEDEE68C /* fltk */ = {
-                       isa = PBXNativeTarget;
 #NativeTarget(fltk);
-                       buildPhases = (
-                               6715D162BEFF87372B2A31E0 /* Resources */,
-                               C9EDD5C81274C6BA00ADB21C /* Headers */,
-                               C9EDD42D1274B84100ADB21C /* CopyFiles */,
-                               C9EDD4DD1274BB4100ADB21C /* CopyFiles */,
-                               4DA82C38AA0403E56A1E3545 /* Sources */,
-                               D2A1AD2D93B0EED43F624520 /* Frameworks */,
-                       );
-                       buildRules = (
-                               EFFAAB905A54B0BFE13CB56C /* PBXBuildRule */,
-                       );
-                       dependencies = (
-                       );
-                       name = fltk;
-                       productName = fltk;
-                       productReference = FEB0F8FE6383384180570D94 /* 
fltk.framework */;
-                       productType = "com.apple.product-type.framework";
-               };
                A58BB416AAFDCFF08D7C7E41 /* fltk_png */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = 840081F8C4055EEEDA44ED91 /* 
Build configuration list for PBXNativeTarget "fltk_png" */;
@@ -8406,13 +8386,7 @@
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
-               6715D162BEFF87372B2A31E0 /* Resources */ = {
-                       isa = PBXResourcesBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-               };
+#ResourcesBuildPhase(fltk);
                6A37D389FD2F3165D4CE73C2 /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to