- Separate work in a main program and two libraries. This is experimental, and

ideally it should be a target to work towards decoupling
- Still more experimental, added support for visibility exports from DSOs. Need
testing from someone with GCC 4.0


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@206 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-01-26 18:31:23 +00:00
parent 1515b2065f
commit 26f88aa4cf
11 changed files with 368 additions and 17 deletions

View File

@ -1,3 +1,30 @@
2006-01-24 21:48 tchernobog
* trunk/doc/sgpem2dman.texi: - Added notes on glib::string,
glib::RefPtr<> e the c++ stdlib
2006-01-24 17:39 elvez
* trunk/doc/sgpem2dman.texi: Modified sgpem2dman.texi: -Adjusted
some code snippets whose style was inconsistent -Added an item for
operator overloading
2006-01-21 15:02 tchernobog
* trunk/configure.ac, trunk/src/Makefile.am,
trunk/src/builtin-policies,
trunk/src/builtin-policies/Makefile.am: - Added separate directory
for keeping builtin policies
2006-01-17 11:44 tchernobog
* trunk/configure.ac: - Change order when checking for glib / gtkmm
2006-01-17 10:23 tchernobog
* trunk/ChangeLog, trunk/configure.ac, trunk/m4/ac_pkg_swig.m4: -
Added fatal errors when swig isn't found - Downgraded gettext reqs
2006-01-15 19:40 tchernobog 2006-01-15 19:40 tchernobog
* trunk/ChangeLog, trunk/Makefile.am, trunk/configure.ac, * trunk/ChangeLog, trunk/Makefile.am, trunk/configure.ac,

View File

@ -74,9 +74,9 @@ dnl check for gtkmm & cairo
PKG_CHECK_MODULES([CAIRO], PKG_CHECK_MODULES([CAIRO],
[cairo >= $CAIRO_VERSION], [cairo >= $CAIRO_VERSION],
:, AC_MSG_ERROR([$CAIRO_PKG_ERRORS])) :, AC_MSG_ERROR([$CAIRO_PKG_ERRORS]))
dnl PKG_CHECK_MODULES([GLIB], PKG_CHECK_MODULES([GLIB],
dnl [glibmm-2.4 >= $GTKMM_VERSION], [glibmm-2.4 >= $GTKMM_VERSION],
dnl :, AC_MSG_ERROR([$GLIB_PKG_ERRORS])) :, AC_MSG_ERROR([$GLIB_PKG_ERRORS]))
PKG_CHECK_MODULES([GTHREAD], PKG_CHECK_MODULES([GTHREAD],
[gthread-2.0 >= $GTKMM_VERSION], [gthread-2.0 >= $GTKMM_VERSION],
:, AC_MSG_ERROR([$GTHREAD_PKG_ERRORS])) :, AC_MSG_ERROR([$GTHREAD_PKG_ERRORS]))
@ -84,6 +84,55 @@ PKG_CHECK_MODULES([GTKMM],
[gtkmm-2.4 >= $GTKMM_VERSION], [gtkmm-2.4 >= $GTKMM_VERSION],
:, AC_MSG_ERROR([$GTKMM_PKG_ERRORS])) :, AC_MSG_ERROR([$GTKMM_PKG_ERRORS]))
dnl use DSO visibility tags for systems that supports it correctly
dnl (for example, GCC 4.0 and above)
dnl see http://gcc.gnu.org/wiki/Visibility for more informations
AC_MSG_CHECKING([wheter if the compiler properly supports DSO visibility])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([], [
#if defined (GCC_HASCLASSVISIBILITY) || defined (WIN32)
return 0;
#else
bails out with a compilation error.
#endif
]),[
AC_MSG_RESULT([yes])
AH_VERBATIM([DLLEXPORT],[
// DSO visibility support enabled by configure
#ifdef WIN32
#define DLLIMPORT __declspec(dllimport)
#define DLLEXPORT __declspec(dllexport)
#define DLLLOCAL
#define DLLPUBLIC
#else
#define DLLIMPORT
#ifdef GCC_HASCLASSVISIBILITY
#define DLLEXPORT __attribute__ ((visibility("default")))
#define DLLLOCAL __attribute__ ((visibility("hidden")))
#define DLLPUBLIC __attribute__ ((visibility("default")))
#else
#define DLLEXPORT
#define DLLLOCAL
#define DLLPUBLIC
#endif
#endif
])
AC_CHECK_CXXFLAG([fvisibility=hidden])
AC_CHECK_CXXFLAG([fvisibility-inlines-hidden])
],[
AC_MSG_RESULT([no])
AH_VERBATIM([DLLEXPORT],[
// Proper DSO visibility is unsupported
#define DLLIMPORT
#define DLLEXPORT
#define DLLLOCAL
#define DLLPUBLIC
])
])
AC_LANG_POP
AC_CONFIG_HEADERS([config.h:config.h.in]) AC_CONFIG_HEADERS([config.h:config.h.in])
AC_CONFIG_FILES([ AC_CONFIG_FILES([
@ -93,6 +142,8 @@ m4/Makefile
po/Makefile.in po/Makefile.in
src/Makefile src/Makefile
src/builtin-policies/Makefile src/builtin-policies/Makefile
src/gtkgui/Makefile
src/pyloader/Makefile
src/testsuite/Makefile src/testsuite/Makefile
]) ])
AC_OUTPUT AC_OUTPUT

