LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiCompilers.h

00001 /*
00002  * Copyright (C) 1998, 1999, 2000, 2001
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  * 
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public 
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.  
00021  */ 
00022 
00023 #ifndef _LTI_COMPILERS
00024 #define _LTI_COMPILERS
00025 
00026 /** 
00027 
00028 \page compilers Some Tips for the supported compilers
00029   
00030 - \ref gcc
00031 - \ref msvc
00032 
00033 \section gcc Linux/GCC
00034 
00035 \subsection gccReq Requirements
00036 
00037 To compile the LTI-Lib using all its power, you will need the following:
00038 
00039 - C++ Compiler GCC 2.95.3 or higher is required.  More than the
00040   compiler itself, the STL implementation in 2.95.3 is required,
00041   because some features and files (like <sstream>) are in 2.95.2
00042   still missing.  GCC 3.2 and pre-releases of GCC 3.3 are being
00043   intensively used.
00044   There have been reports of problems with the un-official 
00045   <a href="http://gcc.gnu.org/gcc-2.96.html">GCC 2.96</a>.  If you use
00046   the later compiler, we recomend to downgrade to 2.95.3 or to upgrade
00047   to the latest GCC 3.3 or higher release.
00048 - Some viewer classes use the <a href="http://www.gtk.org">GTK</a>
00049   toolkit.  On your system you will need to have the developer's package
00050   installed.
00051 - GNU Make version 3.79.1 or higher is required to build the library.
00052 - \c autoconf version 2.52 or higher is required to build the \c
00053   configure script, used to detect which features are installed that
00054   the LTI-Lib can make use of.  The related \c aclocal must have version 1.5 or
00055   higher.
00056 - Many Linux distributions provide the BASH shell as standard shell.  This
00057   fact is also assumed here and bash should be the shell you use while 
00058   calling the \c configure scripts and the \c make files.
00059 - PERL is required to interpret some script files that simplify the development
00060   with/for the LTI-Lib.  All major Linux distributions have PERL packages,
00061   but you can also get it from
00062   <a href="http://www.perl.org/">here</a>.
00063 
00064 You may also need:
00065 
00066 - <a href="http://www.doxygen.org/">Doxygen</a>.  All the LTI-Lib is
00067   documented using this great tool.  If you want to generate the complete HTML
00068   documentation you will need it and also the 
00069   <a href="http://www.research.att.com/sw/tools/graphviz/">Graphviz</a>
00070   graph drawing software required by Doxygen to generate the class
00071   trees.
00072 - LAPACK to use more efficiently some complex mathematical operations
00073   (e.g. eigenvalue/eigenvector computation, LDA). For this to be
00074   available you need to install the packages lapack, blas and the f2c
00075   compiler which should come with your distribution. See also \ref
00076   lapack.  The Fortran compiler with which the lapack was compiled is also 
00077   necessary (usually provided with the GCC complete package or as g77). 
00078 
00079 \subsection gccCompile Compile the LTI-Lib
00080 
00081 First, check if the <code>configure</code> script already exists in
00082 your <code>ltilib/linux</code> directory.  If not, of if you are not sure that
00083 this is the correct one, just execute in your BASH terminal
00084 
00085 \code
00086 cd ltilib/linux
00087 make -f Makefile.cvs
00088 \endcode
00089 
00090 After that, you can configure your installation with
00091 
00092 \code
00093 ./configure
00094 \endcode
00095 
00096 You can of course customize your installation with several options
00097 (type ./configure --help for more information).
00098 
00099 Now you can compile the debug and release libraries and testers with
00100 
00101 \code
00102 make 
00103 \endcode
00104 
00105 You can at this point make use of your local copy of the library.  
00106 The <code>ltilib/tester/ltiTester.cpp</code> file can be used to try out small
00107 programs.  You can create two executable test programs with:
00108 
00109 \code
00110 make dtester rtester
00111 \endcode
00112 
00113 This will create in <code>ltilib/bin</code> two executable files: 
00114 - <code>dtester</code> is your program in the debug version, with all necessary
00115   debugging information, without optimizations and the most important thing,
00116   with all possible boundary check mechanisms activated (which make the code
00117   much slower as usual!).
00118 - <code>rtester</code> is your tester program in the release version, which
00119   runs much faster than the debug one.
00120 - the target <code>ptester</code> can also be used if you want to profile 
00121   your code.
00122 
00123 Every <code>*.cpp</code> file in the <code>ltilib/linux/workbench</code>
00124 directory will also be compiled and linked to the tester/rtester programs, so
00125 that you can build more complex test applications.
00126 
00127 You can also install the library in your system, assuming you have write
00128 privileges for the <code>--prefix</code> directory given in the
00129 <code>configure</code> script (if nothing was given, \c /usr/local is the 
00130 default).  Just try:
00131 
00132 \code
00133 make install
00134 \endcode
00135 
00136 \subsection makefile The Makefile
00137 
00138 The Makefile in <code>ltilib/linux/Makefile</code> provides many
00139 options and targets.  Use the targets as usual, i.e. just type
00140 \code
00141 make target
00142 \endcode 
00143 in your xterm, konsole, or whatsoever bash-terminal you are using. Using make without target is equivalent to calling target all-debug and all-release, thus building the library and testers in debug and release version.
00144 
00145 The most useful targets are:
00146 - \b dtester to compile the tester application in debug mode.
00147 - \b rtester to compile the tester application in release mode.
00148 - \b ptester to compile the tester application in profile mode.
00149 - \b bins to compile the debug and release versions of the tester application.
00150 - \b libd to compile the complete library in debug version.
00151 - \b libr to compile the complete library in release version.
00152 - \b libp to compile the complete library in profile version.
00153 - \b libsd to compile the math library, the library without viewers and the
00154   complete library in debug version.
00155 - \b libsr to compile the math library, the library without viewers and the
00156   complete library in release version.
00157 - \b libsp to compile the math library, the library without viewers and the
00158   complete library in profile version.
00159 - \b all-debug like libd and dtester.
00160 - \b all-release like libr and rtester.
00161 - \b all-profile like libp and ptester.
00162 - \b clean to remove all temporary object files, i.e. the libraries and
00163   tester applications will \e not be removed.
00164 - \b clean-libs to remove all libraries, but not the temporary object files.
00165 - \b clean-docs to remove all documentation generated by Doxygen.
00166 - \b clean-all to remove all generated data: documentation, object files, 
00167   libraries, even the backup files generated by Emacs (*~).
00168 - \b distclean like clean-all and additionally removes the Makefiles.
00169 - \b install to install the library in the \a prefix specified to the
00170   \c configure script (type <code>./configure --help</code> for more 
00171   information).
00172 - \b doxydoc to generate the documentation using Doxygen.  It assumes your 
00173   system has the latest Doxygen version and the Graphviz tool \c dot.
00174 - \b dep to generate the dependencies.  You will need this target each time
00175   you add new files to the library and you notice your file is not compiled 
00176   even if something changed that your file directly or indirectly includes.
00177 
00178 With the variable \c DEBUGEXC set to \c -D_DEBUG_EXCEPTION you can control if
00179 the lti::exceptions will write to std::err a text message that should help
00180 you to debug your programs.  However, this can (or should) be set in your
00181 <code>extrapaths.mk</code> file, in order to survive your next "configure"
00182 (see the next section for more information).
00183 
00184 \subsubsection gccAddLibs Using external libraries and header files
00185 
00186 For the use of many frame-grabbers and other hardware related classes, it
00187 is usually required that some special hardware drivers or hardware related
00188 libraries can be linked with the LTI-Lib.  For these and many other
00189 special cases it is desirable to have a simple way to indicate:
00190 
00191 - Additional include paths, where special header files can be found
00192 - Additional library paths, where specific libraries can be found
00193 - Additional libraries, that should be linked with the LTI-Lib in order
00194   to provide specific functionality.
00195 
00196 Include paths are required by almost any frame-grabber or camera utility,
00197 except if you provide that all headers can be found in the standard system
00198 include paths.
00199 
00200 Library paths are only necessary if you also specify some libraries to be
00201 linked with, which are not located in the standard library directories
00202 (e.g. /usr/lib or /usr/local/lib).
00203 
00204 The mechanism provided by the LTI-Lib should "survive" a ./configure, since
00205 otherwise you would need to make changes to the Makefile  each time you get a
00206 newer library version or you just want to reconfigure some options.
00207 
00208 You just need to create a file called \e "extrapaths.mk", in which following
00209 variables are expected:
00210 
00211 -  EXTRAINCLUDEPATH for additional include paths
00212 -  EXTRALIBPATH     for additional library paths
00213 -  EXTRALIBS        for additional libraries
00214 
00215 For example, to use the lti::microEnablePulnix frame-grabber/camera
00216 functor, you should include in "extrapaths.mk" following three lines
00217 \code
00218 EXTRAINCLUDEPATH = -I/usr/src/menable/include
00219 EXTRALIBPATH = -L/usr/src/menable/lib
00220 EXTRALIBS =  -lpulnixchanneltmc6700 -lmenable
00221 \endcode
00222       
00223 Please note the standard GCC flags used to indicate:
00224 - \c -I path to headers
00225 - \c -L path to libraries
00226 - \c -l libraries.
00227 
00228 There is a template for such a file in the linux directory: \e "extrapaths_template.mk". It contains examples for the Philips ToUCam and for Pulnix + MicroEnable framegrabber.
00229 
00230 \subsection gccExam Examples
00231 
00232 In the directory <code>ltilib/examples</code> you can find several 
00233 directories with simple code examples using the LTI-Lib.  You can copy any
00234 Makefile in a project of your own, in order to use the LTI-Lib without
00235 much overhead.
00236 
00237 <hr>   
00238   
00239 \section msvc Microsoft Visual C++
00240   
00241 \subsection vcReq Requirements
00242 
00243 The LTI-Lib makes use of some C++ features and system functionality that
00244 makes following requirements necessary:
00245 
00246 - <b>Microsoft Visual C++</b>.  The LTI-Lib was modified in order to compile
00247   with the Visual C++ Version 6.0.  Visual C++ .NET 2002 was not able to deal
00248   with some ANSI compatible C++ template constructions widely used in the
00249   LTI-Lib, and is therefore not supported.  Version .NET 2003 can compile
00250   the LTI-Lib without problems.
00251 - <b>GTK+</b>.  In order to provide a system independent widget set, 
00252   the GTK+ Library was chosen.  
00253   These are required only for the visualization classes,
00254   and you could modify your projects to avoid their use, but all default 
00255   projects will assume you want to exploit them.
00256   You can get the original GTK+ libraries from
00257   <A HREF="http://www.gimp.org/~tml/gimp/win32/downloads.html/">here</A>.
00258   You will need the three toolkit layers: glib, gdk and gtk.  At this time,
00259   we use the version 1.3 of the toolkit.  You also find sources and binaries of
00260   GTK within the Windows Installer Package.
00261 - <b>ws2_32.lib</b> If not already in your system, just search the Internet for
00262   it.  It is easy to find.  (Also provided in the Installer)
00263 - <b>psapi.lib</b> This should come with your Visual C++, but can also
00264   be found on the Internet. (Also provided in the Installer)
00265 - <b>pdh.lib</b> The Performance Data Helper library can be found 
00266   <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q284996">
00267   here</a>, or search the Microsoft Knowledge Base for article "Q284996".
00268   (Also provided in the Installer)
00269 - <a href="http://www.activestate.com/Products/ActivePerl/">PERL</a> is
00270   required to create automatically the library and some example project files.
00271   (It can also be found in one of the Installer Packages)
00272 
00273 If you use the LTI-Lib Installer for Windows all required libraries can be 
00274 directly installed from there.
00275 
00276 \subsection Project creation
00277 
00278 A project that uses the LTI-Lib can either be created manually or you can 
00279 let a PERL-script do the job for you. Nevertheless you should read the 
00280 section about the manual creation of a project to see which settings are 
00281 required.
00282 
00283 There are always two possibilities to work with the LTI-Lib: either as 
00284 source code or as static library. The first method is required if you want 
00285 to make changes to existing library sources. The second is preferable if you 
00286 only want to use the library or to develop new classes. 
00287 
00288 
00289 \subsection vcAutomatic Automatic creation of a new project
00290  
00291 In <code>ltilib\\win</code> you will find the folders
00292 <code>console_src</code>, <code>console_lib</code> and <code>tester</code>.
00293 
00294 Each contains a PERL script that generates a console project (.dsp and .dsw
00295 files) with default settings. 
00296 If the project files already exist, then the
00297 scripts will only perform an update. A relative path to the sources is
00298 assumed, i.e. if you want to move your project's location, you will have to
00299 change settings manually. 
00300 
00301 The <code>console_lib</code> project assumes you have already created and
00302 installed the library.
00303 To do this go to the directory <code>ltilib\\win\\buildLib</code> and
00304 execute the batch file <code>buildLib.bat</code>.  Don't forget to set up your
00305 environment variables using the <code>VCVARS32.BAT</code> file provided in
00306 your Visual C++ distribution (usually in directory <code>VC98\\Bin</code>.
00307   
00308 These scripts assume you have installed the GTK+ libraries.  We recommend you 
00309 to install them, in order to use the visualization classes of the LTI-Lib.
00310 Using the Windows Installer, this is simply a check box in the offered
00311 packages.
00312 
00313 For example, let us assume, you are in the installation path of the library.
00314 You can create a simple tester project with:
00315 \code
00316 cd ltilib\win\tester
00317 perl tester.pl --new
00318 \endcode
00319 
00320 After that, you can open the <code>tester.dsw</code> file with the
00321 Visual Studio and compile both, debug and release versions, as usual.
00322 
00323 \subsection vcManual Manual creation of a new project.
00324 
00325 The following instructions apply, if you create a new project and want to 
00326 adjust settings manually.
00327   
00328 -  <B>Working with sources:</B>
00329    Include all the LTI-Lib sources directly in your project.
00330    -  Add all LTI-Lib sources to the file view of your project workspace.
00331    -  Indicate under Project->Settings->C/C++->Preprocessor for all 
00332       configurations the directory path to all the %lti-headers. The
00333       directories you should provide are <code>ltilib\\src\\basics,
00334       ltilib\\src\\imgProc, ltilib\\src\\ioBasics, ltilib\\src\\io,
00335       ltilib\\src\\io\\png, ltilib\\src\\io\\jpeg, ltilib\\src\\basics,
00336       ltilib\\src\\math, ltilib\\src\\viewer, ltilib\\src\\system</code>,
00337       where <code>ltilib</code> should be replaced with the absolute or 
00338       relative path of your ltilib directory.
00339    -  Activate Project->Settings->C/C++->C++ Language:Enable RTTI.
00340    -  You will also need to enlarge the heap used by the compiler with the
00341       option /Zm200.  To to this just type this option in the small edit
00342       box at the bottom of the dialog window in 
00343       Project->Settings->C/C++->General.
00344 -  <B>Working with static library:</B>
00345    compile the LTI-Lib to a static library (i.e. a *.lib file) and link that
00346    to your project. 
00347    -  Call the <code>buildLib.bat</code> batch file located in 
00348       <code>ltilib\\win\\buildLib</code> (Perl must be installed!). 
00349       This will build the libraries in <code>ltilib\\lib</code>.
00350       Additionally all header-files will be collected and placed in 
00351       <code>ltilib\\lib\\headerFiles</code>.
00352    -  Under Project->Settings->Link->General add <code>ltilib.lib</code>
00353       to the debug configuration and <code>rltilib.lib</code> to the release
00354       configuration.
00355    -  Under Project->Settings->C/C++->Preprocessor indicate the
00356       directory path to <code>ltilib\\lib\\headerFiles</code> for all
00357       configurations.
00358    -  Activate Project->Settings->C/C++->C++ Language:Enable RTTI.
00359    -  Note: by default the lib is built with the option /MD resp. 
00360       /MDd, i.e. the multi-threaded-dll run-time libraries are used. 
00361       This means that MFC must be linked dynamically. However, if you 
00362       need to use MFC in a static lib (not recommended), then you must 
00363       set the variable <code>v_buildDLLversion=0</code> in the Perl script 
00364       <code>createMakefile.pl</code> beforehand. 
00365 -  <B>General:</B> The lti::viewer and other visualization classes are
00366    based on the GNU GIMP-Toolkit
00367    (<A HREF="http://www.gtk.org">GTK</A>). To use it, you will 
00368    need to access its header files and static linked libraries, 
00369    and you will need to grant your system access to the DLL-libraries.  
00370    You can get the original GTK+ libraries from
00371    <A HREF="http://www.gimp.org/~tml/gimp/win32/downloads.html/">here</A>,
00372    or if you
00373    are in the <code>techinfo.rwth-aachen.de</code> domain, you can get a
00374    (maybe outdated) package with all required libraries from 
00375    <A HREF="http://tintas.techinfo.rwth-aachen.de/software/xwinlibs.tar.gz">here</A>.
00376    If you can get this last file, unpack it into the folder 
00377    <code>ltilib\\win</code>.  Otherwise, you should get the glib, gdk 
00378    and gtk libraries from 
00379    <A HREF="http://www.gimp.org/~tml/gimp/win32/downloads.html/">here</A>,
00380    and install them in the directories <code>ltilib\\win\\gtk+</code>,
00381    <code>ltilib\\win\\gtk+\\gdk</code> and <code>ltilib\\win\\glib</code>.
00382    -  Indicate under Project->Settings->C/C++->Preprocessor for all
00383       configurations the gtk directories. Those are <code>ltilib\\win\\gtk+,
00384       ltilib\\win\\gtk+\\gdk, ltilib\\win\\glib</code>
00385    -  under Project->Settings->Link->Input you can specify
00386       the path to the gtk-*.lib files, e.g. <code>ltilib\\win\\lib</code>
00387    -  under Project->Settings->Link->General specify the following
00388       libraries to be linked with:  
00389       <code>glib-1.3.lib, gdk-1.3.lib, gtk-1.3.lib, gmodule-1.3.lib,
00390       gthread-1.3.lib</code>
00391    -  also the following libraries are required 
00392       <code>ws2_32.lib</code>, <code>psapi.lib</code> and
00393       <code>pdh.lib</code>, with their respective DLLs.
00394       The last one (performance data helper) can be found 
00395       <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q284996">
00396       here</a>, or search the Microsoft Knowledge Base for article "Q284996".
00397    -  don't forget to copy the *.dll libraries in your SYSTEM
00398       directory, or to specify the directory <code>ltilib\\win\\lib</code>
00399       in your PATH-variable. The required seven GTK+ related
00400       DLL-Libraries are:
00401       <code>gdk-1.3.dll, glib-1.3.dll, gmodule-1.3.dll,
00402       gnu-intl.dll, gthread-1.3.dll, gtk-1.3.dll, pthread.dll</code>.  And
00403       the <code>pdh.dll</code> is required to.  
00404 
00405    The lti::processInfo class requires for Windows the libraries
00406    pdh.lib and pdh.dll, which are assumed to be in your default path.
00407    The lti::url class requires the libraries ws2_32.lib and ws2_32.dll,
00408    which should be already in your default path.
00409 
00410    Also check the LTI-Lib Tutorial which contains many screenshots of
00411    the installer for windows.
00412 
00413 */
00414 
00415 #endif
00416 

Generated on Sat Apr 10 15:25:16 2010 for LTI-Lib by Doxygen 1.6.1