Author: matt
Date: 2011-08-08 05:57:48 -0700 (Mon, 08 Aug 2011)
New Revision: 8931
Log:
Fluid3: sorting and commenting only.

Modified:
   branches/branch-3.0/fluid/file_xcode.cxx

Modified: branches/branch-3.0/fluid/file_xcode.cxx
===================================================================
--- branches/branch-3.0/fluid/file_xcode.cxx    2011-08-08 12:24:54 UTC (rev 
8930)
+++ branches/branch-3.0/fluid/file_xcode.cxx    2011-08-08 12:57:48 UTC (rev 
8931)
@@ -63,8 +63,10 @@
  
  */
 
+
 // ------------ file conversion 
------------------------------------------------
 
+
 extern const char *filename;
 
 
@@ -102,12 +104,109 @@
 }
 
 
-static int writeFileReferences(FILE *out, Fl_Target_Type *tgt) {
+// ------------ file structure 
-------------------------------------------------
 
-  char ProductReference[32]; strcpy(ProductReference, 
tgt->get_UUID_Xcode("Xcode4_ProductReference"));
 
+#if 0
+{
+  archiveVersion = 1;
+  classes = {
+  };
+  objectVersion = 44;
+  objects = {    
+    /* Begin PBXBuildFile section */
+    /* Begin PBXBuildRule section */
+    /* Begin PBXContainerItemProxy section */
+    /* Begin PBXCopyFilesBuildPhase section */
+    /* Begin PBXFileReference section */
+    /* Begin PBXFrameworksBuildPhase section */
+    /* Begin PBXGroup section */
+    /* Begin PBXHeadersBuildPhase section */
+    /* Begin PBXNativeTarget section */
+    /* Begin PBXProject section */
+    /* Begin PBXResourcesBuildPhase section */
+    /* Begin PBXSourcesBuildPhase section */
+    /* Begin PBXTargetDependency section */
+    /* Begin XCBuildConfiguration section */
+    /* Begin XCConfigurationList section */
+  };
+  rootObject = 4BF1A7FFEACF5F31B4127482 /* Project object */;
+}
+#endif
+
+
+// ------------ file writers 
---------------------------------------------------
+
+
+/* Begin PBXBuildFile section */
+
+// This section contains a list of every file that is required to build the 
+// Workspace.
+static int writeBuildFileReferences(FILE *out, Fl_Target_Type *tgt) {
   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)) {
+      char PBXBuildFile[32]; strcpy(PBXBuildFile, 
f->get_UUID_Xcode("Xcode4_PBXBuildFile"));
+      char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
+      fprintf(out, "\t\t%s /* %s in %s */ = {isa = PBXBuildFile; fileRef = %s 
/* %s */; };\n", 
+              PBXBuildFile, 
+              f->filename_name(), 
+              tgt->parent->name(),
+              PBXFileRef, 
+              f->filename_name());
+    }
+  }
+  return 0;
+}
+
+
+/* Begin PBXBuildRule section */
+
+// Create new custom build rules. We currently support .fl files with Fluid.
+static int writeFluidBuildRule(FILE *out, Fl_Target_Type *tgt) {
+  
+  char FluidBuildRule[32]; strcpy(FluidBuildRule, 
tgt->get_UUID_Xcode("Xcode4_FluidBuildRule"));
+  
+  fprintf(out, "\t\t%s /* PBXBuildRule */ = {\n", FluidBuildRule);
+  fprintf(out, "\t\t\tisa = PBXBuildRule;\n");
+  fprintf(out, "\t\t\tcompilerSpec = com.apple.compilers.proxy.script;\n");
+  fprintf(out, "\t\t\tfilePatterns = \"*.fl\";\n");
+  fprintf(out, "\t\t\tfileType = pattern.proxy;\n");
+  fprintf(out, "\t\t\tisEditable = 1;\n");
+  fprintf(out, "\t\t\toutputFiles = (\n");
+  fprintf(out, "\t\t\t\t\"${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.cxx\",\n");
+  fprintf(out, "\t\t\t\t\"${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.h\",\n");
+  fprintf(out, "\t\t\t);\n");
+  fprintf(out, "\t\t\tscript = \"export 
DYLD_FRAMEWORK_PATH=${TARGET_BUILD_DIR} && cd ${INPUT_FILE_DIR} && 
${TARGET_BUILD_DIR}/Fluid.app/Contents/MacOS/Fluid -c ${INPUT_FILE_NAME}\";\n");
+  fprintf(out, "\t\t};\n");
+  
+  return 0;
+}
+
+
+/* Begin PBXContainerItemProxy section */
+
+// TODO: write those
+
+
+/* Begin PBXCopyFilesBuildPhase section */
+
+// TODO: write those
+
+// This section lists all kinds or resourced that will be copied into the 
+// application bundles. Usually, we want to copy the fltk frameworks into the
+// bundle so that users do not need to install FLTK to use and application.
+
+
+/* Begin PBXFileReference section */
+
+// This section describes every file that is referenced or generated.
+static int writeFileReferences(FILE *out, Fl_Target_Type *tgt) {
+  
+  char ProductReference[32]; strcpy(ProductReference, 
tgt->get_UUID_Xcode("Xcode4_ProductReference"));
+  
+  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)) {
       char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
       fprintf(out, "\t\t%s /* %s */ = {isa = PBXFileReference; fileEncoding = 
4; %s; name = %s; path = %s%s; sourceTree = %s; };\n", 
@@ -137,22 +236,28 @@
 }
 
 
