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