View File

@ -18,7 +18,7 @@
# along with SGPEMv2; if not, write to the Free Software # along with SGPEMv2; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SUBDIRS = testsuite builtin-policies SUBDIRS = builtin-policies gtkgui pyloader testsuite
#additional rules: #additional rules:
%_wrap.cc : %.i %_wrap.cc : %.i
@ -26,7 +26,6 @@ SUBDIRS = testsuite builtin-policies
# Program & library names # Program & library names
bin_PROGRAMS = sgpemv2 bin_PROGRAMS = sgpemv2
# lib_LTLIBRARIES =
# Other directories # Other directories
sharedir = @datadir@/sgpemv2 sharedir = @datadir@/sgpemv2
@ -37,15 +36,9 @@ localedir = @datadir@/locale
sgpemv2_CPPFLAGS = -I@top_srcdir@ \ sgpemv2_CPPFLAGS = -I@top_srcdir@ \
-DPYCDIR="\"$(pycdir)\"" \ -DPYCDIR="\"$(pycdir)\"" \
-DMODDIR="\"$(moddir)\"" \ -DMODDIR="\"$(moddir)\"" \
-DLOCALEDIR="\"$(localedir)\"" \ -DLOCALEDIR="\"$(localedir)\""
$(PYTHON_CPPFLAGS) sgpemv2_LDFLAGS = -L@builddir@/gtkgui -L@builddir@/pyloader
sgpemv2_CXXFLAGS = $(CAIRO_CFLAGS) \ sgpemv2_LDADD = -lgtkgui -lpyloader
$(GTKMM_CFLAGS)
sgpemv2_LDADD = $(PYTHON_LDFLAGS) \
$(PYTHON_EXTRA_LIBS) \
$(CAIRO_LIBS) \
$(GTKMM_LIBS)
sgpemv2_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS)
# Please keep this in sorted order: # Please keep this in sorted order:
sgpemv2_SOURCES = \ sgpemv2_SOURCES = \
@ -56,6 +49,3 @@ noinst_HEADERS = \
main.hh \ main.hh \
parseopts.hh parseopts.hh
# loadable python modules
mod_PYTHON = # policy.py

52
src/gtkgui/Makefile.am Normal file
View File

@ -0,0 +1,52 @@
# src/gtkgui/Makefile.am - Copyright 2005, 2006, University
# of Padova, dept. of Pure and Applied
# Mathematics
#
# This file is part of SGPEMv2.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# SGPEMv2 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SGPEMv2; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# If needed, setup testsuite for this component
# SUBDIRS = testsuite
# Program & library names
pkglib_LTLIBRARIES = libgtkgui.la
# Other directories
sharedir = @datadir@/sgpemv2
pycdir = $(sharedir)/policies
moddir = $(sharedir)/modules
localedir = @datadir@/locale
libgtkgui_la_CPPFLAGS = -I@top_srcdir@ \
-DPYCDIR="\"$(pycdir)\"" \
-DMODDIR="\"$(moddir)\"" \
-DLOCALEDIR="\"$(localedir)\""
libgtkgui_la_CXXFLAGS = \
$(CAIRO_CFLAGS) \
$(GTKMM_CFLAGS)
libgtkgui_la_LIBADD = \
$(CAIRO_LIBS) \
$(GTKMM_LIBS)
# Please keep this in sorted order:
libgtkgui_la_SOURCES = \
mainwindow.cc \
startgui.cc
noinst_HEADERS = \
mainwindow.hh \
startgui.hh

