build fltk version and deal with debian qt4 weirdness
authorDiane Trout <diane@caltech.edu>
Fri, 7 Apr 2006 22:40:55 +0000 (22:40 +0000)
committerDiane Trout <diane@caltech.edu>
Fri, 7 Apr 2006 22:40:55 +0000 (22:40 +0000)
Debian named the qt4 qmake/moc commands -qt4 which the standard cmake
has trouble finding so I manaullay looked for them.

additionally the fltk stuff doesn't look for .H as used for newer fltk
installations so I had to manually look for that as well.

CMakeLists.txt
Makefile.noqt
gui/CMakeLists.txt [new file with mode: 0644]
gui/module.mk
gui/mussa_fltk.cpp [new file with mode: 0644]
module.mk [deleted file]
mussa_fltk.cpp [deleted file]
qui/CMakeLists.txt

index 3a1331561becc4b2399286232629b0232904ecc8..0709be1e83c15f27147c9aa17c305757849e4f48 100644 (file)
@@ -10,4 +10,6 @@ SET (CXX_FLAGS "-g")
 # all of our source files al relative to the root of our project
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
 ADD_SUBDIRECTORY( alg )
+ADD_SUBDIRECTORY( gui )
 ADD_SUBDIRECTORY( qui )
+
index 8599b3fbc3f88879c7b7526a4b2a2c1f33ea4d82..e3c0a759828b55509e32a0139baac469661cb0f5 100644 (file)
@@ -27,7 +27,6 @@ include alg/module.mk
 include alg/test/module.mk
 include py/module.mk
 include gui/module.mk
-include module.mk
 
 # process what the module.mks defined
 OBJ := $(patsubst %.cpp,%.o, $(filter %.cpp,$(SRC))) 
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
new file mode 100644 (file)
index 0000000..01169b5
--- /dev/null
@@ -0,0 +1,33 @@
+# recent versions of FLTK on debian have FL/Fl.H instead of Fl.h
+FIND_PATH(FLTK_INCLUDE_DIR FL/Fl.H /usr/include)
+FIND_LIBRARY(FLTK_LIBRARY fltk /usr/lib )
+
+IF(FLTK_INCLUDE_DIR)
+  SET(FLTK_FOUND 1)
+ENDIF(FLTK_INCLUDE_DIR)
+
+FIND_PACKAGE(Boost)
+
+SET(SOURCES 
+      AnnotWindow.cpp
+      ConnView.cpp
+      ConnWindow.cpp
+      MotifWindow.cpp
+      mussa_fltk.cpp
+      SeqTextWindow.cpp
+      SeqView.cpp
+      SeqWindow.cpp
+      SetupWindow.cpp
+      SubAnalysisWindow.cpp
+    )
+
+IF(FLTK_FOUND)
+  ADD_EXECUTABLE(mussa_fltk WIN32 MACOSX_BUNDLE ${SOURCES})
+  LINK_DIRECTORIES(${MUSSA_BINARY_DIR}/alg)
+  TARGET_LINK_LIBRARIES(mussa_fltk 
+                            mussa_core
+                           ${BOOST_FILESYSTEM_LIB}
+                           ${FLTK_LIBRARY})
+ELSE(FLTK_FOUND)
+  MESSAGE(STATUS "Not building old FTLK version")
+ENDIF(FLTK_FOUND)
index 255f172de9fd172f26baf0791b41e2ab5cf8f219..3204672e53057e006e491f4660a502792a011857 100644 (file)
@@ -4,6 +4,7 @@ SOURCES.cpp := AnnotWindow.cpp \
                ConnView.cpp \
                ConnWindow.cpp \
                MotifWindow.cpp \
+              mussa_fltk.cpp \
                SeqTextWindow.cpp \
                SeqView.cpp \
                SeqWindow.cpp \
@@ -14,4 +15,10 @@ MUSSA_FLTK_SRC := $(addprefix $(CURDIR), $(SOURCES.cpp))
 MUSSA_FLTK_OBJ := $(MUSSA_FLTK_SRC:.cpp=$(OBJEXT))
 
 SRC += $(MUSSA_FLTK_SRC)
