summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2010-02-18 13:05:02 +0000
committerMatthias Melcher <fltk@matthiasm.com>2010-02-18 13:05:02 +0000
commit0f45c3e5ac23c2cbf13b1e7d04c27251309da8e0 (patch)
tree50993901502d59c586750152907761f78bbe25d8 /fluid
parent6cef760c1bad040c8b33c59062b116e71b7672d1 (diff)
IDE support file generation from within Fluid. These files are not yet linked in - simply add them to the Fluid project for testing (uses Fl_Plugin to link themselves in atomatically).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7094 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid')
-rw-r--r--fluid/ide_support.cxx640
-rw-r--r--fluid/ide_support.h101
-rw-r--r--fluid/ide_xcode.cxx1389
3 files changed, 2130 insertions, 0 deletions
diff --git a/fluid/ide_support.cxx b/fluid/ide_support.cxx
new file mode 100644
index 000000000..178c5d7fa
--- /dev/null
+++ b/fluid/ide_support.cxx
@@ -0,0 +1,640 @@
+//
+// "$Id: ide_support.cxx 6981 2009-12-25 20:53:22Z matt $"
+//
+// IDE and Build File generation for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 2010 by Matthias Melcher.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+/*
+ IDE SUPPORT IN FLUID
+
+ One of the biggest issues in maintaining FLTK has been the maintenance of build
+ environments. Users are confused when new features of FLTK ar not available
+ yet for their platform, and may never be unless a volunteer updates and
+ maintains the corresponding IDE support.
+
+ "ide support" will generate sets of IDE files for all supported build
+ environments, including Makefiles and CMake. Ading a new source file to the
+ FLTK build tree is as easy as adding the file to the database and
+ running Fluid.
+
+ This module will give Fluid the power to create a database for FLTK based
+ projects. By linking further IDE support modules, the database can be used
+ to create IDE build files for many platforms, compilers, and development
+ environments.
+
+ This module creates a database specifically for the FLTK project itself. A
+ user interface shold be created to create databases for arbitrary projects.
+
+ > fluid -fltkdb <filename> # creates the fltk database
+
+
+ DATABASE FORMAT
+
+ The database is constructed using Fl_Preferences. Objects in the database are
+ defined by using a UUID as the group name. References to objects are done using
+ the same UUID as a value. The mandatory structure is defined in the first block
+ below. When writing IDE files, additional optional key/value pairs may be
+ generated. Their key should be marked by a unique prefix.
+
+ Standard database format:
+
+ /projectName: # name of the project (FLTK)
+
+ /ide/ # contains IDE specific data
+ /targets/ # contains various groups for differen target types
+ /./libs/ # targets that will be buildt as libraries
+ /././UUID/ # [multiple] description of a library target
+ /./././sources/ # all source files required to build the library
+ /././././UUID/ # [multiple] description of this dependency
+ /./././././refUUID: # reference to file definitin in /files/
+ /./././libs/ # all libraries required to build the library
+ /././././.... # see /targets/libs/UUID/sources/...
+ /./././fluid/ # all Fluid UI defs required to build the library
+ /././././.... # see /targets/libs/UUID/sources/...
+ /./././externals/ # all external libraries required to build the library
+ /././././.... # see /targets/libs/UUID/sources/...
+ /./././deps/ # all dependencies on other targets in this project
+ /././././.... # see /targets/libs/UUID/sources/...
+ /./apps/ # full blown applications
+ /././UUID/ # [multiple] description of a application target
+ /./././... # see /targets/libs/UUID/...
+ /./tests/ # smaller test applications
+ /././UUID/ # [multiple] description of a test app target
+ /./././... # see /targets/libs/UUID/...
+ /files/ # more information on al referenced files
+ /./UUID/ # [multiple] description of a file
+ /././pathAndName: # path and file name relative to the archive root
+
+ Xcode3 IDE FILES: see ide_xcode.cxx
+
+ VISUALC 2005 IDE FILES: not yet implemented
+
+ VISUALC 2008 IDE FILES: not yet implemented
+
+ VISUALC 2010 IDE FILES: not yet implemented
+
+ CMAKE FILES: not yet implemented
+
+ MAKEFILE SYSTEM: not yet implemented
+
+ others: not yet implemented
+
+ */
+
+#include "ide_support.h"
+
+#include <FL/Fl.H>
+#include <FL/fl_ask.h>
+#include <FL/Fl_Widget.H>
+#include <FL/filename.h>
+
+#include "Fl_Type.h"
+
+/*
+ * Read a UUID from a database entry. If none exists, create one in the database.
+ */
+void getUUID(Fl_Preferences &db, const char *key, char *buffer) {
+ db.get(key, buffer, "", 37);
+ if (buffer[0]==0) {
+ strcpy(buffer, Fl_Preferences::newUUID());
+ db.set(key, buffer);
+ }
+}
+
+/*
+ * Read an Xcode ID from a database entry. If none exists, create one in the database.
+ * The Xcode ID contains 24 bytes of hexadecimal chracters.
+ */
+void getXCID(Fl_Preferences &db, const char *key, char *buffer) {
+ db.get(key, buffer, "", 25);
+ if (buffer[0]==0) {
+ const char *uuid = Fl_Preferences::newUUID();
+ // A UUID comes in blocks of 8, 4, 4, 4, and 12 characters
+ unsigned int i0, i1, i2, i3, i4, i5;
+ sscanf(uuid, "%8x-%4x-%4x-%4x-%4x%8x", &i0, &i1, &i2, &i3, &i4, &i5);
+ sprintf(buffer, "%8.8X%4.4X%4.4X%8.8X", i0, i1^i2, i3^i4, i5);
+ db.set(key, buffer);
+ }
+}
+
+/* A preferences node with some additional functionality */
+Fl_IDE_Prefs::Fl_IDE_Prefs(Fl_Preferences &parent, const char *name)
+: Fl_Preferences(parent, name) {
+}
+
+Fl_IDE_Prefs::Fl_IDE_Prefs(Fl_Preferences &parent, int ix)
+: Fl_Preferences(parent, ix) {
+}
+
+Fl_IDE_Prefs::Fl_IDE_Prefs(Fl_Preferences::ID id)
+: Fl_Preferences(id) {
+}
+
+Fl_Preferences::ID Fl_IDE_Prefs::find_by_name(const char *name) {
+ int i, n = groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences p(this, i);
+ if (strcmp(name, p.name())==0) return p.id();
+ }
+ return 0;
+}
+
+Fl_Preferences::ID Fl_IDE_Prefs::find_by_key(const char *key, const char *value) {
+ int i, n = groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences p(this, i);
+ char *v;
+ p.get(key, v, "");
+ if (strcmp(value, v)==0) { free(v); return p.id(); }
+ free(v);
+ }
+ return 0;
+}
+
+Fl_Preferences::ID Fl_IDE_Prefs::add_with_key(const char *key, const char *value, const char *uuid) {
+ Fl_Preferences::ID ret = find_by_key(key, value);
+ if (!ret) {
+ if (!uuid) uuid = Fl_Preferences::newUUID();
+ Fl_Preferences p(this, uuid);
+ p.set(key, value);
+ ret = p.id();
+ }
+ return ret;
+}
+
+
+Fl_Target_Prefs::Fl_Target_Prefs(Fl_Preferences::ID id)
+: Fl_IDE_Prefs(id) {
+}
+
+Fl_Preferences::ID Fl_Target_Prefs::add_source(Fl_IDE_Prefs &fdb, const char *pathAndName) {
+ Fl_IDE_Prefs file(fdb.add_with_key("pathAndName", pathAndName));
+ Fl_IDE_Prefs p(*this, "sources");
+ p.add_with_key("refUUID", file.name());
+}
+
+Fl_Preferences::ID Fl_Target_Prefs::add_fl(Fl_IDE_Prefs &fdb, const char *pathAndName) {
+ Fl_IDE_Prefs file(fdb.add_with_key("pathAndName", pathAndName));
+ Fl_IDE_Prefs p(*this, "fl");
+ p.add_with_key("refUUID", file.name());
+}
+
+Fl_Preferences::ID Fl_Target_Prefs::depends_on(Fl_IDE_Prefs &dep) {
+ Fl_IDE_Prefs p(*this, "deps");
+ Fl_Preferences d(p.add_with_key("refUUID", dep.name()));
+}
+
+Fl_Preferences::ID Fl_Target_Prefs::add_lib(Fl_IDE_Prefs &lib) {
+ Fl_IDE_Prefs p(*this, "libs");
+ p.add_with_key("refUUID", lib.name());
+ this->depends_on(lib);
+}
+
+
+Fl_File_Prefs::Fl_File_Prefs(Fl_Preferences &parent, const char *name)
+: Fl_Preferences(parent, name) {
+}
+
+Fl_File_Prefs::Fl_File_Prefs(Fl_Preferences &parent, int ix)
+: Fl_Preferences(parent, ix) {
+}
+
+Fl_File_Prefs::Fl_File_Prefs(Fl_Preferences::ID id)
+: Fl_Preferences(id) {
+}
+
+const char *Fl_File_Prefs::filePath() {
+ char pan[1024]; get("pathAndName", pan, "DBERROR/DBERROR.DBERR", 1024);
+ strcpy(pPath, pan);
+ char *name = (char*)fl_filename_name(pPath);
+ if (name) *name = 0;
+ return pPath;
+}
+
+const char *Fl_File_Prefs::fileName() {
+ char pan[1024]; get("pathAndName", pan, "DBERROR/DBERROR.DBERR", 1024);
+ char *name = (char*)fl_filename_name(pan);
+ if (name) {
+ strcpy(pName, name);
+ } else {
+ strcpy(pName, pan);
+ }
+ char *ext = (char*)fl_filename_ext(pName);
+ if (ext) *ext = 0;
+ return pName;
+}
+
+const char *Fl_File_Prefs::fullName() {
+ char pan[1024]; get("pathAndName", pan, "DBERROR/DBERROR.DBERR", 1024);
+ char *name = (char*)fl_filename_name(pan);
+ if (name) {
+ strcpy(pFullName, name);
+ } else {
+ strcpy(pFullName, pan);
+ }
+ return pFullName;
+}
+
+const char *Fl_File_Prefs::fileExt() {
+ char pan[1024]; get("pathAndName", pan, "DBERROR/DBERROR.DBERR", 1024);
+ char *ext = (char*)fl_filename_ext(pan);
+ if (ext) strcpy(pExt, ext);
+ else pExt[0] = 0;
+ return pExt;
+}
+
+//==============================================================================
+
+// TODO: Find a good standard position for the database
+// for testing, we used "/Users/matt/dev/fltk-1.3.0/fltk.db"
+
+int create_new_database(const char *filename)
+{
+ Fl_Preferences *db = new Fl_Preferences(filename, "fltk.org", 0);
+ db->clear();
+
+ db->set("projectName", "FLTK");
+
+ Fl_Preferences targets_db(db, "targets");
+ Fl_IDE_Prefs files_db(*db, "files");
+
+ // --- create libraries
+ Fl_IDE_Prefs libs_db(targets_db, "libs");
+
+ Fl_Target_Prefs fltk_lib(libs_db.add_with_key("name", "fltk")); {
+ fltk_lib.add_source(files_db, "src/Fl.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_get_system_colors.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_get_key.cxx");
+ fltk_lib.add_source(files_db, "src/fl_font.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_File_Input.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_File_Icon.cxx");
+ fltk_lib.add_source(files_db, "src/fl_file_dir.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_File_Chooser2.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_File_Chooser.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_File_Browser.cxx");
+ fltk_lib.add_source(files_db, "src/fl_engraved_label.cxx");
+ fltk_lib.add_source(files_db, "src/fl_encoding_mac_roman.cxx");
+ fltk_lib.add_source(files_db, "src/fl_draw_pixmap.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Check_Button.cxx");
+ fltk_lib.add_source(files_db, "src/fl_dnd.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_display.cxx");
+ fltk_lib.add_source(files_db, "src/fl_diamond_box.cxx");
+ fltk_lib.add_source(files_db, "src/fl_set_fonts.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Window_fullscreen.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Window.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Widget.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_visual.cxx");
+ fltk_lib.add_source(files_db, "src/fl_vertex.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Round_Button.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Tooltip.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Window_iconize.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Window_hotspot.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Text_Display.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Scroll.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Choice.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Group.cxx");
+ fltk_lib.add_source(files_db, "src/fl_rounded_box.cxx");
+ fltk_lib.add_source(files_db, "src/fl_overlay_visual.cxx");
+ fltk_lib.add_source(files_db, "src/fl_shortcut.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Shared_Image.cxx");
+ fltk_lib.add_source(files_db, "src/flstring.c");
+ fltk_lib.add_source(files_db, "src/Fl_grab.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_arg.cxx");
+ fltk_lib.add_source(files_db, "src/cmap.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_XPM_Image.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Image.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Input.cxx");
+ fltk_lib.add_source(files_db, "src/fl_scroll_area.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Tiled_Image.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Tile.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Text_Editor.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Overlay_Window.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_own_colormap.cxx");
+ fltk_lib.add_source(files_db, "src/filename_expand.cxx");
+ fltk_lib.add_source(files_db, "src/filename_absolute.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Menu_.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Menu.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Multi_Label.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Menu_Window.cxx");
+ fltk_lib.add_source(files_db, "src/Fl.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Dial.cxx");
+ fltk_lib.add_source(files_db, "src/fl_curve.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Menu_global.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Menu_Button.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Menu_Bar.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Menu_add.cxx");
+ fltk_lib.add_source(files_db, "src/filename_list.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Browser.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Value_Input.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Valuator.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Button.cxx");
+ fltk_lib.add_source(files_db, "src/fl_read_image.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Progress.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Preferences.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Positioner.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Sys_Menu_Bar.cxx");
+ fltk_lib.add_source(files_db, "src/fl_symbols.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Light_Button.cxx");
+ fltk_lib.add_source(files_db, "src/fl_labeltype.cxx");
+ fltk_lib.add_source(files_db, "src/fl_draw.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Double_Window.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_XBM_Image.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_x.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Wizard.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Help_View.cxx");
+ fltk_lib.add_source(files_db, "src/fl_open_uri.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Input_.cxx");
+ fltk_lib.add_source(files_db, "src/fl_line_style.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Adjuster.cxx");
+ fltk_lib.add_source(files_db, "src/fl_rect.cxx");
+ fltk_lib.add_source(files_db, "src/fl_arc.cxx");
+ fltk_lib.add_source(files_db, "src/filename_ext.cxx");
+ fltk_lib.add_source(files_db, "src/fl_set_font.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Scrollbar.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_abort.cxx");
+ fltk_lib.add_source(files_db, "src/fl_overlay.cxx");
+ fltk_lib.add_source(files_db, "src/fl_oval_box.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Text_Buffer.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Tabs.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_lock.cxx");
+ fltk_lib.add_source(files_db, "src/fl_cursor.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Counter.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Check_Browser.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Bitmap.cxx");
+ fltk_lib.add_source(files_db, "src/filename_isdir.cxx");
+ fltk_lib.add_source(files_db, "src/filename_match.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Slider.cxx");
+ fltk_lib.add_source(files_db, "src/fl_draw_image.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Browser_load.cxx");
+ fltk_lib.add_source(files_db, "src/fl_round_box.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Roller.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Return_Button.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Repeat_Button.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_add_idle.cxx");
+ fltk_lib.add_source(files_db, "src/fl_plastic.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Pixmap.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Pack.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Browser_.cxx");
+ fltk_lib.add_source(files_db, "src/scandir.c");
+ fltk_lib.add_source(files_db, "src/numericsort.c");
+ fltk_lib.add_source(files_db, "src/Fl_Box.cxx");
+ fltk_lib.add_source(files_db, "src/fl_call_main.c");
+ fltk_lib.add_source(files_db, "src/vsnprintf.c");
+ fltk_lib.add_source(files_db, "src/screen_xywh.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Single_Window.cxx");
+ fltk_lib.add_source(files_db, "src/fl_show_colormap.cxx");
+ fltk_lib.add_source(files_db, "src/fl_encoding_latin1.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Chart.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Value_Slider.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Value_Output.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Color_Chooser.cxx");
+ fltk_lib.add_source(files_db, "src/fl_color.cxx");
+ fltk_lib.add_source(files_db, "src/fl_arci.cxx");
+ fltk_lib.add_source(files_db, "src/filename_setext.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Clock.cxx");
+ fltk_lib.add_source(files_db, "src/fl_ask.cxx");
+ fltk_lib.add_source(files_db, "src/fl_boxtype.cxx");
+ fltk_lib.add_source(files_db, "src/fl_gtk.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_compose.cxx");
+ fltk_lib.add_source(files_db, "src/fl_shadow_box.cxx");
+ fltk_lib.add_source(files_db, "src/fl_utf.c");
+ fltk_lib.add_source(files_db, "src/fl_utf8.cxx");
+ fltk_lib.add_source(files_db, "src/xutf8/case.c");
+ fltk_lib.add_source(files_db, "src/xutf8/is_right2left.c");
+ fltk_lib.add_source(files_db, "src/xutf8/is_spacing.c");
+ fltk_lib.add_source(files_db, "src/Fl_Table_Row.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Table.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Tree_Item_Array.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Tree_Item.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Tree_Prefs.cxx");
+ fltk_lib.add_source(files_db, "src/Fl_Tree.cxx");
+ }
+ Fl_Target_Prefs fltk_forms_lib(libs_db.add_with_key("name", "fltk_forms")); {
+ fltk_forms_lib.add_source(files_db, "src/forms_bitmap.cxx");
+ fltk_forms_lib.add_source(files_db, "src/forms_compatability.cxx");
+ fltk_forms_lib.add_source(files_db, "src/forms_free.cxx");
+ fltk_forms_lib.add_source(files_db, "src/forms_fselect.cxx");
+ fltk_forms_lib.add_source(files_db, "src/forms_pixmap.cxx");
+ fltk_forms_lib.add_source(files_db, "src/forms_timer.cxx");
+ fltk_forms_lib.add_lib(fltk_lib);
+ }
+ Fl_Target_Prefs fltk_images_lib(libs_db.add_with_key("name", "fltk_images")); {
+ fltk_images_lib.add_source(files_db, "src/fl_images_core.cxx");
+ fltk_images_lib.add_source(files_db, "src/Fl_BMP_Image.cxx");
+ fltk_images_lib.add_source(files_db, "src/Fl_File_Icon2.cxx");
+ fltk_images_lib.add_source(files_db, "src/Fl_GIF_Image.cxx");
+ fltk_images_lib.add_source(files_db, "src/Fl_Help_Dialog.cxx");
+ fltk_images_lib.add_source(files_db, "src/Fl_JPEG_Image.cxx");
+ fltk_images_lib.add_source(files_db, "src/Fl_PNG_Image.cxx");
+ fltk_images_lib.add_source(files_db, "src/Fl_PNM_Image.cxx");
+ fltk_images_lib.add_lib(fltk_lib);
+ }
+ Fl_Target_Prefs fltk_gl_lib(libs_db.add_with_key("name", "fltk_gl")); {
+ fltk_gl_lib.add_source(files_db, "src/Fl_Gl_Choice.cxx");
+ fltk_gl_lib.add_source(files_db, "src/Fl_Gl_Overlay.cxx");
+ fltk_gl_lib.add_source(files_db, "src/Fl_Gl_Window.cxx");
+ fltk_gl_lib.add_source(files_db, "src/gl_draw.cxx");
+ fltk_gl_lib.add_source(files_db, "src/freeglut_stroke_roman.cxx");
+ fltk_gl_lib.add_source(files_db, "src/freeglut_teapot.cxx");
+ fltk_gl_lib.add_source(files_db, "src/freeglut_geometry.cxx");
+ fltk_gl_lib.add_source(files_db, "src/glut_font.cxx");
+ fltk_gl_lib.add_source(files_db, "src/freeglut_stroke_mono_roman.cxx");
+ fltk_gl_lib.add_source(files_db, "src/glut_compatability.cxx");
+ fltk_gl_lib.add_lib(fltk_lib);
+ }
+ Fl_Target_Prefs fltk_png_lib(libs_db.add_with_key("name", "fltk_png")); {
+ fltk_png_lib.add_source(files_db, "png/pngmem.c");
+ fltk_png_lib.add_source(files_db, "png/png.c");
+ fltk_png_lib.add_source(files_db, "png/pngwio.c");
+ fltk_png_lib.add_source(files_db, "png/pngwtran.c");
+ fltk_png_lib.add_source(files_db, "png/pngset.c");
+ fltk_png_lib.add_source(files_db, "png/pngwutil.c");
+ fltk_png_lib.add_source(files_db, "png/pngwrite.c");
+ fltk_png_lib.add_source(files_db, "png/pngrio.c");
+ fltk_png_lib.add_source(files_db, "png/pngget.c");
+ fltk_png_lib.add_source(files_db, "png/pngerror.c");
+ fltk_png_lib.add_source(files_db, "png/pngtrans.c");
+ fltk_png_lib.add_source(files_db, "png/pngread.c");
+ fltk_png_lib.add_source(files_db, "png/pngrutil.c");
+ fltk_png_lib.add_source(files_db, "png/pngpread.c");
+ fltk_png_lib.add_source(files_db, "png/pngrtran.c");
+ fltk_images_lib.add_lib(fltk_png_lib);
+ }
+ Fl_Target_Prefs fltk_jpeg_lib(libs_db.add_with_key("name", "fltk_jpeg")); {
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jidctflt.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jfdctint.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcmarker.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdhuff.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdatasrc.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jerror.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jidctred.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcomapi.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jfdctfst.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jfdctflt.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jutils.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jquant2.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jquant1.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcphuff.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdpostct.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdphuff.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdmarker.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdmaster.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdatadst.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jidctint.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jidctfst.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdapimin.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jccolor.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdapistd.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcmainct.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdmerge.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jddctmgr.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdtrans.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdsample.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jmemnobs.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jmemmgr.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdinput.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdmainct.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcinit.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jccoefct.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcapistd.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdcolor.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcsample.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcdctmgr.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcmaster.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcapimin.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jdcoefct.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcparam.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jchuff.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jcprepct.c");
+ fltk_jpeg_lib.add_source(files_db, "jpeg/jctrans.c");
+ fltk_images_lib.add_lib(fltk_jpeg_lib);
+ }
+
+ // --- create applications
+ Fl_IDE_Prefs apps_db(targets_db, "apps");
+
+ Fl_Target_Prefs fluid_app(apps_db.add_with_key("name", "Fluid")); {
+ fluid_app.add_source(files_db, "fluid/alignment_panel.cxx");
+ fluid_app.add_source(files_db, "fluid/Fluid_Image.cxx");
+ fluid_app.add_source(files_db, "fluid/fluid.cxx");
+ fluid_app.add_source(files_db, "fluid/code.cxx");
+ fluid_app.add_source(files_db, "fluid/template_panel.cxx");
+ fluid_app.add_source(files_db, "fluid/Fl_Window_Type.cxx");
+ fluid_app.add_source(files_db, "fluid/print_panel.cxx");
+ fluid_app.add_source(files_db, "fluid/file.cxx");
+ fluid_app.add_source(files_db, "fluid/Fl_Function_Type.cxx");
+ fluid_app.add_source(files_db, "fluid/Fl_Menu_Type.cxx");
+ fluid_app.add_source(files_db, "fluid/function_panel.cxx");
+ fluid_app.add_source(files_db, "fluid/align_widget.cxx");
+ fluid_app.add_source(files_db, "fluid/factory.cxx");
+ fluid_app.add_source(files_db, "fluid/Fl_Type.cxx");
+ fluid_app.add_source(files_db, "fluid/Fl_Widget_Type.cxx");
+ fluid_app.add_source(files_db, "fluid/ide_support.cxx");
+ fluid_app.add_source(files_db, "fluid/CodeEditor.cxx");
+ fluid_app.add_source(files_db, "fluid/undo.cxx");
+ fluid_app.add_source(files_db, "fluid/Fl_Group_Type.cxx");
+ fluid_app.add_source(files_db, "fluid/about_panel.cxx");
+ fluid_app.add_source(files_db, "fluid/widget_panel.cxx");
+ fluid_app.add_lib(fltk_lib);
+ }
+
+ // --- create test applications
+ Fl_IDE_Prefs tests_db(targets_db, "tests");
+
+#if 0
+ Fl_Target_Prefs demo_db(tests_db.add_with_key("name", "xDemo")); {
+ demo_db.add_source(files_db, "test/demo.cxx");
+ demo_db.add_lib(fltk_lib);
+ }
+
+ { Fl_Target_Prefs db(tests_db.add_with_key("name", "matt"));
+ db.add_source(files_db, "test/matt.cxx");
+ db.add_lib(fltk_lib);
+ // --- Dependency on Fluid files - does not imply matt_ui.cxx and .h!
+ //ab.add_fl("test/matt_ui.fl")
+ // --- This looks silly. Should we have predefined library sets (db.add_sound_libs())
+ //db.add_external_OSX("audio.framework");
+ //db.add_external_UX("libaudio.so");
+ //db.add_external_MSWIN("directsound.dll");
+ // --- Create dependencies. Library dependencies are implied?!
+ //demo_db.depends_on(db);
+ }
+ { Fl_Target_Prefs db(tests_db.add_with_key("name", "moop"));
+ db.add_source(files_db, "test/hello.cxx");
+ db.add_lib(fltk_lib);
+ demo_db.depends_on(db);
+ }
+#endif
+
+ { Fl_Target_Prefs db(tests_db.add_with_key("name", "adjuster"));
+ db.add_source(files_db, "test/adjuster.cxx");
+ db.add_lib(fltk_lib);
+ //demo_db.depends_on(db);
+ }
+
+ { Fl_Target_Prefs db(tests_db.add_with_key("name", "valuator"));
+ db.add_fl(files_db, "test/valuator.fl");
+ db.add_lib(fltk_lib);
+ //demo_db.depends_on(db);
+ }
+
+ // TODO: add all test apps here
+
+ db->flush();
+}
+
+
+// Make this module into a plugin
+
+extern int exit_early;
+
+class Fl_FltkDB_Plugin : public Fl_Commandline_Plugin
+{
+public:
+ Fl_FltkDB_Plugin() : Fl_Commandline_Plugin(name()) { }
+ const char *name() { return "FltkDB.fluid.fltk.org"; }
+ const char *help() { return
+ " --fltkdb <filename> : create a database describing all FLTK project rules"; }
+ int arg(int argc, char **argv, int &i) {
+ if (argc>=i+1 && strcmp(argv[i], "--fltkdb")==0) {
+ if (argc>=i+2 && argv[i+1][0]!='-') {
+ fprintf(stderr, "Creating Databse %s\n", argv[i+1]);
+ exit_early = 1;
+ create_new_database(argv[i+1]);
+ i = i+2;
+ return 2;
+ } else {
+ fprintf(stderr, "Missing argument: --fltkdb <filename>\n");
+ return 1;
+ }
+ }
+ return 0;
+ }
+};
+
+Fl_FltkDB_Plugin FltkDB_Plugin;
+
+//
+// End of "$Id: ide_support.cxx 6981 2009-12-25 20:53:22Z matt $".
+//
diff --git a/fluid/ide_support.h b/fluid/ide_support.h
new file mode 100644
index 000000000..fdad65d3c
--- /dev/null
+++ b/fluid/ide_support.h
@@ -0,0 +1,101 @@
+//
+// "$Id: ide_support.h 6981 2009-12-25 20:53:22Z matt $"
+//
+// IDE and Build FIle generation for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 2010 by Matthias Melcher.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+#ifndef FLUID_IDE_SUPPORT_H
+#define FLUID_IDE_SUPPORT_H
+
+#include <FL/Fl.H>
+#include <FL/Fl_Preferences.H>
+
+
+typedef char UUID[40];
+typedef char XCID[25];
+
+
+extern void getUUID(Fl_Preferences &db, const char *key, char *buffer);
+extern void getXCID(Fl_Preferences &db, const char *key, char *buffer);
+
+
+/* Shortcut to retrieve or create a UUID from the database */
+#define MAKE_UUID(name, db) \
+ char name[40]; getUUID(db, #name, name);
+
+/* Shortcut to retrieve, but not create a UUID from the database */
+#define GET_UUID(name, db) \
+ char name[40]; db.get(#name, name, "DBERROR", 40);
+
+/* Shortcut to retrieve or create a UUID from the database */
+#define MAKE_XCID(name, db) \
+char name[25]; getXCID(db, #name, name);
+
+/* Shortcut to retrieve, but not create a UUID from the database */
+#define GET_XCID(name, db) \
+char name[25]; db.get(#name, name, "DBERROR", 40);
+
+
+/* A preferences node with some additional functionality */
+class Fl_IDE_Prefs : public Fl_Preferences {
+public:
+ Fl_IDE_Prefs(Fl_Preferences &parent, const char *name);
+ Fl_IDE_Prefs(Fl_Preferences &parent, int ix);
+ Fl_IDE_Prefs(Fl_Preferences::ID id);
+ Fl_Preferences::ID find_by_name(const char *name);
+ Fl_Preferences::ID find_by_key(const char *key, const char *value);
+ Fl_Preferences::ID add_with_key(const char *key, const char *value, const char *uuid=0);
+};
+
+
+class Fl_Target_Prefs : public Fl_IDE_Prefs {
+public:
+ Fl_Target_Prefs(Fl_Preferences::ID id);
+ Fl_Preferences::ID add_source(Fl_IDE_Prefs &fdb, const char *pathAndName);
+ Fl_Preferences::ID add_fl(Fl_IDE_Prefs &fdb, const char *pathAndName);
+ Fl_Preferences::ID depends_on(Fl_IDE_Prefs &dep);
+ Fl_Preferences::ID add_lib(Fl_IDE_Prefs &lib);
+};
+
+
+class Fl_File_Prefs : public Fl_Preferences {
+ char pPath[1024];
+ char pName[80];
+ char pFullName[100];
+ char pExt[20];
+public:
+ Fl_File_Prefs(Fl_Preferences &parent, const char *name);
+ Fl_File_Prefs(Fl_Preferences &parent, int ix);
+ Fl_File_Prefs(Fl_Preferences::ID id);
+ const char *filePath();
+ const char *fileName();
+ const char *fullName();
+ const char *fileExt();
+};
+
+#endif
+
+//
+// End of "$Id: ide_support.h 6981 2009-12-25 20:53:22Z matt $".
+// \ No newline at end of file
diff --git a/fluid/ide_xcode.cxx b/fluid/ide_xcode.cxx
new file mode 100644
index 000000000..3c5dc7fe1
--- /dev/null
+++ b/fluid/ide_xcode.cxx
@@ -0,0 +1,1389 @@
+//
+// "$Id: ide_xcode.cxx 6981 2009-12-25 20:53:22Z matt $"
+//
+// IDE and Build FIle generation for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2009 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+/*
+
+ XCODE 3.0 IDE FILES
+
+ The Xcode 3.0 IDE file format is using a quite comlex tree of multiply linked
+ entries to leave as much possibilities to developers as somehow possible. To
+ write this format, we will need to generate a bunch of new unique IDs that will
+ be stored in the DB.
+
+ "rootObject" is a PBXProject [/ide/Xcode/xcRootObjectID]
+ link to "buildConfigurationList" [/ide/Xcode/xcBuildConfigurationListID]
+ link to "mainGroup" PBXGroup [/ide/Xcode/xcMainGroupID]
+ link to "productRefGroup" PBXGroup [/ide/Xcode/xcProductsGroupID]
+ array of links to "target" PBXNativeTarget [/targets/apps|libs|tests/#/xcTargetID]
+
+ "buildConfigurationList" is a XCConfigurationList
+ array of links to buildConfiguration
+ "Debug" [/ide/Xcode/xcBuildConfigurationDebugID]
+ "Release" [/ide/Xcode/xcBuildConfigurationReleaseID]
+ ... but also [/targets/apps|libs|tests/#/xcBuildConfigurationListID]
+ [/targets/apps|libs|tests/#/xcBuildConfigurationDebugID]
+ [/targets/apps|libs|tests/#/xcBuildConfigurationReleaseID]
+
+ "buildConfiguration" is a XCBuildConfiguration
+ no links
+
+ "mainGroup" is a PBXGroup
+ array of links to PBXFileReference and PBXGroup [/ide/Xcode/xc...GroupID]
+ and also [/targets/apps|libs/#/xcGroupID]
+
+ "target" is a "PBXNaticeTarget" [/targets/apps|libs|tests/#/xcTargetID]
+ link to buildConfigurationList [/targets/apps|libs|tests/#/xcBuildConfigurationListID]
+ array of links to buildPhases
+ Headers [/targets/apps|libs|tests/#/xcBuildHeadersID] (libs only)
+ Resources [/targets/apps|libs|tests/#/xcBuildResourcesID]
+ Sources [/targets/apps|libs|tests/#/xcBuildSourcesID]
+ Frameworks [/targets/apps|libs|tests/#/xcBuildFrameworksID]
+ CopyFiles [/targets/apps|libs|tests/#/xcBuildCopyFilesID] (not for libs)
+ array of links to buildRules [/targets/apps|libs|tests/#/xcBuildRuleFlID] etc.
+ array of links to dependencies [/targets/apps|libs|tests/#/dependencies/#/xcDependencyID]
+ link to productReference [/targets/apps|libs|tests/#/xcProductID]
+
+ "buildPhase" is a PBX...BuildPhase [/targets/apps|libs|tests/#/xcBuild...ID]
+ array of links to buildFile [/targets/apps|libs|tests/#/sources|libs|fl/#/xcBuildFileID]
+
+ "buildFile" is a PBXBuildFile [/targets/apps|libs|tests/#/sources|libs|fl/#/xcBuildFileID]
+ links to file (PBXFileReference) [/files/#/xcFileID]
+
+ "buildRule" is a PBXBuildRule
+ [/targets/apps|libs|tests/#/xcBuildRuleFlID] etc.
+ no links
+
+ "dependency" is a PBXTargetDependency [/targets/apps|libs|tests/#/dependencies/#/xcDependencyID]
+ link to target "PBXNativeTarget" (see above)
+ link to targetProxy "PBXContainerItemProxy" /targets/apps|libs|tests/#/dependencies/#/xcProxyID]
+
+ "file" "productReference" is a PBXFileReference
+ no links
+
+ "targetProxy" is a PBXContainerItemProxy
+ links to containerPortal (=rootObject) [/ide/Xcode/xcRootObjectID]
+ links to remoteGlobalIDString "PBXNativeTarget" (see above) [/targets/apps|libs|tests/#/xcTargetID]
+
+*/
+
+#include "ide_support.h"
+
+#include <FL/filename.h>
+#include <FL/fl_ask.h>
+
+#include "Fl_Type.h"
+
+/*
+ * This class creates all Xcode 3.0 IDE files.
+ */
+class Xcode3_IDE {
+ char *rootDir;
+ char projectName[80];
+ Fl_Preferences tgtAppsDB;
+ int nTgtApps;
+ Fl_Preferences tgtLibsDB;
+ int nTgtLibs;
+ Fl_Preferences tgtTestsDB;
+ int nTgtTests;
+ Fl_Preferences filesDB;
+ int nFiles;
+ Fl_Preferences ideDB;
+ XCID xcRootNodeID;
+ XCID xcBuildConfigurationListID;
+ XCID xcMainGroupID;
+ XCID xcProductsGroupID;
+ XCID xcFilesGroupID;
+ XCID xcBuildConfigurationDebugID;
+ XCID xcBuildConfigurationReleaseID;
+public:
+ Xcode3_IDE(Fl_Preferences &db, const char *rootDirA)
+ : rootDir(strdup(rootDirA)),
+ tgtAppsDB(db, "targets/apps"),
+ tgtLibsDB(db, "targets/libs"),
+ tgtTestsDB(db, "targets/tests"),
+ filesDB(db, "files"),
+ ideDB(db, "ide/Xcode")
+ {
+ db.get("projectName", projectName, "Unnamed", 80);
+ nTgtApps = tgtAppsDB.groups();
+ nTgtLibs = tgtLibsDB.groups();
+ nTgtTests = tgtTestsDB.groups();
+ nFiles = filesDB.groups();
+ getXCID(ideDB, "xcRootNodeID", xcRootNodeID);
+ getXCID(ideDB, "xcBuildConfigurationListID", xcBuildConfigurationListID);
+ getXCID(ideDB, "xcMainGroupID", xcMainGroupID);
+ getXCID(ideDB, "xcProductsGroupID", xcProductsGroupID);
+ getXCID(ideDB, "xcFilesGroupID", xcFilesGroupID);
+ getXCID(ideDB, "xcBuildConfigurationDebugID", xcBuildConfigurationDebugID);
+ getXCID(ideDB, "xcBuildConfigurationReleaseID", xcBuildConfigurationReleaseID);
+ }
+ ~Xcode3_IDE() {
+ if (rootDir) free(rootDir);
+ }
+
+ /*
+ * Write all files required during the actual build.
+ * These are actually forwarding links from the build setup into the
+ * files section.
+ */
+ int writeBuildFiles(FILE *out, Fl_Preferences &targetDB) {
+ // FIXME: also write .app, .plist, and maybe headers
+ // --- write all references to sources from the given target
+ Fl_Preferences sourcesDB(targetDB, "sources");
+ int i, n = sourcesDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences sourceDB(sourcesDB, i);
+ GET_UUID(refUUID, sourceDB);
+ MAKE_XCID(xcBuildFileID, sourceDB);
+ Fl_File_Prefs fileDB(filesDB, refUUID);
+ MAKE_XCID(xcFileID, fileDB);
+ const char *fullName = fileDB.fullName();
+ fprintf(out, "\t\t%s /* %s in Sources */ = {isa = PBXBuildFile; fileRef = %s /* %s */; };\n", xcBuildFileID, fullName, xcFileID, fullName);
+ }
+ // --- write all references to Fluid UI files from the given target
+ Fl_Preferences flsDB(targetDB, "fl");
+ n = flsDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences flDB(flsDB, i);
+ GET_UUID(refUUID, flDB);
+ MAKE_XCID(xcBuildFileID, flDB);
+ Fl_File_Prefs fileDB(filesDB, refUUID);
+ MAKE_XCID(xcFileID, fileDB);
+ const char *fullName = fileDB.fullName();
+ fprintf(out, "\t\t%s /* %s in Sources */ = {isa = PBXBuildFile; fileRef = %s /* %s */; };\n", xcBuildFileID, fullName, xcFileID, fullName);
+ }
+ Fl_Preferences libsDB(targetDB, "libs"); n = libsDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences libDB(libsDB, i);
+ GET_UUID(refUUID, libDB);
+ MAKE_XCID(xcBuildFrameworkID, libDB);
+ MAKE_XCID(xcCopyFrameworkID, libDB);
+ Fl_Preferences tgtLibDB(tgtLibsDB, refUUID);
+ MAKE_XCID(xcProductID, tgtLibDB);
+ char name[80]; tgtLibDB.get("name", name, "DBERROR", 80);;
+ fprintf(out, "\t\t%s /* %s.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = %s /* %s.framework */; };\n", xcBuildFrameworkID, name, xcProductID, name);
+ fprintf(out, "\t\t%s /* %s.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = %s /* %s.framework */; };\n", xcCopyFrameworkID, name, xcProductID, name);
+ }
+ return 0;
+ }
+
+ /*
+ * Writes the section that links build components to a file.
+ */
+ int writeBuildFileSection(FILE *out) {
+ fprintf(out, "/* Begin PBXBuildFile section */\n");
+ int i;
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeBuildFiles(out, targetDB);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeBuildFiles(out, targetDB);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeBuildFiles(out, targetDB);
+ }
+ fprintf(out, "/* End PBXBuildFile section */\n\n");
+ return 0;
+ }
+
+ /*
+ * Write the build rule for .fl files.
+ */
+ int writeBuildRule(FILE *out, Fl_Preferences &targetDB) {
+ MAKE_XCID(xcBuildRuleFlID, targetDB);
+ fprintf(out, "\t\t%s /* PBXBuildRule */ = {\n", xcBuildRuleFlID);
+ 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 ../../test && ${TARGET_BUILD_DIR}/Fluid.app/Contents/MacOS/Fluid -c ${INPUT_FILE_NAME}\";\n");
+ fprintf(out, "\t\t};\n");
+ }
+
+ /*
+ * Additional build rules. Here we teach Xcode how to handle .fl files.
+ */
+ int writeBuildRuleSection(FILE *out) {
+ int i;
+ fprintf(out, "/* Begin PBXBuildRule section */\n");
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeBuildRule(out, targetDB);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeBuildRule(out, targetDB);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeBuildRule(out, targetDB);
+ }
+ fprintf(out, "/* End PBXBuildRule section */\n\n");
+ return 0;
+ }
+
+ /*
+ * Write all target proxies for a single target.
+ */
+ int writeContainerItemProxy(FILE *out, Fl_Preferences &targetDB) {
+ Fl_Preferences depsDB(targetDB, "deps");
+ int i, n = depsDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences depDB(depsDB, i);
+ GET_UUID(refUUID, depDB);
+ // MAKE_XCID(xcDependencyID, depDB);
+ MAKE_XCID(xcProxyID, depDB);
+ Fl_Preferences *depTgtDBp = 0;
+ if (tgtAppsDB.groupExists(refUUID))
+ depTgtDBp = new Fl_Preferences(tgtAppsDB, refUUID);
+ else if (tgtLibsDB.groupExists(refUUID))
+ depTgtDBp = new Fl_Preferences(tgtLibsDB, refUUID);
+ else if (tgtTestsDB.groupExists(refUUID))
+ depTgtDBp = new Fl_Preferences(tgtTestsDB, refUUID);
+ if (depTgtDBp) {
+ Fl_Preferences &depTgtDB = *depTgtDBp;
+ MAKE_XCID(xcTargetID, depTgtDB);
+ char name[80]; depTgtDB.get("name", name, "DBERROR", 80);
+ fprintf(out, "\t\t%s /* PBXContainerItemProxy */ = {\n", xcProxyID);
+ fprintf(out, "\t\t\tisa = PBXContainerItemProxy;\n");
+ fprintf(out, "\t\t\tcontainerPortal = %s /* Project object */;\n", xcRootNodeID);
+ fprintf(out, "\t\t\tproxyType = 1;\n");
+ fprintf(out, "\t\t\tremoteGlobalIDString = %s;\n", xcTargetID);
+ fprintf(out, "\t\t\tremoteInfo = %s;\n", name);
+ fprintf(out, "\t\t};\n");
+ delete depTgtDBp;
+ }
+ }
+ return 0;
+ }
+
+ /*
+ * Write a proxy for all target dependencies of all targets.
+ * (I am not entirely sure why these proxies exist, but Apple will know)
+ */
+ int writeContainerItemProxySection(FILE *out) {
+ fprintf(out, "/* Begin PBXContainerItemProxy section */\n");
+ int i;
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeContainerItemProxy(out, targetDB);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeContainerItemProxy(out, targetDB);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeContainerItemProxy(out, targetDB);
+ }
+ fprintf(out, "/* End PBXContainerItemProxy section */\n\n");
+ return 0;
+ }
+
+ /*
+ * List the files that will be copied into the final application.
+ */
+ int writeCopyFilesBuildPhase(FILE *out, Fl_Preferences &targetDB) {
+ MAKE_XCID(xcBuildCopyFilesID, targetDB);
+ fprintf(out, "\t\t%s /* CopyFiles */ = {\n", xcBuildCopyFilesID);
+ fprintf(out, "\t\t\tisa = PBXCopyFilesBuildPhase;\n");
+ fprintf(out, "\t\t\tbuildActionMask = 2147483647;\n");
+ fprintf(out, "\t\t\tdstPath = \"\";\n");
+ fprintf(out, "\t\t\tdstSubfolderSpec = 10;\n");
+ fprintf(out, "\t\t\tfiles = (\n");
+ // ---
+ Fl_Preferences libsDB(targetDB, "libs");
+ int i, n = libsDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences libDB(libsDB, i);
+ GET_UUID(refUUID, libDB);
+ MAKE_XCID(xcCopyFrameworkID, libDB);
+ Fl_Preferences tgtLibDB(tgtLibsDB, refUUID);
+ char name[80]; tgtLibDB.get("name", name, "DBERROR", 80);;
+ fprintf(out, "\t\t\t\t%s /* %s.framework in CopyFiles */,\n", xcCopyFrameworkID, name);
+ }
+ // ---
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\trunOnlyForDeploymentPostprocessing = 0;\n");
+ fprintf(out, "\t\t};\n");
+ return 0;
+ };
+
+ /*
+ * List the files that will be copied into the final application.
+ */
+ int writeCopyFilesBuildPhaseSection(FILE *out) {
+ fprintf(out, "/* Begin PBXCopyFilesBuildPhase section */\n");
+ int i;
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeCopyFilesBuildPhase(out, targetDB);
+ }
+ // TgtLibsDB has no CopyFile build phase
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeCopyFilesBuildPhase(out, targetDB);
+ }
+ fprintf(out, "/* End PBXCopyFilesBuildPhase section */\n\n");
+ return 0;
+ }
+
+ /*
+ * A list of all files that are somehow referenced in this project
+ */
+ int writeFileReferenceSection(FILE *out) {
+ int i, j;
+ fprintf(out, "/* Begin PBXFileReference section */\n");
+ // --- list of all Application target results
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ // write a reference to the target.app file
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcProductID, targetDB);
+ fprintf(out, "\t\t%s /* %s.app */ = {isa = PBXFileReference; "
+ "explicitFileType = wrapper.application; includeInIndex = 0; "
+ "path = %s.app; sourceTree = BUILT_PRODUCTS_DIR; };\n",
+ xcProductID, name, name);
+ // FIXME: write .plist reference
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ // write a reference to the target.app file
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcProductID, targetDB);
+ fprintf(out, "\t\t%s /* %s.framework */ = {isa = PBXFileReference; "
+ "explicitFileType = wrapper.framework; includeInIndex = 0; "
+ "path = %s.framework; sourceTree = BUILT_PRODUCTS_DIR; };\n",
+ xcProductID, name, name);
+ // FIXME: write .plist reference
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ // write a reference to the target.app file
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcProductID, targetDB);
+ fprintf(out, "\t\t%s /* %s.app */ = {isa = PBXFileReference; "
+ "explicitFileType = wrapper.application; includeInIndex = 0; "
+ "path = %s.app; sourceTree = BUILT_PRODUCTS_DIR; };\n",
+ xcProductID, name, name);
+ // FIXME: write .plist reference
+ }
+ // write all source file
+ for (i=0; i<nFiles; i++) {
+ Fl_File_Prefs fileDB(filesDB, i);
+ MAKE_XCID(xcFileID, fileDB);
+ const char *fullName = fileDB.fullName();
+ char pathAndName[1024]; fileDB.get("pathAndName", pathAndName, "DBERROR", 1024);
+ const char *filetype = "test";
+ const char *ext = fileDB.fileExt();
+ if (!ext) {
+ } else if (strcmp(pathAndName, "src/Fl.cxx")==0) { // FIXME: bad hack!
+ filetype = "sourcecode.cpp.objcpp";
+ } else if (strcmp(ext, ".cxx")==0) {
+ filetype = "sourcecode.cpp.cpp";
+ } else if (strcmp(ext, ".c")==0) {
+ filetype = "sourcecode.c.c";
+ } else if (strcmp(ext, ".mm")==0) {
+ filetype = "sourcecode.cpp.objcpp";
+ } else if (strcmp(ext, ".plist")==0) {
+ filetype = "text.plist.xml";
+ }
+ fprintf(out,
+ "\t\t%s /* %s */ = {isa = PBXFileReference; fileEncoding = 4; "
+ "lastKnownFileType = %s; name = %s; "
+ "path = ../../%s; sourceTree = SOURCE_ROOT; };\n",
+ xcFileID, fullName, filetype, fullName, pathAndName);
+ }
+#if 0
+ // write all sources from the given target
+ Fl_Preferences sourcesDB(targetDB, "sources");
+ int i, n = sourcesDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences sourceDB(sourcesDB, i);
+ GET_UUID(refUUID, sourceDB);
+ MAKE_XCID(xcBuildFileID, sourceDB);
+ Fl_File_Prefs fileDB(filesDB, refUUID);
+ MAKE_XCID(xcFileID, fileDB);
+ const char *fullName = fileDB.fullName();
+ fprintf(out, "\t\t%s /* %s in Sources */ = {isa = PBXBuildFile; fileRef = %s /* %s */; };\n", xcBuildSourceID, fullName, xcFileID, fullName);
+ }
+
+
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcAppFileID, targetDB);
+ fprintf(out,
+ "%s /* %s.app */ = {isa = PBXFileReference; "
+ "explicitFileType = wrapper.application; includeInIndex = 0; "
+ "path = %s.app; sourceTree = BUILT_PRODUCTS_DIR; };\n",
+ xcAppFileID, name, name);
+ }
+ /*
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeFrameworksBuildPhase(out, targetDB);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeFrameworksBuildPhase(out, targetDB);
+ }
+ */
+ // FIXME: .cxx .app .plist .fl .dylib .framework etc.
+#endif
+ fprintf(out, "/* End PBXFileReference section */\n\n");
+ return 0;
+ }
+
+ /*
+ * List all framework build phases
+ */
+ int writeFrameworksBuildPhase(FILE *out, Fl_Preferences &targetDB) {
+ MAKE_XCID(xcBuildFrameworksID, targetDB);
+ fprintf(out, "\t\t%s /* Frameworks */ = {\n", xcBuildFrameworksID);
+ fprintf(out, "\t\t\tisa = PBXFrameworksBuildPhase;\n");
+ fprintf(out, "\t\t\tbuildActionMask = 2147483647;\n");
+ fprintf(out, "\t\t\tfiles = (\n");
+ Fl_Preferences libsDB(targetDB, "libs");
+ int i, n = libsDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences libDB(libsDB, i);
+ GET_UUID(refUUID, libDB);
+ MAKE_XCID(xcBuildFrameworkID, libDB);
+ Fl_Preferences tgtLibDB(tgtLibsDB, refUUID);
+ char name[80]; tgtLibDB.get("name", name, "DBERROR", 80);;
+ fprintf(out, "\t\t\t\t%s /* %s.framework in Frameworks */,\n", xcBuildFrameworkID, name);
+ }
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\trunOnlyForDeploymentPostprocessing = 0;\n");
+ fprintf(out, "\t\t};\n");
+ return 0;
+ };
+
+ /*
+ * Write all build phases.
+ */
+ int writeFrameworksBuildPhaseSection(FILE *out) {
+ fprintf(out, "/* Begin PBXFrameworksBuildPhase section */\n");
+ int i;
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeFrameworksBuildPhase(out, targetDB);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeFrameworksBuildPhase(out, targetDB);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeFrameworksBuildPhase(out, targetDB);
+ }
+ fprintf(out, "/* End PBXFrameworksBuildPhase section */\n\n");
+ return 0;
+ }
+
+ /*
+ *
+ */
+ int writeTargetFiles(FILE *out, Fl_Preferences &targetDB) {
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcProductID, targetDB);
+ Fl_Preferences sourcesDB(targetDB, "sources");
+ int j, n = sourcesDB.groups();
+ for (j=0; j<n; j++) {
+ Fl_Preferences sourceDB(sourcesDB, j);
+ GET_UUID(refUUID, sourceDB);
+ Fl_File_Prefs fileDB(filesDB, refUUID);
+ MAKE_XCID(xcFileID, fileDB);
+ const char *fullName = fileDB.fullName();
+ fprintf(out, "\t\t\t\t%s /* %s */,\n", xcFileID, fullName);
+ }
+ Fl_Preferences flsDB(targetDB, "fl");
+ n = flsDB.groups();
+ for (j=0; j<n; j++) {
+ Fl_Preferences flDB(flsDB, j);
+ GET_UUID(refUUID, flDB);
+ Fl_File_Prefs fileDB(filesDB, refUUID);
+ MAKE_XCID(xcFileID, fileDB);
+ const char *fullName = fileDB.fullName();
+ fprintf(out, "\t\t\t\t%s /* %s */,\n", xcFileID, fullName);
+ }
+ }
+
+ /*
+ * Groups define the folder hierarchy in the "Groups & Files" panel
+ */
+ int writeGroupSection(FILE *out) {
+ int i, j;
+ fprintf(out, "/* Begin PBXGroup section */\n");
+ // --- FIXME: missing "icons" group
+ // --- main group
+ fprintf(out, "\t\t%s = {\n", xcMainGroupID);
+ fprintf(out, "\t\t\tisa = PBXGroup;\n");
+ fprintf(out, "\t\t\tchildren = (\n");
+ fprintf(out, "\t\t\t\t%s /* Files */,\n", xcFilesGroupID); // link to "Files" group
+ fprintf(out, "\t\t\t\t%s /* Products */,\n", xcProductsGroupID); // link to "Products" group
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\tsourceTree = \"<group>\";\n");
+ fprintf(out, "\t\t};\n");
+ // --- "Products" group
+ fprintf(out, "\t\t%s /* Products */ = {\n", xcProductsGroupID);
+ fprintf(out, "\t\t\tisa = PBXGroup;\n");
+ fprintf(out, "\t\t\tchildren = (\n");
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcProductID, targetDB);
+ fprintf(out, "\t\t\t\t%s /* %s.app */,\n", xcProductID, name);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcProductID, targetDB);
+ fprintf(out, "\t\t\t\t%s /* %s.framework */,\n", xcProductID, name);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcProductID, targetDB);
+ fprintf(out, "\t\t\t\t%s /* %s.app */,\n", xcProductID, name);
+ }
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\tname = Products;\n");
+ fprintf(out, "\t\t\tsourceTree = \"<group>\";\n");
+ fprintf(out, "\t\t};\n");
+ // --- FIXME: missing "plists" group
+ // --- FIXME: missing "Library Sources" group
+ // --- FIXME: missing "Test Sources" group
+ // --- FIXME: missing "Frameworks" group
+ // --- FIXME: missing "Fluid Sources" group
+ // --- FIXME: missing "jpeg Sources" group
+ // --- FIXME: missing "png Sources" group
+ // --- FIXME: missing "libs" group
+
+ // --- "Files" group for testing
+ fprintf(out, "\t\t%s /* Files */ = {\n", xcFilesGroupID);
+ fprintf(out, "\t\t\tisa = PBXGroup;\n");
+ fprintf(out, "\t\t\tchildren = (\n");
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeTargetFiles(out, targetDB);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeTargetFiles(out, targetDB);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeTargetFiles(out, targetDB);
+ }
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\tname = Files;\n");
+ fprintf(out, "\t\t\tsourceTree = \"<group>\";\n");
+ fprintf(out, "\t\t};\n");
+ // --- done
+ fprintf(out, "/* End PBXGroup section */\n\n");
+ return 0;
+ }
+
+ /*
+ *
+ */
+ int writeHeadersBuildPhase(FILE *out, Fl_Preferences &targetDB) {
+ MAKE_XCID(xcBuildHeadersID, targetDB);
+ fprintf(out, "\t\t%s /* Headers */ = {\n", xcBuildHeadersID);
+ fprintf(out, "\t\t\tisa = PBXHeadersBuildPhase;\n");
+ fprintf(out, "\t\t\tbuildActionMask = 2147483647;\n");
+ fprintf(out, "\t\t\tfiles = (\n");
+#if 0
+ // FIXME: list all required headers
+ Fl_Preferences libsDB(targetDB, "libs");
+ int i, n = libsDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences libDB(libsDB, i);
+ GET_UUID(refUUID, libDB);
+ MAKE_XCID(xcCopyFrameworkID, libDB);
+ Fl_Preferences tgtLibDB(tgtLibsDB, refUUID);
+ char name[80]; tgtLibDB.get("name", name, "DBERROR", 80);;
+ fprintf(out, "\t\t\t\t%s /* %s.framework in CopyFiles */,\n", xcCopyFrameworkID, name);
+ }
+#endif
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\trunOnlyForDeploymentPostprocessing = 0;\n");
+ fprintf(out, "\t\t};\n");
+ return 0;
+ };
+
+ /*
+ *
+ */
+ int writeHeadersBuildPhaseSection(FILE *out) {
+ int i;
+ fprintf(out, "/* Begin PBXHeadersBuildPhase section */\n");
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeHeadersBuildPhase(out, targetDB);
+ }
+ fprintf(out, "/* End PBXHeadersBuildPhase section */\n\n");
+ return 0;
+ }
+
+ /*
+ * Write build information for this target
+ */
+ int writeNativeTarget(FILE *out, Fl_Preferences &targetDB, int fmwk=0) {
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcTargetID, targetDB);
+ MAKE_XCID(xcBuildConfigurationListID, targetDB);
+ char xcBuildHeadersID[25], xcBuildCopyFilesID[25];
+ if (fmwk) getXCID(targetDB, "xcBuildHeadersID", xcBuildHeadersID);
+ MAKE_XCID(xcBuildResourcesID, targetDB);
+ MAKE_XCID(xcBuildSourcesID, targetDB);
+ MAKE_XCID(xcBuildFrameworksID, targetDB);
+ if (!fmwk) getXCID(targetDB, "xcBuildCopyFilesID", xcBuildCopyFilesID);
+ MAKE_XCID(xcProductID, targetDB);
+ MAKE_XCID(xcBuildRuleFlID, targetDB);
+ fprintf(out, "\t\t%s /* %s */ = {\n", xcTargetID, name);
+ fprintf(out, "\t\t\tisa = PBXNativeTarget;\n");
+ fprintf(out, "\t\t\tbuildConfigurationList = %s /* Build configuration list for PBXNativeTarget \"%s\" */;\n", xcBuildConfigurationListID, name);
+ fprintf(out, "\t\t\tbuildPhases = (\n");
+ if (fmwk) fprintf(out, "\t\t\t\t%s /* Headers */,\n", xcBuildHeadersID);
+ fprintf(out, "\t\t\t\t%s /* Resources */,\n", xcBuildResourcesID);
+ fprintf(out, "\t\t\t\t%s /* Sources */,\n", xcBuildSourcesID);
+ fprintf(out, "\t\t\t\t%s /* Frameworks */,\n", xcBuildFrameworksID);
+ if (!fmwk) fprintf(out, "\t\t\t\t%s /* CopyFiles */,\n", xcBuildCopyFilesID);
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\tbuildRules = (\n");
+ fprintf(out, "\t\t\t\t%s /* PBXBuildRule */,\n", xcBuildRuleFlID);
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\tdependencies = (\n"); {
+ Fl_Preferences depsDB(targetDB, "deps");
+ int i, n = depsDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences depDB(depsDB, i);
+ MAKE_XCID(xcDependencyID, depDB);
+ fprintf(out, "\t\t\t\t%s /* PBXTargetDependency */,\n", xcDependencyID);
+ }
+ }
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\tname = %s;\n", name);
+ fprintf(out, "\t\t\tproductName = %s;\n", name);
+ if (fmwk) {
+ fprintf(out, "\t\t\tproductReference = %s /* %s.framework */;\n", xcProductID, name);
+ fprintf(out, "\t\t\tproductType = \"com.apple.product-type.framework\";\n");
+ } else {
+ fprintf(out, "\t\t\tproductReference = %s /* %s.app */;\n", xcProductID, name);
+ fprintf(out, "\t\t\tproductType = \"com.apple.product-type.application\";\n");
+ }
+ fprintf(out, "\t\t};\n");
+ return 0;
+ }
+
+ /*
+ * Write the build information for all targets
+ */
+ int writeNativeTargetSection(FILE *out) {
+ fprintf(out, "/* Begin PBXNativeTarget section */\n");
+ int i;
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeNativeTarget(out, targetDB, 0);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeNativeTarget(out, targetDB, 1);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeNativeTarget(out, targetDB, 0);
+ }
+ fprintf(out, "/* End PBXNativeTarget section */\n\n");
+ return 0;
+ }
+
+ /*
+ * This section describes the file layout in "Grous & Files"
+ */
+ int writeProjectSection(FILE *out) {
+ int i;
+ fprintf(out, "/* Begin PBXProject section */\n");
+ fprintf(out, "\t\t%s /* Project object */ = {\n", xcRootNodeID);
+ fprintf(out, "\t\t\tisa = PBXProject;\n");
+ fprintf(out, "\t\t\tbuildConfigurationList = %s /* Build configuration list for PBXProject \"%s\" */;\n", xcBuildConfigurationListID, projectName);
+ fprintf(out, "\t\t\tcompatibilityVersion = \"Xcode 3.0\";\n");
+ fprintf(out, "\t\t\thasScannedForEncodings = 0;\n");
+ fprintf(out, "\t\t\tmainGroup = %s;\n", xcMainGroupID);
+ fprintf(out, "\t\t\tproductRefGroup = %s /* Products */;\n", xcProductsGroupID);
+ fprintf(out, "\t\t\tprojectDirPath = \"\";\n");
+ fprintf(out, "\t\t\tprojectRoot = \"\";\n");
+ fprintf(out, "\t\t\ttargets = (\n");
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcTargetID, targetDB);
+ fprintf(out, "\t\t\t\t%s /* %s */,\n", xcTargetID, name);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcTargetID, targetDB);
+ fprintf(out, "\t\t\t\t%s /* %s */,\n", xcTargetID, name);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcTargetID, targetDB);
+ fprintf(out, "\t\t\t\t%s /* %s */,\n", xcTargetID, name);
+ }
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t};\n");
+ fprintf(out, "/* End PBXProject section */\n\n");
+ return 0;
+ }
+
+ /*
+ * Write the resource build pahse for a target.
+ * Currently we do not include any resources, but we will eventually allow
+ * icons for applications.
+ */
+ int writeResourcesBuildPhase(FILE *out, Fl_Preferences &targetDB) {
+ MAKE_XCID(xcBuildResourcesID, targetDB);
+ fprintf(out, "\t\t%s /* Resources */ = {\n", xcBuildResourcesID);
+ 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;
+ }
+
+ /*
+ * Write all resource build phases for all targets.
+ */
+ int writeResourcesBuildPhaseSection(FILE *out) {
+ int i;
+ fprintf(out, "/* Begin PBXResourcesBuildPhase section */\n");
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeResourcesBuildPhase(out, targetDB);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeResourcesBuildPhase(out, targetDB);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeResourcesBuildPhase(out, targetDB);
+ }
+ fprintf(out, "/* End PBXResourcesBuildPhase section */\n\n");
+ return 0;
+ }
+
+ /*
+ *
+ */
+ int writeSourcesBuildPhase(FILE *out, Fl_Preferences &targetDB) {
+ MAKE_XCID(xcBuildSourcesID, targetDB);
+ fprintf(out, "\t\t%s /* Sources */ = {\n", xcBuildSourcesID);
+ fprintf(out, "\t\t\tisa = PBXSourcesBuildPhase;\n");
+ fprintf(out, "\t\t\tbuildActionMask = 2147483647;\n");
+ fprintf(out, "\t\t\tfiles = (\n");
+ // write the array of source code files
+ Fl_Preferences sourcesDB(targetDB, "sources");
+ int i, n = sourcesDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences sourceDB(sourcesDB, i);
+ GET_UUID(refUUID, sourceDB);
+ MAKE_XCID(xcBuildFileID, sourceDB);
+ Fl_File_Prefs fileDB(filesDB, refUUID);
+ const char *fullName = fileDB.fullName();
+ fprintf(out, "\t\t\t\t%s /* %s in Sources */,\n", xcBuildFileID, fileDB.fullName());
+ }
+ Fl_Preferences flsDB(targetDB, "fl");
+ n = flsDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences flDB(flsDB, i);
+ GET_UUID(refUUID, flDB);
+ MAKE_XCID(xcBuildFileID, flDB);
+ Fl_File_Prefs fileDB(filesDB, refUUID);
+ const char *fullName = fileDB.fullName();
+ fprintf(out, "\t\t\t\t%s /* %s in Sources */,\n", xcBuildFileID, fileDB.fullName());
+ }
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\trunOnlyForDeploymentPostprocessing = 0;\n");
+ fprintf(out, "\t\t};\n");
+ return 0;
+ };
+
+ /*
+ *
+ */
+ int writeSourcesBuildPhaseSection(FILE *out) {
+ fprintf(out, "/* Begin PBXSourcesBuildPhase section */\n");
+ int i;
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeSourcesBuildPhase(out, targetDB);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeSourcesBuildPhase(out, targetDB);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeSourcesBuildPhase(out, targetDB);
+ }
+ fprintf(out, "/* End PBXSourcesBuildPhase section */\n\n");
+ return 0;
+ }
+
+ /*
+ * Write all target dependencies of a single target.
+ */
+ int writeTargetDependency(FILE *out, Fl_Preferences &targetDB) {
+ Fl_Preferences depsDB(targetDB, "deps");
+ int i, n = depsDB.groups();
+ for (i=0; i<n; i++) {
+ Fl_Preferences depDB(depsDB, i);
+ GET_UUID(refUUID, depDB);
+ MAKE_XCID(xcDependencyID, depDB);
+ MAKE_XCID(xcProxyID, depDB);
+ Fl_Preferences *depTgtDBp = 0;
+ if (tgtAppsDB.groupExists(refUUID))
+ depTgtDBp = new Fl_Preferences(tgtAppsDB, refUUID);
+ else if (tgtLibsDB.groupExists(refUUID))
+ depTgtDBp = new Fl_Preferences(tgtLibsDB, refUUID);
+ else if (tgtTestsDB.groupExists(refUUID))
+ depTgtDBp = new Fl_Preferences(tgtTestsDB, refUUID);
+ if (depTgtDBp) {
+ Fl_Preferences &depTgtDB = *depTgtDBp;
+ MAKE_XCID(xcTargetID, depTgtDB);
+ char name[80]; depTgtDB.get("name", name, "DBERROR", 80);
+ fprintf(out, "\t\t%s /* PBXTargetDependency */ = {\n", xcDependencyID);
+ fprintf(out, "\t\t\tisa = PBXTargetDependency;\n");
+ fprintf(out, "\t\t\ttarget = %s /* %s */;\n", xcTargetID, name);
+ fprintf(out, "\t\t\ttargetProxy = %s /* PBXContainerItemProxy */;\n", xcProxyID);
+ fprintf(out, "\t\t};\n");
+ delete depTgtDBp;
+ }
+ }
+ return 0;
+ }
+
+ /*
+ * Collect all the target dependencies from all targets and write them into
+ * this section.
+ */
+ int writeTargetDependencySection(FILE *out) {
+ int i;
+ fprintf(out, "/* Begin PBXTargetDependency section */\n");
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeTargetDependency(out, targetDB);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeTargetDependency(out, targetDB);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeTargetDependency(out, targetDB);
+ }
+ fprintf(out, "/* End PBXTargetDependency section */\n\n");
+ return 0;
+ }
+
+ /*
+ *
+ */
+ int writeProjectBuildConfiguration(FILE *out) {
+ // --- project build configuration (Debug)
+ fprintf(out, "\t\t%s /* Debug */ = {\n", xcBuildConfigurationDebugID);
+ fprintf(out, "\t\t\tisa = XCBuildConfiguration;\n");
+ fprintf(out, "\t\t\tbuildSettings = {\n");
+ fprintf(out, "\t\t\t\tCOPY_PHASE_STRIP = NO;\n");
+ fprintf(out, "\t\t\t\tGCC_ENABLE_TRIGRAPHS = YES;\n");
+ fprintf(out, "\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n");
+ fprintf(out, "\t\t\t\tGCC_PFE_FILE_C_DIALECTS = \"c c++\";\n");
+ fprintf(out, "\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n");
+ fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"$(SDKROOT)/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h\";\n");
+ fprintf(out, "\t\t\t\tGCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;\n");
+ fprintf(out, "\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.2;\n");
+ fprintf(out, "\t\t\t\tSDKROOT = \"$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk\";\n");
+ fprintf(out, "\t\t\t\tUSER_HEADER_SEARCH_PATHS = ../../jpeg;\n");
+ fprintf(out, "\t\t\t\tWARNING_CFLAGS = \"\";\n");
+ fprintf(out, "\t\t\t};\n");
+ fprintf(out, "\t\t\tname = Debug;\n");
+ fprintf(out, "\t\t};\n");
+ // --- project build configuration (Debug)
+ fprintf(out, "\t\t%s /* Release */ = {\n", xcBuildConfigurationReleaseID);
+ fprintf(out, "\t\t\tisa = XCBuildConfiguration;\n");
+ fprintf(out, "\t\t\tbuildSettings = {\n");
+ fprintf(out, "\t\t\t\tARCHS = \"$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)\";\n");
+ fprintf(out, "\t\t\t\tARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = \"ppc i386 x86_64\";\n");
+ fprintf(out, "\t\t\t\tCOPY_PHASE_STRIP = YES;\n");
+ fprintf(out, "\t\t\t\tGCC_GENERATE_DEBUGGING_SYMBOLS = NO;\n");
+ fprintf(out, "\t\t\t\tGCC_PFE_FILE_C_DIALECTS = \"c c++\";\n");
+ fprintf(out, "\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n");
+ fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"$(SDKROOT)/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h\";\n");
+ fprintf(out, "\t\t\t\tGCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;\n");
+ fprintf(out, "\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.3;\n");
+ fprintf(out, "\t\t\t\tSDKROOT = \"$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk\";\n");
+ fprintf(out, "\t\t\t\tUSER_HEADER_SEARCH_PATHS = ../../jpeg;\n");
+ fprintf(out, "\t\t\t\tVALID_ARCHS = \"i386 ppc x86_64\";\n");
+ fprintf(out, "\t\t\t\tWARNING_CFLAGS = \"\";\n");
+ fprintf(out, "\t\t\t};\n");
+ fprintf(out, "\t\t\tname = Release;\n");
+ fprintf(out, "\t\t};\n");
+ return 0;
+ }
+
+ /*
+ *
+ */
+ int writeApplicationBuildConfiguration(FILE *out, Fl_Preferences &targetDB) {
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcBuildConfigurationDebugID, targetDB);
+ fprintf(out, "\t\t%s /* Debug */ = {\n", xcBuildConfigurationDebugID);
+ fprintf(out, "\t\t\tisa = XCBuildConfiguration;\n");
+ fprintf(out, "\t\t\tbuildSettings = {\n");
+ fprintf(out, "\t\t\t\tCOPY_PHASE_STRIP = NO;\n");
+ fprintf(out, "\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n");
+ fprintf(out, "\t\t\t\tGCC_ENABLE_FIX_AND_CONTINUE = YES;\n");
+ fprintf(out, "\t\t\t\tGCC_MODEL_TUNING = G5;\n");
+ fprintf(out, "\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n");
+ fprintf(out, "\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n");
+ fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h\";\n");
+ fprintf(out, "\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = \"USING_XCODE=1\";\n");
+ fprintf(out, "\t\t\t\tHEADER_SEARCH_PATHS = (\n");
+ fprintf(out, "\t\t\t\t\t../../ide/XCode3/,\n");
+ fprintf(out, "\t\t\t\t\t../../,\n");
+ fprintf(out, "\t\t\t\t\t../../png,\n");
+ fprintf(out, "\t\t\t\t);\n");
+ fprintf(out, "\t\t\t\tINFOPLIST_FILE = \"plists/%s-Info.plist\";\n", name);
+ fprintf(out, "\t\t\t\tINSTALL_PATH = /Applications;\n");
+ fprintf(out, "\t\t\t\tOTHER_LDFLAGS = (\n");
+ fprintf(out, "\t\t\t\t\t\"-framework\",\n");
+ fprintf(out, "\t\t\t\t\tCarbon,\n");
+ fprintf(out, "\t\t\t\t);\n");
+ fprintf(out, "\t\t\t\tPREBINDING = NO;\n");
+ fprintf(out, "\t\t\t\tPRODUCT_NAME = %s;\n", name);
+ fprintf(out, "\t\t\t\tUSER_HEADER_SEARCH_PATHS = \"\";\n");
+ fprintf(out, "\t\t\t\tWRAPPER_EXTENSION = app;\n");
+ fprintf(out, "\t\t\t\tZERO_LINK = YES;\n");
+ fprintf(out, "\t\t\t};\n");
+ fprintf(out, "\t\t\tname = Debug;\n");
+ fprintf(out, "\t\t};\n");
+ MAKE_XCID(xcBuildConfigurationReleaseID, targetDB);
+ fprintf(out, "\t\t%s /* Release */ = {\n", xcBuildConfigurationReleaseID);
+ fprintf(out, "\t\t\tisa = XCBuildConfiguration;\n");
+ fprintf(out, "\t\t\tbuildSettings = {\n");
+ fprintf(out, "\t\t\t\tCOPY_PHASE_STRIP = YES;\n");
+ fprintf(out, "\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n");
+ fprintf(out, "\t\t\t\tGCC_ENABLE_FIX_AND_CONTINUE = NO;\n");
+ fprintf(out, "\t\t\t\tGCC_MODEL_TUNING = G5;\n");
+ fprintf(out, "\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;\n");
+ fprintf(out, "\t\t\t\tGCC_PREFIX_HEADER = \"$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h\";\n");
+ fprintf(out, "\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = \"USING_XCODE=1\";\n");
+ fprintf(out, "\t\t\t\tHEADER_SEARCH_PATHS = (\n");
+ fprintf(out, "\t\t\t\t\t../../ide/XCode3/,\n");
+ fprintf(out, "\t\t\t\t\t../../,\n");
+ fprintf(out, "\t\t\t\t\t../../png,\n");
+ fprintf(out, "\t\t\t\t);\n");
+ fprintf(out, "\t\t\t\tINFOPLIST_FILE = \"plists/%s-Info.plist\";\n", name);
+ fprintf(out, "\t\t\t\tINSTALL_PATH = /Applications;\n");
+ fprintf(out, "\t\t\t\tOTHER_LDFLAGS = (\n");
+ fprintf(out, "\t\t\t\t\t\"-framework\",\n");
+ fprintf(out, "\t\t\t\t\tCarbon,\n");
+ fprintf(out, "\t\t\t\t);\n");
+ fprintf(out, "\t\t\t\tPREBINDING = NO;\n");
+ fprintf(out, "\t\t\t\tPRODUCT_NAME = %s;\n", name);
+ fprintf(out, "\t\t\t\tUSER_HEADER_SEARCH_PATHS = \"\";\n");
+ fprintf(out, "\t\t\t\tWRAPPER_EXTENSION = app;\n");
+ fprintf(out, "\t\t\t\tZERO_LINK = NO;\n");
+ fprintf(out, "\t\t\t};\n");
+ fprintf(out, "\t\t\tname = Release;\n");
+ fprintf(out, "\t\t};\n");
+ }
+
+ /*
+ *
+ */
+ int writeFrameworkBuildConfiguration(FILE *out, Fl_Preferences &targetDB) {
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcBuildConfigurationDebugID, targetDB);
+ fprintf(out, "\t\t%s /* Debug */ = {\n", xcBuildConfigurationDebugID);
+ fprintf(out, "\t\t\tisa = XCBuildConfiguration;\n");
+ fprintf(out, "\t\t\tbuildSettings = {\n");
+ fprintf(out, "\t\t\t\tALWAYS_SEARCH_USER_PATHS = YES;\n");
+ fprintf(out, "\t\t\t\tCOPY_PHASE_STRIP = NO;\n");
+ fprintf(out, "\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n");
+ fprintf(out, "\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n");
+ fprintf(out, "\t\t\t\tEXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = \"*.nib *.lproj *.framework *.gch (*) CVS .svn *.xcodeproj *.xcode *.pbproj *.pbxproj\";\n");
+ fprintf(out, "\t\t\t\tFRAMEWORK_VERSION = A;\n");
+ fprintf(out, "\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n");
+ fprintf(out, "\t\t\t\tGCC_ENABLE_FIX_AND_CONTINUE = YES;\n");
+ fprintf(out, "\t\t\t\tGCC_MODEL_TUNING = G5;\n");
+ fprintf(out, "\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n");
+ fprintf(out, "\t\t\t\tGCC_PFE_FILE_C_DIALECTS = \"c c++ objective-c++\";\n");
+ fprintf(out, "\t\t\t\tHEADER_SEARCH_PATHS = (\n");
+ fprintf(out, "\t\t\t\t\t../../ide/XCode3/,\n");
+ fprintf(out, "\t\t\t\t\t../../,\n");
+ fprintf(out, "\t\t\t\t);\n");
+ fprintf(out, "\t\t\t\tINFOPLIST_FILE = \"plists/%s-Info.plist\";\n", name);
+ fprintf(out, "\t\t\t\tINSTALL_PATH = \"@executable_path/../Frameworks\";\n");
+ fprintf(out, "\t\t\t\tOTHER_LDFLAGS = (\n");
+ fprintf(out, "\t\t\t\t\t\"-framework\",\n");
+ fprintf(out, "\t\t\t\t\tCarbon,\n");
+ fprintf(out, "\t\t\t\t\t\"-framework\",\n");
+ fprintf(out, "\t\t\t\t\tCocoa,\n");
+ fprintf(out, "\t\t\t\t);\n");
+ fprintf(out, "\t\t\t\tPREBINDING = NO;\n");
+ fprintf(out, "\t\t\t\tPRODUCT_NAME = %s;\n", name);
+ fprintf(out, "\t\t\t\tUSER_HEADER_SEARCH_PATHS = \"\";\n");
+ fprintf(out, "\t\t\t\tWARNING_CFLAGS = \"-Wno-format-nonliteral\";\n");
+ fprintf(out, "\t\t\t\tZERO_LINK = YES;\n");
+ fprintf(out, "\t\t\t};\n");
+ fprintf(out, "\t\t\tname = Debug;\n");
+ fprintf(out, "\t\t};\n");
+ MAKE_XCID(xcBuildConfigurationReleaseID, targetDB);
+ fprintf(out, "\t\t%s /* Release */ = {\n", xcBuildConfigurationReleaseID);
+ fprintf(out, "\t\t\tisa = XCBuildConfiguration;\n");
+ fprintf(out, "\t\t\tbuildSettings = {\n");
+ fprintf(out, "\t\t\t\tALWAYS_SEARCH_USER_PATHS = YES;\n");
+ fprintf(out, "\t\t\t\tCOPY_PHASE_STRIP = YES;\n");
+ fprintf(out, "\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n");
+ fprintf(out, "\t\t\t\tDYLIB_COMPATIBILITY_VERSION = 1;\n");
+ fprintf(out, "\t\t\t\tDYLIB_CURRENT_VERSION = 1;\n");
+ fprintf(out, "\t\t\t\tEXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = \"*.nib *.lproj *.framework *.gch (*) CVS .svn *.xcodeproj *.xcode *.pbproj *.pbxproj\";\n");
+ fprintf(out, "\t\t\t\tFRAMEWORK_VERSION = A;\n");
+ fprintf(out, "\t\t\t\tGCC_ENABLE_FIX_AND_CONTINUE = NO;\n");
+ fprintf(out, "\t\t\t\tGCC_MODEL_TUNING = G5;\n");
+ fprintf(out, "\t\t\t\tGCC_PFE_FILE_C_DIALECTS = \"c c++ objective-c++\";\n");
+ fprintf(out, "\t\t\t\tHEADER_SEARCH_PATHS = (\n");
+ fprintf(out, "\t\t\t\t../../ide/XCode3/,\n");
+ fprintf(out, "\t\t\t\t../../,\n");
+ fprintf(out, "\t\t\t\t);\n");
+ fprintf(out, "\t\t\t\tINFOPLIST_FILE = \"plists/%s-Info.plist\";\n", name);
+ fprintf(out, "\t\t\t\tINSTALL_PATH = \"@executable_path/../Frameworks\";\n");
+ fprintf(out, "\t\t\t\tMACOSX_DEPLOYMENT_TARGET = 10.2;\n");
+ fprintf(out, "\t\t\t\tOTHER_LDFLAGS = (\n");
+ fprintf(out, "\t\t\t\t\"-framework\",\n");
+ fprintf(out, "\t\t\t\tCocoa,\n");
+ fprintf(out, "\t\t\t\t\"-framework\",\n");
+ fprintf(out, "\t\t\t\tCarbon,\n");
+ fprintf(out, "\t\t\t\t);\n");
+ fprintf(out, "\t\t\t\tPREBINDING = NO;\n");
+ fprintf(out, "\t\t\t\tPRODUCT_NAME = %s;\n", name);
+ fprintf(out, "\t\t\t\tSDKROOT = \"\";\n");
+ fprintf(out, "\t\t\t\tUSER_HEADER_SEARCH_PATHS = \"\";\n");
+ fprintf(out, "\t\t\t\tWARNING_CFLAGS = \"-Wno-format-nonliteral\";\n");
+ fprintf(out, "\t\t\t\tZERO_LINK = NO;\n");
+ fprintf(out, "\t\t\t};\n");
+ fprintf(out, "\t\t\tname = Release;\n");
+ fprintf(out, "\t\t};\n");
+ }
+
+ /*
+ * This block contains build configurations for every target and project
+ */
+ int writeBuildConfigurationSection(FILE *out) {
+ writeProjectBuildConfiguration(out);
+ int i;
+ fprintf(out, "/* Begin XCBuildConfiguration section */\n");
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeApplicationBuildConfiguration(out, targetDB);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeFrameworkBuildConfiguration(out, targetDB);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeApplicationBuildConfiguration(out, targetDB);
+ }
+ fprintf(out, "/* End XCBuildConfiguration section */\n\n");
+ return 0;
+ }
+
+ /*
+ * Write the build onfiguration list for the entire project.
+ */
+ int writeProjectConfigurationList(FILE *out) {
+ fprintf(out, "\t\t%s /* Build configuration list for PBXProject \"%s\" */ = {\n", xcBuildConfigurationListID, projectName);
+ fprintf(out, "\t\t\tisa = XCConfigurationList;\n");
+ fprintf(out, "\t\t\tbuildConfigurations = (\n");
+ fprintf(out, "\t\t\t\t%s /* Debug */,\n", xcBuildConfigurationDebugID);
+ fprintf(out, "\t\t\t\t%s /* Release */,\n", xcBuildConfigurationReleaseID);
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\tdefaultConfigurationIsVisible = 0;\n");
+ fprintf(out, "\t\t\tdefaultConfigurationName = Debug;\n");
+ fprintf(out, "\t\t};\n");
+ }
+
+ /*
+ * Write the build onfiguration list for the entire project.
+ */
+ int writeTargetConfigurationList(FILE *out, Fl_Preferences &targetDB) {
+ char name[80]; targetDB.get("name", name, "DBERROR", 80);
+ MAKE_XCID(xcBuildConfigurationListID, targetDB);
+ MAKE_XCID(xcBuildConfigurationDebugID, targetDB);
+ MAKE_XCID(xcBuildConfigurationReleaseID, targetDB);
+ fprintf(out, "\t\t%s /* Build configuration list for PBXProject \"%s\" */ = {\n", xcBuildConfigurationListID, name);
+ fprintf(out, "\t\t\tisa = XCConfigurationList;\n");
+ fprintf(out, "\t\t\tbuildConfigurations = (\n");
+ fprintf(out, "\t\t\t\t%s /* Debug */,\n", xcBuildConfigurationDebugID);
+ fprintf(out, "\t\t\t\t%s /* Release */,\n", xcBuildConfigurationReleaseID);
+ fprintf(out, "\t\t\t);\n");
+ fprintf(out, "\t\t\tdefaultConfigurationIsVisible = 0;\n");
+ fprintf(out, "\t\t\tdefaultConfigurationName = Debug;\n");
+ fprintf(out, "\t\t};\n");
+ return 0;
+ }
+
+ /*
+ * This block contains arrays to the available build configurations
+ */
+ int writeConfigurationListSection(FILE *out) {
+ int i;
+ fprintf(out, "/* Begin XCConfigurationList section */\n");
+ // --- project configuration list
+ writeProjectConfigurationList(out);
+ // --- configuration list for all targets
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writeTargetConfigurationList(out, targetDB);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writeTargetConfigurationList(out, targetDB);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writeTargetConfigurationList(out, targetDB);
+ }
+ fprintf(out, "/* End XCConfigurationList section */\n\n");
+ return 0;
+ }
+
+ /*
+ * Write the project definition file
+ */
+ int writeProjectFile(const char *filepath) {
+ char filename[2048];
+ snprintf(filename, 2047, "%s/project.pbxproj", filepath);
+ FILE *out = fopen(filename, "wb");
+ if (!out) {
+ fl_alert("Can't open file:\n%s", filename);
+ return -1;
+ }
+ fprintf(out,
+ "// !$*UTF8*$!\n" "{\n" "\tarchiveVersion = 1;\n" "\tclasses = {\n"
+ "\t};\n" "\tobjectVersion = 44;\n" "\tobjects = {\n\n");
+ writeBuildFileSection(out);
+ writeBuildRuleSection(out);
+ writeContainerItemProxySection(out);
+ writeCopyFilesBuildPhaseSection(out);
+ writeFileReferenceSection(out);
+ writeFrameworksBuildPhaseSection(out);
+ writeGroupSection(out);
+ writeHeadersBuildPhaseSection(out);
+ writeNativeTargetSection(out);
+ writeProjectSection(out);
+ writeResourcesBuildPhaseSection(out);
+ writeSourcesBuildPhaseSection(out);
+ writeTargetDependencySection(out);
+ writeBuildConfigurationSection(out);
+ writeConfigurationListSection(out);
+ fprintf(out,
+ "\t};\n"
+ "\trootObject = %s /* Project object */;\n"
+ "}\n", xcRootNodeID);
+
+ fclose(out);
+ return 0;
+ }
+
+ int writeConfigH(const char *filepath) {
+ // FIXME: LATER: do we want to do that?
+ return 0;
+ }
+
+ int createIcons(const char *filepath) {
+ // FIXME: LATER: create a minimum set of icon files?
+ return 0;
+ }
+
+ /*
+ * create a single plists/[name]-Info.plist
+ */
+ int writePList(const char *filepath, Fl_Preferences &target_db, int fmwk=0) {
+ char name[80]; target_db.get("name", name, "DBERROR", 79);
+ char filename[2048];
+ snprintf(filename, 2047, "%s/%s-Info.plist", filepath, name);
+ FILE *f = fopen(filename, "wb");
+ fprintf(f, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ fprintf(f, "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n");
+ fprintf(f, "<plist version=\"1.0\">\n");
+ fprintf(f, "<dict>\n");
+ fprintf(f, "\t<key>CFBundleDevelopmentRegion</key>\n");
+ fprintf(f, "\t<string>English</string>\n");
+ fprintf(f, "\t<key>CFBundleExecutable</key>\n");
+ fprintf(f, "\t<string>${EXECUTABLE_NAME}</string>\n");
+ fprintf(f, "\t<key>CFBundleIdentifier</key>\n");
+ fprintf(f, "\t<string>org.fltk.%s</string>\n", name);
+ fprintf(f, "\t<key>CFBundleInfoDictionaryVersion</key>\n");
+ fprintf(f, "\t<string>6.0</string>\n");
+ fprintf(f, "\t<key>CFBundlePackageType</key>\n");
+ if (fmwk)
+ fprintf(f, "\t<string>FMWK</string>\n");
+ else
+ fprintf(f, "\t<string>APPL</string>\n");
+ fprintf(f, "\t<key>CFBundleSignature</key>\n");
+ fprintf(f, "\t<string>FLTK</string>\n");
+ fprintf(f, "\t<key>CFBundleVersion</key>\n");
+ fprintf(f, "\t<string>1.0</string>\n");
+ fprintf(f, "</dict>\n");
+ fprintf(f, "\t</plist>\n");
+ fclose(f);
+ return 0;
+ }
+
+ /*
+ * Create the plist files for all apps and tests
+ */
+ int writePLists(const char *filepath) {
+ int i;
+ for (i=0; i<nTgtApps; i++) {
+ Fl_Preferences targetDB(tgtAppsDB, i);
+ writePList(filepath, targetDB, 0);
+ }
+ for (i=0; i<nTgtLibs; i++) {
+ Fl_Preferences targetDB(tgtLibsDB, i);
+ writePList(filepath, targetDB, 1);
+ }
+ for (i=0; i<nTgtTests; i++) {
+ Fl_Preferences targetDB(tgtTestsDB, i);
+ writePList(filepath, targetDB, 0);
+ }
+ return 0;
+ }
+
+ /*
+ * Write the entire system of files.
+ */
+ int write() {
+ char filepath[2048];
+ // --- create directory structure ide/Xcode3
+ sprintf(filepath, "%s/ide", rootDir); fl_mkdir(filepath, 0777);
+ sprintf(filepath, "%s/ide/Xcode3", rootDir); fl_mkdir(filepath, 0777);
+ // --- create project.pbxproj
+ sprintf(filepath, "%s/ide/Xcode3/FLTK.xcodeproj", rootDir); fl_mkdir(filepath, 0777);
+ writeProjectFile(filepath);
+ // --- FIXME: LATER: should we create config.h here?
+ writeConfigH(filepath);
+ // --- FIXME: LATER: create default icons (maybe import icons for apps?)
+ sprintf(filepath, "%s/ide/Xcode3/icons", rootDir); fl_mkdir(filepath, 0777);
+ createIcons(filepath);
+ // --- create plists/[name]-Info.plist
+ sprintf(filepath, "%s/ide/Xcode3/plists", rootDir); fl_mkdir(filepath, 0777);
+ writePLists(filepath);
+ // --- close and finish
+ return 0;
+ }
+};
+
+
+// This creates all files needed to compile FLTK using Xcode.
+// create directory structure ide/Xcode3
+// create FLTK.xcodeproj directory
+// create project.pbxproj
+// create config.h
+// create icons
+// create plists/[name]-Info.plist
+void generate_fltk_Xcode3_support(const char *filename, const char *targetpath)
+{
+ Fl_Preferences *db =
+ new Fl_Preferences(filename, "fltk.org", 0);
+ Xcode3_IDE ide(*db, targetpath);
+ ide.write();
+ return;
+}
+
+
+extern int exit_early;
+
+class Fl_IDE_Xcode_Plugin : public Fl_Commandline_Plugin
+{
+public:
+ Fl_IDE_Xcode_Plugin() : Fl_Commandline_Plugin(name()) { }
+ const char *name() { return "ideXcode.fluid.fltk.org"; }
+ const char *help() { return
+ " --dbxcode3 <dbname> <targetpath> : create all IDE files for an Xcode3 project"; }
+ int arg(int argc, char **argv, int &i) {
+ if (argc>=i+1 && strcmp(argv[i], "--dbxcode3")==0) {
+ if (argc>=i+3 && argv[i+1][0]!='-' && argv[i+2][0]!='-') {
+ fprintf(stderr, "Creating Xcode3 IDE form %s in %s\n", argv[i+1], argv[i+2]);
+ exit_early = 1;
+ generate_fltk_Xcode3_support(argv[i+1], argv[i+2]);
+ i = i+3;
+ return 3;
+ } else {
+ fprintf(stderr, "Missing argument: --dbxcode3 <dbname> <targetpath>\n");
+ return 1;
+ }
+ }
+ return 0;
+ }
+};
+Fl_IDE_Xcode_Plugin IDE_Xcode_Plugin;
+
+/* Random bit of information:
+
+ ~/Library/Application Support/Developer/Shared/Xcode/Specifications/fluid.pbfilespec
+
+ {
+ Identifier = sourcecode.fluid;
+ BasedOn = sourcecode;
+ Extensions = (fl);
+ },
+
+*/
+
+//
+// End of "$Id: ide_xcode.cxx 6981 2009-12-25 20:53:22Z matt $".
+// \ No newline at end of file