31
src/gtkgui/mainwindow.cc Normal file
View File

@ -0,0 +1,31 @@
// src/gtkgui/mainwindow.cc - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "config.h"
#include "gettext.h"
#include "mainwindow.hh"
#include <gtkmm/main.h>
#include <gtkmm/window.h>
MainWindow::MainWindow() {}
MainWindow::~MainWindow() {}

49
src/gtkgui/mainwindow.hh Normal file
View File

@ -0,0 +1,49 @@
// src/gtkgui/mainwindow.hh - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef GTKGUI_MAINWINDOW_HH
#define GTKGUI_MAINWINDOW_HH 1
#include "config.h"
#include "gettext.h"
#include <gtkmm/window.h>
// ---------------------------------------------
//! The main program window
class MainWindow;
// ---------------------------------------------
/** This is the main simulation window displayed
* when the program is run with a GUI */
class MainWindow : public Gtk::Window {
public:
MainWindow();
virtual ~MainWindow();
private:
};
#endif

36
src/gtkgui/startgui.cc Normal file
View File

@ -0,0 +1,36 @@
// src/gtkgui/startgui.cc - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "config.h"
#include "gettext.h"
#include "mainwindow.hh"
#include "startgui.hh"
#include <gtkmm/main.h>
#include <gtkmm/window.h>
void DLLEXPORT
start_gui(int argc, char** argv) {
Gtk::Main gtk_main(argc,argv);
Gtk::Window main_window;
Gtk::Main::run(main_window);
}

29
src/gtkgui/startgui.hh Normal file
View File

@ -0,0 +1,29 @@
// src/gtkgui/startgui.hh - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef GTKGUI_STARTGUI_HH
#define GTKGUI_STARTGUI_HH 1
#include "config.h"
//! This function starts the whole GUI
void DLLEXPORT start_gui(int argc, char** argv);
#endif

View File

@ -21,7 +21,9 @@
#include "config.h" #include "config.h"
#include "gettext.h" #include "gettext.h"
#include "main.hh"
#include "parseopts.hh" #include "parseopts.hh"
#include "gtkgui/startgui.hh"
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
@ -63,5 +65,7 @@ main(int argc, char* argv[])
for_each(a_ptr, a_ptr+a_count, create_fnames_vect(filenames)); for_each(a_ptr, a_ptr+a_count, create_fnames_vect(filenames));
} }
start_gui(argc, argv);
return 0; return 0;
} }

27
src/main.hh Normal file
View File

@ -0,0 +1,27 @@
// src/main.cc - Copyright 2005, 2006, University
// of Padova, dept. of Pure and Applied
// Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef MAIN_HH
#define MAIN_HH 1
// found in gtkgui/mainwindow.hh
extern void build_gui(int argc, char** argv);
#endif

55
src/pyloader/Makefile.am Normal file
View File

@ -0,0 +1,55 @@
# src/pyloader/Makefile.am - Copyright 2005, 2006, University
# of Padova, dept. of Pure and Applied
# Mathematics
#
# This file is part of SGPEMv2.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# SGPEMv2 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SGPEMv2; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# you'll want to setup a testsuite for this component, sooner or later.
#SUBDIRS = testsuite
#additional rules:
%_wrap.cc : %.i
$(SWIG) $(SWIG_PYTHON_OPT) -o $@ $<
# Program & library names
pkglib_LTLIBRARIES = libpyloader.la
# Other directories
sharedir = @datadir@/sgpemv2
pycdir = $(sharedir)/policies
moddir = $(sharedir)/modules
localedir = @datadir@/locale
libpyloader_la_CPPFLAGS = -I@top_srcdir@ \
-DPYCDIR="\"$(pycdir)\"" \
-DMODDIR="\"$(moddir)\"" \
-DLOCALEDIR="\"$(localedir)\"" \
$(PYTHON_CPPFLAGS)
libpyloader_la_LIBADD = $(PYTHON_LDFLAGS) \
$(PYTHON_EXTRA_LIBS)
libpyloader_la_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS)
# Please keep this in sorted order:
libpyloader_la_SOURCES = empty.cc
noinst_HEADERS =
# !! temp file for debug, will be deleted as soon as
# !! source's in place
empty.cc :
echo "int main() {}" > @builddir@/$@