Author: matt
Date: 2011-07-28 06:20:09 -0700 (Thu, 28 Jul 2011)
New Revision: 8878
Log:
Added support for the Fluid CMake file (unverified!).

Added:
   branches/branch-3.0/fluid/file_cmake.cxx
Modified:
   branches/branch-3.0/fltk.flw
   branches/branch-3.0/fluid/CMakeLists.txt
   branches/branch-3.0/fluid/file.cxx

Modified: branches/branch-3.0/fltk.flw
===================================================================
--- branches/branch-3.0/fltk.flw        2011-07-28 13:09:22 UTC (rev 8877)
+++ branches/branch-3.0/fltk.flw        2011-07-28 13:20:09 UTC (rev 8878)
@@ -2,7 +2,7 @@
 version 3.0000 
 header_name {.h} 
 code_name {.cxx} 
-wks_name unnamed
+wks_name FLTK
 folder Applications {open
 } {
   app_target Fluid {open

Modified: branches/branch-3.0/fluid/CMakeLists.txt
===================================================================
--- branches/branch-3.0/fluid/CMakeLists.txt    2011-07-28 13:09:22 UTC (rev 
8877)
+++ branches/branch-3.0/fluid/CMakeLists.txt    2011-07-28 13:20:09 UTC (rev 
8878)
@@ -1,4 +1,3 @@
-
 set(CPPFILES
        CodeEditor.cxx
        Fl_Function_Type.cxx
@@ -14,35 +13,39 @@
        code.cxx
        factory.cxx
        file.cxx
+       file_cmake.cxx
+       file_make.cxx
+       file_visualc.cxx
+       file_xcode.cxx
        fluid.cxx
        function_panel.cxx
        template_panel.cxx
        undo.cxx
        widget_panel.cxx
+       workspace_panel.cxx
 )
-
 add_executable(fluid ${CPPFILES})
 target_link_libraries(fluid fltk fltk_images fltk_forms)
 
 # link in optional libraries
 if(FLTK_HAVE_CAIRO)
-   target_link_libraries(fluid fltk_cairo)
+    target_link_libraries(fluid fltk_cairo)
 endif(FLTK_HAVE_CAIRO)
 
 if(FLTK_USE_GL)
-   target_link_libraries(fluid fltk_gl)
-   target_link_libraries(fluid ${OPENGL_LIBRARIES})
+    target_link_libraries(fluid fltk_gl)
+    target_link_libraries(fluid ${OPENGL_LIBRARIES})
 endif(FLTK_USE_GL)
 
 if(USE_XFT)
-   target_link_libraries(fluid ${X11_Xft_LIB})
+    target_link_libraries(fluid ${X11_Xft_LIB})
 endif(USE_XFT)
 
 if(HAVE_XINERAMA)
-   target_link_libraries(fluid ${X11_Xinerama_LIB})
+    target_link_libraries(fluid ${X11_Xinerama_LIB})
 endif(HAVE_XINERAMA)
 
 install(TARGETS fluid
-   EXPORT fltk-install
-   DESTINATION ${PREFIX_BIN}
+    EXPORT fltk-install
+    DESTINATION ${PREFIX_BIN}
 )

Modified: branches/branch-3.0/fluid/file.cxx
===================================================================
--- branches/branch-3.0/fluid/file.cxx  2011-07-28 13:09:22 UTC (rev 8877)
+++ branches/branch-3.0/fluid/file.cxx  2011-07-28 13:20:09 UTC (rev 8878)
@@ -348,7 +348,7 @@
     write_string("\ncode_name"); write_word(code_file_name);
   }
   if (wks_name) {
-    write_string("\nwks_name %s", wks_name);
+    write_string("\nwks_name "); write_word(wks_name);
   }
   if (wks_env!=Fl_Environment_Choice::ENV_ALL) {
     write_string("\nwks_env %d", wks_env);

Added: branches/branch-3.0/fluid/file_cmake.cxx
===================================================================
--- branches/branch-3.0/fluid/file_cmake.cxx                            (rev 0)
+++ branches/branch-3.0/fluid/file_cmake.cxx    2011-07-28 13:20:09 UTC (rev 
8878)
@@ -0,0 +1,118 @@
+//
+// "$Id: file_cmake.cxx 8870 2011-07-26 21:19:35Z matt $"
+//
+// Fluid file routines for the Fast Light Tool Kit (FLTK).
+//
+// You may find the basic read_* and write_* routines to
+// be useful for other programs.  I have used them many times.
+// They are somewhat similar to tcl, using matching { and }
+// to quote strings.
+//
+// Copyright 1998-2010 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
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include "Fl_Type.h"
+#include "../fltk3/filename.h"
+
+// ------------ file conversion 
------------------------------------------------
+
+extern char *filename;
+
+int write_fltk_cmake() {
+  /* find the target named "Fluid" */
+  Fl_Type *tgt = Fl_Type::first;
+  while (tgt) {
+    if (tgt->is_target() && strcmp(tgt->name(), "Fluid")==0)
+      break;
+    tgt = tgt->next;
+  }
+  if (!tgt) {
+    printf("FLUID target not found\n");
+    return -1;
+  }
+  
+  /* Create a new CMakeLists.txt */
+  char buf[2048];
+  strcpy(buf, filename);
+  strcpy((char*)fltk3::filename_name(buf), "fluid/CMakeLists.txt");
+  FILE *out = fopen(buf, "wb");
+  if (!out) {
+    printf("Can't open FLUID CMakeLists.txt\n");
+    return -1;
+  }
+  
+  fprintf(out, "set(CPPFILES\n");
+  
+  Fl_Type *src = tgt->next;
+  while (src && src->level>tgt->level) {
+    if (src->is_file()) {
+      Fl_File_Type *f = (Fl_File_Type*)src;
+      const char *fn = f->filename();
+      if (fn) {
+        const char *ext = fltk3::filename_ext(fn);
+        if (ext && (strcmp(ext, ".cxx")==0 || strcmp(ext, ".cpp")==0)) {
+          fprintf(out, "\t%s\n", fltk3::filename_name(fn));
+        }
+      }
+    }
+    src = src->next;
+  }
+  
+  fprintf(out, ")\n");  
+  fprintf(out, "add_executable(fluid ${CPPFILES})\n");
+  fprintf(out, "target_link_libraries(fluid fltk fltk_images fltk_forms)\n");
+  fprintf(out, "\n");
+  fprintf(out, "# link in optional libraries\n");
+  fprintf(out, "if(FLTK_HAVE_CAIRO)\n");
+  fprintf(out, "    target_link_libraries(fluid fltk_cairo)\n");
+  fprintf(out, "endif(FLTK_HAVE_CAIRO)\n");
+  fprintf(out, "\n");
+  fprintf(out, "if(FLTK_USE_GL)\n");
+  fprintf(out, "    target_link_libraries(fluid fltk_gl)\n");
+  fprintf(out, "    target_link_libraries(fluid ${OPENGL_LIBRARIES})\n");
+  fprintf(out, "endif(FLTK_USE_GL)\n");
+  fprintf(out, "\n");
+  fprintf(out, "if(USE_XFT)\n");
+  fprintf(out, "    target_link_libraries(fluid ${X11_Xft_LIB})\n");
+  fprintf(out, "endif(USE_XFT)\n");
+  fprintf(out, "\n");
+  fprintf(out, "if(HAVE_XINERAMA)\n");
+  fprintf(out, "    target_link_libraries(fluid ${X11_Xinerama_LIB})\n");
+  fprintf(out, "endif(HAVE_XINERAMA)\n");
+  fprintf(out, "\n");
+  fprintf(out, "install(TARGETS fluid\n");
+  fprintf(out, "    EXPORT fltk-install\n");
+  fprintf(out, "    DESTINATION ${PREFIX_BIN}\n");
+  fprintf(out, ")\n");
+
+  fclose(out);
+  
+  return 0;
+}
+
+
+//
+// End of "$Id: file.cxx 8870 2011-07-26 21:19:35Z matt $".
+//

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

Reply via email to