From 0f45c3e5ac23c2cbf13b1e7d04c27251309da8e0 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 18 Feb 2010 13:05:02 +0000 Subject: 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 --- fluid/ide_support.cxx | 640 +++++++++++++++++++++++ fluid/ide_support.h | 101 ++++ fluid/ide_xcode.cxx | 1389 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2130 insertions(+) create mode 100644 fluid/ide_support.cxx create mode 100644 fluid/ide_support.h create mode 100644 fluid/ide_xcode.cxx 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 # 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 +#include +#include +#include + +#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; idepends_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 : 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 \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 +#include + + +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 +#include + +#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"); + 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\";\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\";\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"); + fprintf(f, "\n"); + fprintf(f, "\n"); + fprintf(f, "\n"); + fprintf(f, "\tCFBundleDevelopmentRegion\n"); + fprintf(f, "\tEnglish\n"); + fprintf(f, "\tCFBundleExecutable\n"); + fprintf(f, "\t${EXECUTABLE_NAME}\n"); + fprintf(f, "\tCFBundleIdentifier\n"); + fprintf(f, "\torg.fltk.%s\n", name); + fprintf(f, "\tCFBundleInfoDictionaryVersion\n"); + fprintf(f, "\t6.0\n"); + fprintf(f, "\tCFBundlePackageType\n"); + if (fmwk) + fprintf(f, "\tFMWK\n"); + else + fprintf(f, "\tAPPL\n"); + fprintf(f, "\tCFBundleSignature\n"); + fprintf(f, "\tFLTK\n"); + fprintf(f, "\tCFBundleVersion\n"); + fprintf(f, "\t1.0\n"); + fprintf(f, "\n"); + fprintf(f, "\t\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 : 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 \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 -- cgit v1.2.3