-static int writeHeadersBuildPhase(FILE *out, Fl_Target_Type *tgt) {
+/* Begin PBXFrameworksBuildPhase section */
+
+// This section describes the Frameworks that a Target links to. It does not 
+// copy a framework into a target!
+static int writeFrameworksBuildPhase(FILE *out, Fl_Target_Type *tgt) {
   
-  char HeadersBuildPhase[32]; strcpy(HeadersBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_HeadersBuildPhase"));
+  char FrameworksBuildPhase[32]; strcpy(FrameworksBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_FrameworksBuildPhase"));
   
-  fprintf(out, "\t\t%s /* Headers */ = {\n", HeadersBuildPhase);
-  fprintf(out, "\t\t\tisa = PBXHeadersBuildPhase;\n");
+  fprintf(out, "\t\t%s /* Frameworks */ = {\n", FrameworksBuildPhase);
+  fprintf(out, "\t\t\tisa = PBXFrameworksBuildPhase;\n");
   fprintf(out, "\t\t\tbuildActionMask = 2147483647;\n");
   fprintf(out, "\t\t\tfiles = (\n");
   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->file_is_header()) {
+    if (f->builds_in(FL_ENV_XC4) && f->file_is_framework()) {
       char PBXBuildFile[32]; strcpy(PBXBuildFile, 
f->get_UUID_Xcode("Xcode4_PBXBuildFile"));
       fprintf(out, "\t\t\t\t%s /* %s in %s */,\n", 
               PBXBuildFile, 
               f->filename_name(), 
-              "Sources");
+              "Frameworks");
+      // FIXME: C96290C21274D0CF007D3CFE /* Cocoa.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = C9628FFD1274D0B3007D3CFE /* Cocoa.framework */; 
};
+      // FIXME: C9628FFD1274D0B3007D3CFE /* Cocoa.framework */ = {isa = 
PBXFileReference; lastKnownFileType = wrapper.framework; name = 
Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = 
SDKROOT; };
     }
   }
   fprintf(out, "\t\t\t);\n");
@@ -162,17 +267,29 @@
 }
 
 
