# HG changeset patch # User Michael Guravage # Date 2010-05-03 13:45:32 # Node ID 41d0f8948f63bd50d01fe97f981cf56e12a5d7c7 # Parent bc8eb2c3f85f8a550dba98a0c70f8cf0ed45765c More concise project file directives. Windows NSIS installer. diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -3,6 +3,7 @@ syntax: glob *~ *.a +*.exe *.cache *.Debug *.o diff --git a/src/VirtualLeaf-install.nsi b/src/VirtualLeaf-install.nsi new file mode 100644 --- /dev/null +++ b/src/VirtualLeaf-install.nsi @@ -0,0 +1,101 @@ +# $Id$ + +# appends \ to the path if missing +# example: !insertmacro GetCleanDir "c:\blabla" +# Pop $0 => "c:\blabla\" +!macro GetCleanDir INPUTDIR + ; ATTENTION: USE ON YOUR OWN RISK! + ; Please report bugs here: http://stefan.bertels.org/ + !define Index_GetCleanDir 'GetCleanDir_Line${__LINE__}' + Push $R0 + Push $R1 + StrCpy $R0 "${INPUTDIR}" + StrCmp $R0 "" ${Index_GetCleanDir}-finish + StrCpy $R1 "$R0" "" -1 + StrCmp "$R1" "\" ${Index_GetCleanDir}-finish + StrCpy $R0 "$R0\" +${Index_GetCleanDir}-finish: + Pop $R1 + Exch $R0 + !undef Index_GetCleanDir +!macroend + +# similar to "RMDIR /r DIRECTORY", but does not remove DIRECTORY itself +# example: !insertmacro RemoveFilesAndSubDirs "$INSTDIR" +!macro RemoveFilesAndSubDirs DIRECTORY + # ATTENTION: USE ON YOUR OWN RISK! + # Please report bugs here: http://stefan.bertels.org/ + !define Index_RemoveFilesAndSubDirs 'RemoveFilesAndSubDirs_${__LINE__}' + + Push $R0 + Push $R1 + Push $R2 + + !insertmacro GetCleanDir "${DIRECTORY}" + Pop $R2 + FindFirst $R0 $R1 "$R2*.*" +${Index_RemoveFilesAndSubDirs}-loop: + StrCmp $R1 "" ${Index_RemoveFilesAndSubDirs}-done + StrCmp $R1 "." ${Index_RemoveFilesAndSubDirs}-next + StrCmp $R1 ".." ${Index_RemoveFilesAndSubDirs}-next + IfFileExists "$R2$R1\*.*" ${Index_RemoveFilesAndSubDirs}-directory + ; file + Delete "$R2$R1" + goto ${Index_RemoveFilesAndSubDirs}-next +${Index_RemoveFilesAndSubDirs}-directory: + ; directory + RMDir /r "$R2$R1" +${Index_RemoveFilesAndSubDirs}-next: + FindNext $R0 $R1 + Goto ${Index_RemoveFilesAndSubDirs}-loop +${Index_RemoveFilesAndSubDirs}-done: + FindClose $R0 + + Pop $R2 + Pop $R1 + Pop $R0 + !undef Index_RemoveFilesAndSubDirs +!macroend + +# set the name of the installer +outfile "VirtualLeaf-install.exe" + +# define the directory to install to +installDir C:\VirtualLeaf + +# Request application privileges +RequestExecutionLevel user + +# Pages +Page directory +Page instfiles + +# default section +section + + # define the output path for the Virtual Leaf executable + setOutPath $INSTDIR + file ..\bin\VirtualLeaf.exe + + # define the output path for the Virtual Leaf models + setOutPath $INSTDIR\models + file ..\bin\models\* + + # define uninstaller name + writeUninstaller $INSTDIR\uninstaller.exe + +# default section end +sectionEnd + +# create a section to define what the uninstaller does. +# the section will always be named "Uninstall" +section "Uninstall" + + # Always delete uninstaller first + delete $INSTDIR\uninstaller.exe + + # now delete installed file + !insertmacro RemoveFilesAndSubDirs "$INSTDIR" + +sectionEnd +# finis diff --git a/src/VirtualLeaf.pro b/src/VirtualLeaf.pro --- a/src/VirtualLeaf.pro +++ b/src/VirtualLeaf.pro @@ -19,6 +19,14 @@ # Copyright 2010 Roeland Merks. # +CONFIG -= release +CONFIG += debug +CONFIG += qt + +QMAKE_CXXFLAGS += -fexceptions +QMAKE_CXXFLAGS_DEBUG += -g3 +QMAKE_CXXFLAGS_DEBUG -= -DQDEBUG + #REACTIONS = reactions_auxin_growth.h #REACTIONS = reactions_meinhardt.h #REACTIONS = reactions_pce_growth.h @@ -27,11 +35,11 @@ DEFINES += REACTIONS_HEADER=$${REACTIONS DEFINES += REACTIONS_HEADER_STRING=\"$${REACTIONS}\" DEFINES += FLEMING -CONFIG += qt release PERLDIR = ./perl BINDIR = ../bin DESTDIR = $$BINDIR TARGET = VirtualLeaf +TEMPLATE = app PARTMPL = $${TARGET}par.tmpl MAINSRC = $${TARGET}.cpp QT -= network sql xml @@ -45,12 +53,12 @@ win32 { CONFIG += console LIBXML2DIR = C:\libxml2 LIBICONVDIR = C:\libiconv + LIBZDIR = C:\libz system(DEL parameter.cpp parameter.h) GRAPHICS = qt RC_FILE = VirtualLeaf.rc QMAKE_CXXFLAGS += -DLIBXML_STATIC - QMAKE_CXXFLAGS += -fexceptions -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include - QMAKE_CXXFLAGS_DEBUG += -DQDEBUG -ggdb3 -O0 + QMAKE_CXXFLAGS += -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include -I$${LIBZDIR}\include QMAKE_POST_LINK = "\ C:\Bin\cp release\VirtualLeaf.exe \ C:\Qt\4.5.3\bin\Qt3Support4.dll \ @@ -65,7 +73,7 @@ win32 { C:\bin\zlib1.dll \ C:\MinGW\bin\mingwm10.dll \ $${DESTDIR}" - LIBS += -L$${LIBXML2DIR}\lib -lxml2 -L$${LIBICONVDIR}\lib -lz -lm -lwsock32 -liconv + LIBS += -L$${LIBXML2DIR}\lib -lxml2 -L$${LIBICONVDIR}\lib -L$${LIBZDIR}\lib -lz -lm -lwsock32 -liconv } # Application icons @@ -89,8 +97,7 @@ unix { CC = /usr/bin/gcc QWTDIR = /ufs/guravage/opt/qwt-5.2.1-svn QMAKE_LIBDIR += $$QWTDIR/lib - QMAKE_CXXFLAGS += -fexceptions -I/usr/include/libxml2 - QMAKE_CXXFLAGS_DEBUG += -DQDEBUG -ggdb3 -O0 + QMAKE_CXXFLAGS += -I/usr/include/libxml2 QMAKE_LFLAGS += -fPIC LIBS += -lxml2 -lz -lm } diff --git a/src/VirtualLeaf_d.pro b/src/VirtualLeaf_d.pro deleted file mode 100644 --- a/src/VirtualLeaf_d.pro +++ /dev/null @@ -1,216 +0,0 @@ -# -# $Id$ -# -# This file is part of the Virtual Leaf. -# -# The Virtual Leaf 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 3 of the License, or -# (at your option) any later version. -# -# The Virtual Leaf 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 the Virtual Leaf. If not, see . -# -# Copyright 2010 Roeland Merks. -# - -#REACTIONS = reactions_auxin_growth.h -#REACTIONS = reactions_meinhardt.h -#REACTIONS = reactions_pce_growth.h -DEFINES += QTGRAPHICS -DEFINES += REACTIONS_HEADER=$${REACTIONS} -DEFINES += REACTIONS_HEADER_STRING=\"$${REACTIONS}\" -DEFINES += FLEMING - -CONFIG += qt debug -PERLDIR = ./perl -BINDIR = ../bin -DESTDIR = $$BINDIR -TARGET = VirtualLeaf -PARTMPL = $${TARGET}par.tmpl -MAINSRC = $${TARGET}.cpp -QT -= network sql xml -QT += qt3support - -!win32 { - GRAPHICS = qt #qwt -} - -win32 { - CONFIG += console - LIBXML2DIR = C:\libxml2 - LIBICONVDIR = C:\libiconv - system(DEL parameter.cpp parameter.h) - GRAPHICS = qt - RC_FILE = VirtualLeaf.rc - QMAKE_CXXFLAGS += -DLIBXML_STATIC - QMAKE_CXXFLAGS += -fexceptions -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include - QMAKE_CXXFLAGS_DEBUG += -DQDEBUG -ggdb3 -O0 - QMAKE_POST_LINK = "\ - C:\Bin\cp release\VirtualLeaf.exe \ - C:\Qt\4.5.3\bin\Qt3Support4.dll \ - C:\Qt\4.5.3\bin\QtGui4.dll \ - C:\Qt\4.5.3\bin\QtSql4.dll \ - C:\Qt\4.5.3\bin\QtXml4.dll \ - C:\Qt\4.5.3\bin\QtCore4.dll \ - C:\Qt\4.5.3\bin\QtNetwork4.dll \ - C:\Qt\4.5.3\bin\QtSvg4.dll \ - C:\bin\iconv.dll \ - C:\bin\libxml2.dll \ - C:\bin\zlib1.dll \ - C:\MinGW\bin\mingwm10.dll \ - $${DESTDIR}" - LIBS += -L$${LIBXML2DIR}\lib -lxml2 -L$${LIBICONVDIR}\lib -lz -lm -lwsock32 -liconv -} - -# Application icons -macx { - ICON = leaficon.icns - # make sure that the executable can find the libqwt share library - QMAKE_POST_LINK = "mkdir $${DESTDIR}/$${TARGET}.app/Contents/Frameworks; \ - cp /usr/local/qwt/lib/libqwt.dylib $${DESTDIR}/$${TARGET}.app/Contents/Frameworks/.; \ - #install_name_tool -change libqwt.5.dylib $$QWTDIR/lib/libqwt.dylib $${DESTDIR}/$${TARGET}.app/Contents/MacOS/$${TARGET}; \ - install_name_tool -id @executable_path/../Frameworks/libqwt.dylib $${DESTDIR}/$${TARGET}.app/Contents/Frameworks/libqwt.dylib; \ - install_name_tool -change libqwt.5.dylib @executable_path/../Frameworks/libqwt.dylib $${DESTDIR}/$${TARGET}.app/Contents/MacOS/$${TARGET};\ - cp leaficon.icns $${DESTDIR}/$${TARGET}.app; " -} - -macx:release { - LIBS+= -dead_strip -} - -unix { - system(rm -f parameter.cpp parameter.h) - CC = /usr/bin/gcc - QWTDIR = /ufs/guravage/opt/qwt-5.2.1-svn - QMAKE_LIBDIR += $$QWTDIR/lib - QMAKE_CXXFLAGS += -fexceptions -I/usr/include/libxml2 - QMAKE_CXXFLAGS_DEBUG += -DQDEBUG -ggdb3 -O0 - QMAKE_LFLAGS += -fPIC - LIBS += -lxml2 -lz -lm -} - -system(perl $$PERLDIR/make_parameter_source.pl $$PARTMPL) -system(perl $$PERLDIR/make_pardialog_source.pl $$PARTMPL) -#system(perl $$PERLDIR/make_xmlwritecode.pl -h $$REACTIONS) - -# Input -HEADERS += \ - apoplastitem.h \ - canvas.h \ - cellbase.h \ - cell.h \ - cellitem.h \ - forwardeuler.h \ - infobar.h \ - mainbase.h \ - mainbase.h \ - matrix.h \ - mesh.h \ - miscq.h \ - modelcatalogue.h \ - Neighbor.h \ - node.h \ - nodeitem.h \ - nodeset.h \ - OptionFileDialog.h \ - output.h \ - parameter.h \ - pardialog.h \ - parse.h \ - pi.h \ - qcanvasarrow.h \ - random.h \ - rungekutta.h \ - simitembase.h \ - simplugin.h \ - sqr.h \ - tiny.h \ - transporterdialog.h \ - UniqueMessage.h \ - vector.h \ - wallbase.h \ - wall.h \ - wallitem.h \ - warning.h \ - xmlwrite.h \ - $${PARTMPL} - -SOURCES += \ - apoplastitem.cpp \ - canvas.cpp \ - cellbase.cpp \ - cell.cpp \ - cellitem.cpp \ - forwardeuler.cpp \ - mainbase.cpp \ - matrix.cpp \ - mesh.cpp \ - miscq.cpp \ - modelcatalogue.cpp \ - Neighbor.cpp \ - node.cpp \ - nodeitem.cpp \ - nodeset.cpp \ - OptionFileDialog.cpp \ - output.cpp \ - parameter.cpp \ - pardialog.cpp \ - parse.cpp \ - random.cpp \ - rungekutta.cpp \ - simitembase.cpp \ - transporterdialog.cpp \ - UniqueMessage.cpp \ - vector.cpp \ - wallbase.cpp \ - wall.cpp \ - wallitem.cpp \ - warning.cpp \ - xmlwritecode.cpp \ - xmlwrite.cpp \ - $$MAINSRC - -contains( TARGET, leaf_fleming ) { - DEFINES += FLEMING -} - -contains(GRAPHICS, qwt) { - #macx:LIBS += -L$$QWTDIR/lib -lqwt - #win32:LIBS += -L$$QWTDIR/lib -lqwt5 - #LIBS += -L$$QWTDIR/lib -lqwt - INCLUDEPATH += $$QWTDIR/include - DEFINES += HAVE_QWT - HEADERS += data_plot.h - SOURCES += data_plot.cpp -} - -contains( GRAPHICS, qt ) { - message( "Building Qt executable" ) - QMAKE_CXXFLAGS += -DQTGRAPHICS # -fpermissive -} - -contains( GRAPHICS, xfig ) { - message("Building Xfig executable (background runnable).") - QMAKE_CXXFLAGS += -DXFIGGRAPHICS -} - -contains( GRAPHICS, x11 ) { - !unix { - error("X11 graphics only available on Unix systems.") - } - message("Building X11 executable") - SOURCES += x11graph.cpp - HEADERS += x11graph.h - QMAKE_CXXFLAGS += -DX11GRAPHICS - CONFIG -= qt - CONFIG += x11 - unix:LIBS += -lpng -} - -# finis diff --git a/src/build_models/plugin_auxingrowth.pro b/src/build_models/plugin_auxingrowth.pro --- a/src/build_models/plugin_auxingrowth.pro +++ b/src/build_models/plugin_auxingrowth.pro @@ -19,29 +19,34 @@ # Copyright 2010 Roeland Merks. # +CONFIG -= release +CONFIG += debug +CONFIG += plugin + BINDIR = ../../bin -CONFIG += plugin release DEFINES = QTGRAPHICS # VLEAFPLUGIN DESTDIR = $${BINDIR}/models TARGET = auxingrowth HEADERS = ../simplugin.h $${TARGET}plugin.h -QMAKE_CXXFLAGS += -I.. +QMAKE_CXXFLAGS += -fexceptions -I.. +QMAKE_CXXFLAGS_DEBUG += -g3 QT += qt3support SOURCES = $${TARGET}plugin.cpp TEMPLATE = lib unix { LIBS += -Llib -lvleaf - QMAKE_CXXFLAGS += -fexceptions -I/usr/include/libxml2 + QMAKE_CXXFLAGS += -I/usr/include/libxml2 QMAKE_LFLAGS += -fPIC } win32 { LIBXML2DIR = C:\libxml2 LIBICONVDIR = C:\libiconv + LIBZDIR = C:\libz LIBS += -Llib -lvleaf QMAKE_CXXFLAGS += -DLIBXML_STATIC - QMAKE_CXXFLAGS += -fexceptions -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include + QMAKE_CXXFLAGS += -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include -I$${LIBZDIR}\include } # finis diff --git a/src/build_models/plugin_leaf.pro b/src/build_models/plugin_leaf.pro --- a/src/build_models/plugin_leaf.pro +++ b/src/build_models/plugin_leaf.pro @@ -19,29 +19,34 @@ # Copyright 2010 Roeland Merks. # +CONFIG -= release +CONFIG += debug +CONFIG += plugin + BINDIR = ../../bin -CONFIG += plugin release DEFINES = QTGRAPHICS # VLEAFPLUGIN DESTDIR = $${BINDIR}/models TARGET = leaf HEADERS = ../simplugin.h $${TARGET}plugin.h -QMAKE_CXXFLAGS += -I.. +QMAKE_CXXFLAGS += -fexceptions -I.. +QMAKE_CXXFLAGS_DEBUG += -g3 QT += qt3support SOURCES = $${TARGET}plugin.cpp TEMPLATE = lib unix { LIBS += -Llib -lvleaf - QMAKE_CXXFLAGS += -fexceptions -fPIC -I/usr/include/libxml2 + QMAKE_CXXFLAGS += -fPIC -I/usr/include/libxml2 QMAKE_LFLAGS += -fPIC } win32 { LIBXML2DIR = C:\libxml2 LIBICONVDIR = C:\libiconv + LIBZDIR = C:\libz LIBS += -Llib -lvleaf QMAKE_CXXFLAGS += -DLIBXML_STATIC - QMAKE_CXXFLAGS += -fexceptions -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include + QMAKE_CXXFLAGS += -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include -I$${LIBZDIR}\include } # finis diff --git a/src/build_models/plugin_meinhardt.pro b/src/build_models/plugin_meinhardt.pro --- a/src/build_models/plugin_meinhardt.pro +++ b/src/build_models/plugin_meinhardt.pro @@ -19,29 +19,34 @@ # Copyright 2010 Roeland Merks. # +CONFIG -= release +CONFIG += debug +CONFIG += plugin + BINDIR = ../../bin -CONFIG += plugin release DEFINES = QTGRAPHICS # VLEAFPLUGIN DESTDIR = $${BINDIR}/models TARGET = meinhardt HEADERS = simplugin.h $${TARGET}plugin.h -QMAKE_CXXFLAGS += -I.. +QMAKE_CXXFLAGS += -fexceptions -I.. +QMAKE_CXXFLAGS_DEBUG += -g3 QT += qt3support SOURCES = $${TARGET}plugin.cpp TEMPLATE = lib unix { LIBS += -Llib -lvleaf - QMAKE_CXXFLAGS += -fexceptions -I/usr/include/libxml2 + QMAKE_CXXFLAGS += -I/usr/include/libxml2 QMAKE_LFLAGS += -fPIC } win32 { LIBXML2DIR = C:\libxml2 LIBICONVDIR = C:\libiconv + LIBZDIR = C:\libz LIBS += -Llib -lvleaf QMAKE_CXXFLAGS += -DLIBXML_STATIC - QMAKE_CXXFLAGS += -fexceptions -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include + QMAKE_CXXFLAGS += -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include -I$${LIBZDIR}\include } # finis diff --git a/src/build_models/plugin_test.pro b/src/build_models/plugin_test.pro --- a/src/build_models/plugin_test.pro +++ b/src/build_models/plugin_test.pro @@ -20,29 +20,34 @@ # +CONFIG -= release +CONFIG += debug +CONFIG += plugin + BINDIR = ../../bin -CONFIG += plugin debug #release DEFINES = QTGRAPHICS # VLEAFPLUGIN DESTDIR = $${BINDIR}/models TARGET = test HEADERS = ../simplugin.h $${TARGET}plugin.h -QMAKE_CXXFLAGS += -I.. +QMAKE_CXXFLAGS += -fexceptions -I.. +QMAKE_CXXFLAGS_DEBUG += -g3 QT += qt3support SOURCES = $${TARGET}plugin.cpp TEMPLATE = lib unix { LIBS += -Llib -lvleaf - QMAKE_CXXFLAGS += -fexceptions -I/usr/include/libxml2 + QMAKE_CXXFLAGS += -I/usr/include/libxml2 QMAKE_LFLAGS += -fPIC } win32 { LIBXML2DIR = C:\libxml2 LIBICONVDIR = C:\libiconv + LIBZDIR = C:\libz LIBS += -Llib -lvleaf QMAKE_CXXFLAGS += -DLIBXML_STATIC - QMAKE_CXXFLAGS += -fexceptions -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include + QMAKE_CXXFLAGS += -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include -I$${LIBZDIR}\include } diff --git a/src/cellbase.h b/src/cellbase.h --- a/src/cellbase.h +++ b/src/cellbase.h @@ -134,7 +134,7 @@ class CellBase : public QObject, public inline double Chemical(int c) const { // returns the value of chemical c #ifdef QDEBUG - qDebug() << endl << "Entering cellbase::chemical(" << c << ")" << endl; + qDebug() << endl << "Entering cellbase::chemical(" << c << "), and nchem is: " << NChem() << "." << endl; #endif int nchem = NChem(); diff --git a/src/libplugin.pro b/src/libplugin.pro --- a/src/libplugin.pro +++ b/src/libplugin.pro @@ -19,7 +19,14 @@ # Copyright 2010 Roeland Merks. # -CONFIG += staticlib debug #release +CONFIG -= release +CONFIG += debug +CONFIG += staticlib + +QMAKE_CXXFLAGS += -fexceptions +QMAKE_CXXFLAGS_DEBUG += -g3 +QMAKE_CXXFLAGS_DEBUG -= -DQDEBUG + DEFINES = QTGRAPHICS # VLEAFPLUGIN DESTDIR = build_models/lib PERLDIR = ./perl @@ -56,7 +63,7 @@ SOURCES = \ unix { system(rm -f parameter.cpp parameter.h) # this is performed here when qmake is envoked and not in the resulting makefile. - QMAKE_CXXFLAGS += -fexceptions -fPIC -I/usr/include/libxml2 + QMAKE_CXXFLAGS += -fPIC -I/usr/include/libxml2 QMAKE_LFLAGS += -fPIC LIBS += -lxml2 -lz -lm } @@ -65,8 +72,9 @@ win32 { system(DEL parameter.cpp parameter.h) LIBXML2DIR = C:\libxml2 LIBICONVDIR = C:\libiconv + LIBZDIR = C:\libz QMAKE_CXXFLAGS += -DLIBXML_STATIC - QMAKE_CXXFLAGS += -fexceptions -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include + QMAKE_CXXFLAGS += -I$${LIBXML2DIR}\include -I$${LIBICONVDIR}\include -I$${LIBZDIR}\include } system(perl $$PERLDIR/make_parameter_source.pl $$PARTMPL)