-CXXFLAGS += 
+CXXFLAGS += -I$(BASEDIR)
+
+MUSSA := $(CURDIR)/mussa$(BINEXT)
+TARGETBITS += $(MUSSA)
+
+$(MUSSA): $(MUSSASRC:.cpp=$(OBJEXT)) $(MUSSA_FLTK_OBJ) $(MUSSA_ALG_OBJ)
+        g++ $(CXXFLAGS) -lfltk -o $@ $^
diff --git a/gui/mussa_fltk.cpp b/gui/mussa_fltk.cpp
new file mode 100644 (file)
index 0000000..92fe0b1
--- /dev/null
@@ -0,0 +1,190 @@
+//  This file is part of the Mussa source distribution.
+//  http://mussa.caltech.edu/
+//  Contact author: Tristan  De Buysscher, tristan@caltech.edu
+
+// This program and all associated source code files are Copyright (C) 2005
+// the California Institute of Technology, Pasadena, CA, 91125 USA.  It is
+// under the GNU Public License; please see the included LICENSE.txt
+// file for more information, or contact Tristan directly.
+
+
+#include "gui/ConnWindow.hpp"
+#include "alg/mussa.hpp"
+#include "mussa_exceptions.hpp"
+#include <iostream>
+using namespace std;
+
+char
+parse_args(int argc, char **argv, string *a_file_path, int *window, 
+           int *threshold, enum Mussa::analysis_modes *ana_mode, float *ent_thres);
+
+
+int main(int argc, char **argv) 
+{
+  Mussa an_analysis;
+  string a_file_path;
+  char * picked_file;
+  int window, threshold;
+  float ent_thres;
+  char run_mode;
+  enum Mussa::analysis_modes ana_mode;
+  int x_max=1000;
+  int y_max=500;
+  string err_msg;
+
+
+  err_msg = "";
+
+  // yeah, its horrible to be passing these by reference, but I just don't see
+  // any other way without making parse_args part of MussaClass, which just
+  // seems wrong (args are after all, an io type thing, and the gui only mode
+  // will have it own way as well...
+  run_mode = parse_args(argc, argv, &a_file_path, &window, &threshold,
+                       &ana_mode, &ent_thres);
+
+  cout << "mussa: run mode = " << run_mode;
+  cout << "\tfile_path = "<< a_file_path << endl;
+  cout << "mussa: ent_thres = " << ent_thres << endl;
+
+  // if no error from parse args (run_mode = 'e', ie error), run in proper mode
+  if (run_mode != 'e')
+  {
+    if ((run_mode == 'f') || (run_mode == 'n'))
+    {
+      an_analysis.load_mupa_file(a_file_path);
+      an_analysis.analyze(window, threshold, ana_mode, ent_thres);
+      //an_overlord.do_analysis();
+    }
+
+    if (run_mode == 'v')
+      an_analysis.load(a_file_path);
+      //an_overlord.get_analysis();
+
+    // no longer needed, but still semi-useful reality check...
+    if (run_mode == 'g')
+    {
+      cout << "GTV - All Gui, All the Time\n";
+    }
+
+    if (err_msg == "")
+    {
+      if  ((run_mode == 'f') || (run_mode == 'v') || (run_mode == 'g'))
+      {
+       //an_overlord.spawnConnView(1000,500);
+       ConnWindow *a_conn_win = new ConnWindow(x_max, y_max, "Mussa");
+
+       // we have an analysis already if in these 2 modes
+       if  ((run_mode == 'f') || (run_mode == 'v'))
+         a_conn_win->add_ana(&an_analysis);
+
+       Fl::run();
+      }
+    }
+    else
+      cout << err_msg << endl;
+  }
+}
+
+
+// minimal arg reading function, not very robust to errors
+char
+parse_args(int argc, char **argv, string *a_file_path, int *window, 
+           int *threshold, enum Mussa::analysis_modes *ana_mode, float *ent_thres)
+{
+  int i, else_i;
+  string an_arg;
+  char run_mode;
+
+  // initialize these to 0 as flag if they are not changed
+  *window = 0;
+  *threshold = 0;
+  *ent_thres = 0.0;
+  run_mode = 'e'; //error default if no run mode set implicitly or explicitly
+  *ana_mode = Mussa::TransitiveNway; // default to transitivie analyses mode
+
+  // no args means gui only mode
+  if (argc == 1)
+    run_mode = 'g';
+  else
+  {
+    else_i = 0;
+    i = 1;
+    while (i < argc)
+    {
+      an_arg = * ++argv;
+      i++;
+
+      // see what alternate mode the user wants to run in
+      if (an_arg == "-m")
+      {
+        an_arg = * ++argv;
+        i++;
+        if ( (an_arg == "v") || (an_arg == "n") ) //only 2 valid modes so far
+          run_mode = an_arg[0];
+        else
+        {
+          cout << "Error: \'" << an_arg;
+          cout << "\' is not a valid analysis mode for -a argument" << endl; 
+          throw cmdline_error("not valid -a argument");
+        }
+        *a_file_path = * ++argv;
+        i++;
+      }
+      // alternate analyses modes
+      else if (an_arg == "-a")
+      {
+        an_arg = * ++argv;
+        i++;
+        // t = transitive, r = radial, e = entropy
+        if (an_arg == "t") *ana_mode = Mussa::TransitiveNway;
+        else if (an_arg == "r") *ana_mode = Mussa::RadialNway;
+        else if (an_arg == "e") *ana_mode = Mussa::EntropyNway;
+        else
+        {
+          cout << "Error: \'" << an_arg;
+          cout << "\' is not a valid run mode for -m argument" << endl; 
+          throw cmdline_error("bad argument -m");
+        }
+      }
+      else if (an_arg == "-w") // alternate window size arg
+      {
+        *window = atoi(* ++argv);
+        i++;
+      }
+      else if (an_arg == "-t") // alternate threshold arg
+      {
+        *threshold = atoi(* ++argv);
+        i++;
+      }
+      else if (an_arg == "-et") // alternate entropy threshold arg
+      {
+        *ent_thres = atof(* ++argv);
+        i++;
+      }
+      else
+      {
+        if (else_i == 0)
+        {
+          *a_file_path = an_arg;
+          run_mode = 'f';
+          else_i++;
+        }
+        else
+        {
+          //cout << "Error, unknown arg: \'" << an_arg << "\'" << endl;
+          cout << "Error, too many filenames: \'" << an_arg << "\'" << endl;
+          run_mode == 'e';
+        }
+      }
+    }
+  }
+  return run_mode;
+}
+
+
+/*
+      cout << "fee\n";
+      cout << "fie\n";
+      cout << "foe\n";
+      cout << "fum\n";
+*/
diff --git a/module.mk b/module.mk
deleted file mode 100644 (file)
index b24137d..0000000
--- a/module.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-CURDIR := $(BASEDIR)
-
-SOURCES.cpp := mussa_fltk.cpp \
-                                                        #seqcomp.cxx \ #(old seqcomp)
-                                                        #mussa_nway_refine.cxx \ (broken code)
-
-MUSSASRC := $(addprefix $(CURDIR), $(SOURCES.cpp))
-
-SRC += $(MUSSASRC)
-CXXFLAGS += -I$(CURDIR)
-
-MUSSA := $(CURDIR)/mussa$(BINEXT) 
-TARGETBINS += $(MUSSA)
-
-$(MUSSA): $(MUSSASRC:.cpp=$(OBJEXT)) $(MUSSA_FLTK_OBJ) $(MUSSA_ALG_OBJ)
-       g++ $(CXXFLAGS) -lfltk -o $@ $^
diff --git a/mussa_fltk.cpp b/mussa_fltk.cpp
deleted file mode 100644 (file)
index 92fe0b1..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-//  This file is part of the Mussa source distribution.
-//  http://mussa.caltech.edu/
-//  Contact author: Tristan  De Buysscher, tristan@caltech.edu
-
-// This program and all associated source code files are Copyright (C) 2005
-// the California Institute of Technology, Pasadena, CA, 91125 USA.  It is
-// under the GNU Public License; please see the included LICENSE.txt
-// file for more information, or contact Tristan directly.
-
-
-#include "gui/ConnWindow.hpp"
-#include "alg/mussa.hpp"
-#include "mussa_exceptions.hpp"
-#include <iostream>
-using namespace std;
-
-char
-parse_args(int argc, char **argv, string *a_file_path, int *window, 
-           int *threshold, enum Mussa::analysis_modes *ana_mode, float *ent_thres);
-
-
-int main(int argc, char **argv) 
-{
-  Mussa an_analysis;
-  string a_file_path;
-  char * picked_file;
-  int window, threshold;
-  float ent_thres;
-  char run_mode;
-  enum Mussa::analysis_modes ana_mode;
-  int x_max=1000;
-  int y_max=500;
-  string err_msg;
-
-
-  err_msg = "";
-
-  // yeah, its horrible to be passing these by reference, but I just don't see
-  // any other way without making parse_args part of MussaClass, which just
-  // seems wrong (args are after all, an io type thing, and the gui only mode
-  // will have it own way as well...
-  run_mode = parse_args(argc, argv, &a_file_path, &window, &threshold,
-                       &ana_mode, &ent_thres);
-
-  cout << "mussa: run mode = " << run_mode;
-  cout << "\tfile_path = "<< a_file_path << endl;
-  cout << "mussa: ent_thres = " << ent_thres << endl;
-
-  // if no error from parse args (run_mode = 'e', ie error), run in proper mode
-  if (run_mode != 'e')
-  {
-    if ((run_mode == 'f') || (run_mode == 'n'))
-    {
-      an_analysis.load_mupa_file(a_file_path);
-      an_analysis.analyze(window, threshold, ana_mode, ent_thres);
-      //an_overlord.do_analysis();
-    }
-
-    if (run_mode == 'v')
-      an_analysis.load(a_file_path);
-      //an_overlord.get_analysis();
-
-    // no longer needed, but still semi-useful reality check...
-    if (run_mode == 'g')
-    {
-      cout << "GTV - All Gui, All the Time\n";
-    }
-
-    if (err_msg == "")
-    {
-      if  ((run_mode == 'f') || (run_mode == 'v') || (run_mode == 'g'))
-      {
-       //an_overlord.spawnConnView(1000,500);
-       ConnWindow *a_conn_win = new ConnWindow(x_max, y_max, "Mussa");
-
-       // we have an analysis already if in these 2 modes
-       if  ((run_mode == 'f') || (run_mode == 'v'))
-         a_conn_win->add_ana(&an_analysis);
-
-       Fl::run();
-      }
-    }
-    else
-      cout << err_msg << endl;
-  }
-}
-
-
-// minimal arg reading function, not very robust to errors
-char
-parse_args(int argc, char **argv, string *a_file_path, int *window, 
-           int *threshold, enum Mussa::analysis_modes *ana_mode, float *ent_thres)
-{
-  int i, else_i;
-  string an_arg;
-  char run_mode;
-
-  // initialize these to 0 as flag if they are not changed
-  *window = 0;
-  *threshold = 0;
-  *ent_thres = 0.0;
-  run_mode = 'e'; //error default if no run mode set implicitly or explicitly
-  *ana_mode = Mussa::TransitiveNway; // default to transitivie analyses mode
-
-  // no args means gui only mode
-  if (argc == 1)
-    run_mode = 'g';
-  else
-  {
-    else_i = 0;
-    i = 1;
-    while (i < argc)
-    {
-      an_arg = * ++argv;
-      i++;
-
-      // see what alternate mode the user wants to run in
-      if (an_arg == "-m")
-      {
-        an_arg = * ++argv;
-        i++;
-        if ( (an_arg == "v") || (an_arg == "n") ) //only 2 valid modes so far
-          run_mode = an_arg[0];
-        else
-        {
-          cout << "Error: \'" << an_arg;
-          cout << "\' is not a valid analysis mode for -a argument" << endl; 
-          throw cmdline_error("not valid -a argument");
-        }
-        *a_file_path = * ++argv;
-        i++;
-      }
-      // alternate analyses modes
-      else if (an_arg == "-a")
-      {
-        an_arg = * ++argv;
-        i++;
-        // t = transitive, r = radial, e = entropy
-        if (an_arg == "t") *ana_mode = Mussa::TransitiveNway;
-        else if (an_arg == "r") *ana_mode = Mussa::RadialNway;
-        else if (an_arg == "e") *ana_mode = Mussa::EntropyNway;
-        else
-        {
-          cout << "Error: \'" << an_arg;
-          cout << "\' is not a valid run mode for -m argument" << endl; 
-          throw cmdline_error("bad argument -m");
-        }
-      }
-      else if (an_arg == "-w") // alternate window size arg
-      {
-        *window = atoi(* ++argv);
-        i++;
-      }
-      else if (an_arg == "-t") // alternate threshold arg
-      {
-        *threshold = atoi(* ++argv);
-        i++;
-      }
-      else if (an_arg == "-et") // alternate entropy threshold arg
-      {
-        *ent_thres = atof(* ++argv);
-        i++;
-      }
-      else
-      {
-        if (else_i == 0)
-        {
-          *a_file_path = an_arg;
-          run_mode = 'f';
-          else_i++;
-        }
-        else
-        {
-          //cout << "Error, unknown arg: \'" << an_arg << "\'" << endl;
-          cout << "Error, too many filenames: \'" << an_arg << "\'" << endl;
-          run_mode == 'e';
-        }
-      }
-    }
-  }
-  return run_mode;
-}
-
-
-/*
-      cout << "fee\n";
-      cout << "fie\n";
-      cout << "foe\n";
-      cout << "fum\n";
-*/
index c085ca4cd0830abb8f9b7221a999e2333340ac4a..f01a15a5194502839db655d8a5f13a803abddcd1 100644 (file)
@@ -1,3 +1,7 @@
+#deal with some debian wierdness
+FIND_PROGRAM(QT_QMAKE_EXECUTABLE qmake-qt4 )
+FIND_PROGRAM(QT_MOC_EXECUTABLE moc-qt4 )
+
 FIND_PACKAGE(Qt4)
 SET(QT_USE_QTOPENGL 1)
 INCLUDE( ${QT_USE_FILE} )