-static int writeSourcesBuildPhase(FILE *out, Fl_Target_Type *tgt) {
+/* Begin PBXGroup section */
+
+// This section generates the hierarchy of files and folders in the left panel
+// in the Xcode interface.
+
+// TODO: write those
+
+
+/* Begin PBXHeadersBuildPhase section */
+
+// This section lists Headers that will be part of Frameworks. Other Target 
+// types do not need to include any Headers.
+static int writeHeadersBuildPhase(FILE *out, Fl_Target_Type *tgt) {
   
-  char SourcesBuildPhase[32]; strcpy(SourcesBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_SourcesBuildPhase"));
+  char HeadersBuildPhase[32]; strcpy(HeadersBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_HeadersBuildPhase"));
   
-  fprintf(out, "\t\t%s /* Sources */ = {\n", SourcesBuildPhase);
-  fprintf(out, "\t\t\tisa = PBXSourcesBuildPhase;\n");
+  fprintf(out, "\t\t%s /* Headers */ = {\n", HeadersBuildPhase);
+  fprintf(out, "\t\t\tisa = PBXHeadersBuildPhase;\n");
   fprintf(out, "\t\t\tbuildActionMask = 2147483647;\n");
   fprintf(out, "\t\t\tfiles = (\n");
   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->file_is_code()) {
+    if (f->builds_in(FL_ENV_XC4) && f->file_is_header()) {
       char PBXBuildFile[32]; strcpy(PBXBuildFile, 
f->get_UUID_Xcode("Xcode4_PBXBuildFile"));
       fprintf(out, "\t\t\t\t%s /* %s in %s */,\n", 
               PBXBuildFile, 
@@ -187,24 +304,97 @@
 }
 
 
-static int writeFrameworksBuildPhase(FILE *out, Fl_Target_Type *tgt) {
+/* Begin PBXNativeTarget section */
+
+// This section describes every Target in full detail.
+static int writeNativeTarget(FILE *out, Fl_Target_Type *tgt) {
+  // currently we still have a bunch of fixed UUIDs in here!
   
+  char Target[32]; strcpy(Target, tgt->get_UUID_Xcode("Xcode4_Target"));
+  char buildConfigurationList[32]; strcpy(buildConfigurationList, 
tgt->get_UUID_Xcode("Xcode4_BuildConfigurationList"));
+  char ResourcesBuildPhase[32]; strcpy(ResourcesBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_ResourcesBuildPhase"));
+  char HeadersBuildPhase[32]; strcpy(HeadersBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_HeadersBuildPhase"));
+  char SourcesBuildPhase[32]; strcpy(SourcesBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_SourcesBuildPhase"));
   char FrameworksBuildPhase[32]; strcpy(FrameworksBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_FrameworksBuildPhase"));
+  char FluidBuildRule[32]; strcpy(FluidBuildRule, 
tgt->get_UUID_Xcode("Xcode4_FluidBuildRule"));
+  char ProductReference[32]; strcpy(ProductReference, 
tgt->get_UUID_Xcode("Xcode4_ProductReference"));
   
-  fprintf(out, "\t\t%s /* Frameworks */ = {\n", FrameworksBuildPhase);
-  fprintf(out, "\t\t\tisa = PBXFrameworksBuildPhase;\n");
+  fprintf(out, "\t\t%s /* %s */ = {\n",Target ,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\t%s /* Headers */,\n", HeadersBuildPhase);
+  fprintf(out, "\t\t\t\t%s /* Sources */,\n", SourcesBuildPhase);
+  fprintf(out, "\t\t\t\t%s /* Frameworks */,\n", FrameworksBuildPhase);
+  // Relative to developer directory (the Xcode4 way):
+  // C933C2D913EEF82400E12C6E /* Cocoa.framework */ = {isa = PBXFileReference; 
lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = 
SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = 
DEVELOPER_DIR; };
+  // Relative to SDK (the Xcode3 way):
+  // C9628FFD1274D0B3007D3CFE /* Cocoa.framework */ = {isa = PBXFileReference; 
lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = 
System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
+  fprintf(out, "\t\t\t);\n");
+  fprintf(out, "\t\tbuildRules = (\n");
+  fprintf(out, "\t\t\t\t%s /* PBXBuildRule */,\n", FluidBuildRule);
+  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 = %s /* %s.framework */;\n", 
ProductReference, tgt->name()); // FIXME: .framework or .app
+  fprintf(out, "\t\t\tproductType = \"com.apple.product-type.framework\";\n");
+  fprintf(out, "\t\t};\n");
+  
+  return 0;
+}
+
+
+/* Begin PBXProject section */
+
+// This section contains a few basic setting and a list of all targets.
+static int writeProjectTarget(FILE *out, Fl_Target_Type *tgt) {
+  char Target[32]; strcpy(Target, tgt->get_UUID_Xcode("Xcode4_Target"));
+  fprintf(out, "\t\t\t\t%s /* %s */,\n", Target, tgt->name());
+  return 0;
+}
+
+
+/* Begin PBXResourcesBuildPhase section */
+
+// This section writes a list of references to Buil Files of type source.
+// Resources are all files that are not in Sources or Headers (i.e. icons, 
etc.)
+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;
+}
+
+
+/* Begin PBXSourcesBuildPhase section */
+
+// This section writes a list of references to Build Files of type source.
+// This includes .fl files, but not the files that are generated via Fluid.
+static int writeSourcesBuildPhase(FILE *out, Fl_Target_Type *tgt) {
+  
+  // get the required keys
+  char SourcesBuildPhase[32]; strcpy(SourcesBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_SourcesBuildPhase"));
+  
+  // write a list of all source files
+  fprintf(out, "\t\t%s /* Sources */ = {\n", SourcesBuildPhase);
+  fprintf(out, "\t\t\tisa = PBXSourcesBuildPhase;\n");
+  fprintf(out, "\t\t\tbuildActionMask = 2147483647;\n");
+  fprintf(out, "\t\t\tfiles = (\n");
   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->file_is_framework()) {
+    if (f->builds_in(FL_ENV_XC4) && f->file_is_code()) {
       char PBXBuildFile[32]; strcpy(PBXBuildFile, 
f->get_UUID_Xcode("Xcode4_PBXBuildFile"));
       fprintf(out, "\t\t\t\t%s /* %s in %s */,\n", 
               PBXBuildFile, 
               f->filename_name(), 
-              "Frameworks");
-      // FIXME: C96290C21274D0CF007D3CFE /* Cocoa.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = C9628FFD1274D0B3007D3CFE /* Cocoa.framework */; 
};
-      // FIXME: C9628FFD1274D0B3007D3CFE /* Cocoa.framework */ = {isa = 
PBXFileReference; lastKnownFileType = wrapper.framework; name = 
Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = 
SDKROOT; };
+              f->parent->name());
     }
   }
   fprintf(out, "\t\t\t);\n");
@@ -214,7 +404,22 @@
 }
 
 
-static int writeBuildConfigurations(FILE *out, const char *debugKey, const 
char *releaseKey, const char *productName) {
+/* Begin PBXTargetDependency section */
+
+// TODO: write those
+
+
+/* Begin XCBuildConfiguration section */
+
+// This section is referenced by the Build Configuration Lists. It directly
+// writes compiler and linker flags and other settings.
+//  - we currently support just one standard settting for Debug and Release
+static int writeBuildConfigurations(FILE *out, Fl_Target_Type *tgt) {
+  
+  // get the required keys
+  char debugKey[32]; strcpy(debugKey, 
tgt->get_UUID_Xcode("Xcode4_DebugBuildConfiguration"));
+  char releaseKey[32]; strcpy(releaseKey, 
tgt->get_UUID_Xcode("Xcode4_ReleaseBuildConfiguration"));
+
   // Write the Debug Build Configuration
   fprintf(out, "\t\t%s /* Debug */ = {\n", debugKey);
   fprintf(out, "\t\t\tisa = XCBuildConfiguration;\n");
@@ -242,7 +447,7 @@
   fprintf(out, "\t\t\t\tINFOPLIST_FILE = \"plists/fltk-Info.plist\";\n");
   fprintf(out, "\t\t\t\tINSTALL_PATH = \"@executable_path/../Frameworks\";\n");
   fprintf(out, "\t\t\t\tOTHER_LDFLAGS = \"\";\n");
-  fprintf(out, "\t\t\t\tPRODUCT_NAME = \"%s\";\n", productName);
+  fprintf(out, "\t\t\t\tPRODUCT_NAME = \"%s\";\n", tgt->name());
   fprintf(out, "\t\t\t\tSDKROOT = macosx;\n");
   fprintf(out, "\t\t\t\tWARNING_CFLAGS = (\n");
   fprintf(out, "\t\t\t\t\t\"-Wno-format-security\",\n");
@@ -278,7 +483,7 @@
   fprintf(out, "\t\t\t\tINFOPLIST_FILE = \"plists/fltk-Info.plist\";\n");
   fprintf(out, "\t\t\t\tINSTALL_PATH = \"@executable_path/../Frameworks\";\n");
   fprintf(out, "\t\t\t\tOTHER_LDFLAGS = \"\";\n");
-  fprintf(out, "\t\t\t\tPRODUCT_NAME = \"%s\";\n", productName);
+  fprintf(out, "\t\t\t\tPRODUCT_NAME = \"%s\";\n", tgt->name());
   fprintf(out, "\t\t\t\tSDKROOT = macosx;\n");
   fprintf(out, "\t\t\t\tWARNING_CFLAGS = (\n");
   fprintf(out, "\t\t\t\t\t\"-Wno-format-security\",\n");
@@ -288,13 +493,25 @@
   fprintf(out, "\t\t\t};\n");
   fprintf(out, "\t\t\tname = Release;\n");
   fprintf(out, "\t\t};\n");
-
+  
   return 0;
 }
 
 
-static int writeBuildConfigurationList(FILE *out, const char *listKey, const 
char *debugKey, const char *releaseKey, const char *productName) {
-  fprintf(out, "\t\t%s /* Build configuration list for PBXNativeTarget \"%s\" 
*/ = {\n", listKey, productName);
+/* Begin XCConfigurationList section */
+
+// Write the section that is references from the Native Target and lists
+// all possible build configurations.
+//  - we currently limit this to the default Debug and Release build.
+static int writeBuildConfigurationList(FILE *out, Fl_Target_Type *tgt) {
+  
+  // get the required keys
+  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"));
+  
+  // write the section for this target
+  fprintf(out, "\t\t%s /* Build configuration list for PBXNativeTarget \"%s\" 
*/ = {\n", listKey, tgt->name());
   fprintf(out, "\t\t\tisa = XCConfigurationList;\n");
   fprintf(out, "\t\t\tbuildConfigurations = (\n");
   fprintf(out, "\t\t\t\t%s /* Debug */,\n", debugKey);
@@ -307,85 +524,10 @@
 }
 
 
-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;
-}
 
+// ------------ file writers 
dispatch-------------------------------------------
 
-static int writeNativeTarget(FILE *out, Fl_Target_Type *tgt) {
-  // currently we still have a bunch of fixed UUIDs in here!
 
-  char Target[32]; strcpy(Target, tgt->get_UUID_Xcode("Xcode4_Target"));
-  char buildConfigurationList[32]; strcpy(buildConfigurationList, 
tgt->get_UUID_Xcode("Xcode4_BuildConfigurationList"));
-  char ResourcesBuildPhase[32]; strcpy(ResourcesBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_ResourcesBuildPhase"));
-  char HeadersBuildPhase[32]; strcpy(HeadersBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_HeadersBuildPhase"));
-  char SourcesBuildPhase[32]; strcpy(SourcesBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_SourcesBuildPhase"));
-  char FrameworksBuildPhase[32]; strcpy(FrameworksBuildPhase, 
tgt->get_UUID_Xcode("Xcode4_FrameworksBuildPhase"));
-  char FluidBuildRule[32]; strcpy(FluidBuildRule, 
tgt->get_UUID_Xcode("Xcode4_FluidBuildRule"));
-  char ProductReference[32]; strcpy(ProductReference, 
tgt->get_UUID_Xcode("Xcode4_ProductReference"));
-
-  fprintf(out, "\t\t%s /* %s */ = {\n",Target ,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\t%s /* Headers */,\n", HeadersBuildPhase);
-  fprintf(out, "\t\t\t\t%s /* Sources */,\n", SourcesBuildPhase);
-  fprintf(out, "\t\t\t\t%s /* Frameworks */,\n", FrameworksBuildPhase);
-  // Relative to developer directory (the Xcode4 way):
-  // C933C2D913EEF82400E12C6E /* Cocoa.framework */ = {isa = PBXFileReference; 
lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = 
SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = 
DEVELOPER_DIR; };
-  // Relative to SDK (the Xcode3 way):
-  // C9628FFD1274D0B3007D3CFE /* Cocoa.framework */ = {isa = PBXFileReference; 
lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = 
System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
-  fprintf(out, "\t\t\t);\n");
-  fprintf(out, "\t\tbuildRules = (\n");
-  fprintf(out, "\t\t\t\t%s /* PBXBuildRule */,\n", FluidBuildRule);
-  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 = %s /* %s.framework */;\n", 
ProductReference, tgt->name()); // FIXME: .framework or .app
-  fprintf(out, "\t\t\tproductType = \"com.apple.product-type.framework\";\n");
-  fprintf(out, "\t\t};\n");
-  
-  return 0;
-}
-
-
-static int writeFluidBuildRule(FILE *out, Fl_Target_Type *tgt) {
-  
-  char FluidBuildRule[32]; strcpy(FluidBuildRule, 
tgt->get_UUID_Xcode("Xcode4_FluidBuildRule"));
-  
-  fprintf(out, "\t\t%s /* PBXBuildRule */ = {\n", FluidBuildRule);
-  fprintf(out, "\t\t\tisa = PBXBuildRule;\n");
-  fprintf(out, "\t\t\tcompilerSpec = com.apple.compilers.proxy.script;\n");
-  fprintf(out, "\t\t\tfilePatterns = \"*.fl\";\n");
-  fprintf(out, "\t\t\tfileType = pattern.proxy;\n");
-  fprintf(out, "\t\t\tisEditable = 1;\n");
-  fprintf(out, "\t\t\toutputFiles = (\n");
-  fprintf(out, "\t\t\t\t\"${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.cxx\",\n");
-  fprintf(out, "\t\t\t\t\"${INPUT_FILE_DIR}/${INPUT_FILE_BASE}.h\",\n");
-  fprintf(out, "\t\t\t);\n");
-  fprintf(out, "\t\t\tscript = \"export 
DYLD_FRAMEWORK_PATH=${TARGET_BUILD_DIR} && cd ${INPUT_FILE_DIR} && 
${TARGET_BUILD_DIR}/Fluid.app/Contents/MacOS/Fluid -c ${INPUT_FILE_NAME}\";\n");
-  fprintf(out, "\t\t};\n");
-
-  return 0;
-}
-
-
-static int writeProjectTarget(FILE *out, Fl_Target_Type *tgt) {
-  char Target[32]; strcpy(Target, tgt->get_UUID_Xcode("Xcode4_Target"));
-  fprintf(out, "\t\t\t\t%s /* %s */,\n", Target, tgt->name());
-  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.
@@ -434,20 +576,8 @@
           strcpy(tgt_base, base_dir);
           hash = strchr(hash, ';')+1;
       } else if (strncmp(hash, "#BuildFileReferences(", 21)==0) {
-          Fl_Type *tgt = Fl_Target_Type::find(hash+21, ')'); // keep tgt local
-          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)) {
-              char PBXBuildFile[32]; strcpy(PBXBuildFile, 
f->get_UUID_Xcode("Xcode4_PBXBuildFile"));
-              char PBXFileRef[32]; strcpy(PBXFileRef, 
f->get_UUID_Xcode("Xcode4_PBXFileRef"));
-              fprintf(out, "\t\t%s /* %s in %s */ = {isa = PBXBuildFile; 
fileRef = %s /* %s */; };\n", 
-                      PBXBuildFile, 
-                      f->filename_name(), 
-                      "Sources",  // FIXME: use group name!
-                      PBXFileRef, 
-                      f->filename_name());
-            }
-          }
+          Fl_Target_Type *tgt = Fl_Target_Type::find(hash+21, ')'); // keep 
tgt local
+          writeBuildFileReferences(out, tgt);
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#FileReferences(", 16)==0) {
           Fl_Target_Type *tgt = Fl_Target_Type::find(hash+16, ')');
@@ -512,16 +642,11 @@
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#BuildConfigurations(", 21)==0) {
           Fl_Target_Type *tgt = Fl_Target_Type::find(hash+21, ')');
-          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());
+          writeBuildConfigurations(out, tgt);
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#BuildConfigurationList(", 24)==0) {
           Fl_Target_Type *tgt = Fl_Target_Type::find(hash+24, ')');
-          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());
+          writeBuildConfigurationList(out, tgt);
           hash = strchr(hash, ';')+1;
         } else if (strncmp(hash, "#ResourcesBuildPhase(", 21)==0) {
           Fl_Target_Type *tgt = Fl_Target_Type::find(hash+21, ')');
@@ -545,26 +670,6 @@
           writeProjectTarget(out, tgt);
           hash = strchr(hash, ';')+1;
         } else {
-#if 0
-          fltk.framework starts here: A57FDE871C99A52BEEDEE68C
-          
-          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
-              -Resources build phase (ResourcesBuildPhase) = 
6715D162BEFF87372B2A31E0 (can reference files (BuildFile))
-              -Headers build phase (HeadersBuildPhas) = 
C9EDD5C81274C6BA00ADB21C (can reference files (BuildFile))
-              -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)
-              -buildRules (BuildRule) = EFFAAB905A54B0BFE13CB56C (Fluid build 
rule, no more references)
-              -productReference = FEB0F8FE6383384180570D94 (-> FileReference, 
is also referenced in "Products")
-          
-          Also still missing are dependencies, like this one: 
A8AB7DEC3970D5A693D2BC84 and dependency proxies (uuuaaaahh!)
-#endif
           printf("Unknown command in template: <<%s>>\n", hash);
           copyLine = 1;
           hash++;

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

Reply via email to