-
Notifications
You must be signed in to change notification settings - Fork 5
/
README.txt
274 lines (191 loc) · 8.36 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
ViSP-2.7.0
Visual Servoing Platform
Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
www: http://www.irisa.fr/lagadic
This project is using the CMake build system.
CMake is a complete stand-alone platform-independant build-system
replacing autotools (autoconf/autoheader/automake/libtools) completely.
It depends just on installed cmake (tested with cmake cvs version). It
needs a cmake 2.6.x or more recent version of cmake.
See http://www.cmake.org for details.
USAGE:
=====
1. Install the newest cmake from www.cmake.org
See INSTALL file for further information.
2. Check out/install ViSP source code
Checkout, copy or unzip the ViSP tar ball in <visp source dir>.
For building you have got the option of "in-source" or "out-of-source"
builds. CMake developpers strongly recommend using an "out-of-source" build
which never writes any files to the source tree. Using a separate source and
build tree greatly reduces the need for "make clean" and "make distclean"
targets.
2.1 In-source build under Unix platforms:
cd <visp source dir>;
ccmake .
or for defaults: cmake .
make
make install
The make install step is needed if you want to use ViSP in your own
projects. To do the installation, you don't need to be root.
2.2 Out-of-source build under Unix platforms:
The out-of-source build is very useful for different parallel build
configurations:
mkdir <visp build dir>
cd <visp build dir>
ccmake <visp source dir>
or for defaults: cmake <source dir>
make
make install
The make install step is needed if you want to use ViSP in your own
projects. To do the installation, you don't need to be root.
2.3 Build under Win32
Use cmake or CMakeSetup Gui for in-source or out-of-source build.
Set environment variables and proceed as described for Unix.
Important Files:
===============
- CMakeLists.txt:
Overall configuration file. Detect third party libraries (X11, GTK, ...).
- CMakeHeaderFileList.cmake:
The list of all the headers (*.h) or (*.t.cpp for templates) to copy
in <visp source dir>/include/visp directory or to install in
<visp install prefix>/include/visp
- CMakeSourceFileList.cmake:
The list of all the sources (*.cpp) used to build the ViSP library.
- src/CMakeLists.txt:
Build the library in <visp source dir>/lib.
- include/vpConfig.h.in versus include/visp/vpConfig.h:
vpConfig.h.in is the source for vpConfig.h.
vpConfig.h is generated in CMakeList.txt by the command
CONFIGURE_FILE(${VISP_SOURCE_DIR}/include/vpConfig.h.cmake
${VISP_INCLUDE_DIR}/vpConfig.h
vpConfig.h contains preprocessor defines like VISP_HAVE_X11 and is .
included in most header files (*.h) to allow system dependent code usage
- CMakeModule/visp-config.in versus bin/visp-config:
visp-config is a shell script for third party projects not using cmake to
get hold of prefix, cflags, libs and version.
It is generated from visp-config.in by the module
CMakeModules/GenerateConfigScript.cmake in CMakeList.txt.
- lib/VISPBuildSettings.cmake:
SET commands for most important variables, i.e.
PROJECT_NAME
CMAKE_VERSION
C(XX)_COMPILER
C(XX)_FLAGS(_*)
BUILD_TYPE
BUILD_TOOL
It can be included from third cmake projects.
- CMakeModules/VISPConfig.cmake.in / lib/VISPConfig.cmake:
VISPConfig.cmake contains SET command for some basic variables like
VISP_INCLUDE_DIR, VISP_LINK_DIRECTORIES, VISP_BUILD_SETTINGS_FILE,
VISP_SOURCE_DIR, VISP_LIBRARIES and VISP_USE_FILE
VISPConfig.cmake can be used by by third cmake projects to make these
variables available.
VISPConfig.cmake.in is the source for VISPConfig.cmake
HOWTO:
======
1. Change configuration:
---------------------
You can change configuration easily with ccmake GUI.
ccmake <source dir>
type 't' to toggle display of advanced variables
or
cmake -LA <source dir>
to have the list of all configuration variables.
2. Do a optimized build:
--------------------
cmake -DCMAKE_BUILD_TYPE=Release <visp source dir>
or use ccmake <visp source dir> to set CMAKE_BUILD_TYPE.
Available build types are: Release, Debug, RelWithDebInfo, MinSizeRel.
The build process uses specific build variable CMAKE_CXX_FLAGS_*.
For example Release build uses CMAKE_CXX_FLAGS_RELEASE, while Debug
build uses CMAKE_CXX_FLAGS_DEBUG.
The flags according to the different build types can be seen with
cmake -LA <source_dir>
3. Build shared libraries:
-----------------------
cmake -DBUILD_SHARED_LIBS=ON <visp source dir>
or use ccmake <visp source dir> to set BUILD_SHARED_LIBS.
Produce shared libraries (.so).
4. Build static libraries:
-----------------------
cmake -DBUILD_SHARED_LIBS=OFF <visp source dir>
or use ccmake <visp source dir> to set BUILD_SHARED_LIBS.
Produce static libraries (.a).
5. Add more files to clean target:
------------------------------
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
"file_to_remove")
6. Use ViSP with another cmake project:
-----------------------------------
Include the following into your CMakeList.txt:
FIND_PACKAGE(VISP REQUIRED)
IF(VISP_FOUND)
INCLUDE(${VISP_USE_FILE})
ENDIF(VISP_FOUND)
With CMake GUI set the environment variable VISP_DIR to
<visp install prefix>/lib
or using a command line run:
`cmake -DVISP_DIR=<visp install prefix>/lib <project source dir>`
7. Use ViSP with autoconf (autotools):
-----------------------------------
Copy the M4 macro file `macro/have_visp.m4` in your project.
cp macro/have_visp.m4 <your project home dir>/macro
This macro check if <visp install prefix>/bin/visp-config shell script
is available (see below how to use ViSP with a common Makefile).
In your configure.ac project file add lines like:
AC_HAVE_VISP_IFELSE(have_visp=yes,have_visp=no)
if test "x$have_visp" = "xyes"; then
CXXFLAGS="$CXXFLAGS $ac_visp_cflags "
LIBS="$LIBS $ac_visp_libs "
fi
cd <your project home dir>
aclocal -I macro # updates the aclocal.m4 file
autoconf
configure --with-visp-install-bin=<visp install prefix>/bin
8. Use ViSP with a common Makefile:
-------------------------------
a: Install ViSP:
- configure ViSP using cmake, particularly set the ViSP install prefix
(cmake -DCMAKE_INSTALL_PREFIX:PATH=<visp install prefix>)
- build ViSP:
make
- install ViSP by:
make install
b: Make sure, the visp-config shell script is found by the makefile:
export PATH=$PATH:<visp install prefix>/bin
c: Use `visp-config --prefix/--cflags/--libs/--version`
to get the compiler/linker flags needed to use ViSP
9. View compiler and linker options used:
-------------------------------------
cmake -DCMAKE_VERBOSE_MAKEFILE=ON <visp source dir>
Generate more 'verbose' makefile including compiler calls instead of
default "SILENT" .
10. View all available options/variables:
------------------------------------
ccmake <source dir>
type 't' to toggle display of advanced variables
or
cmake -LA <source dir>
11. Remove Cache:
-------------
cd <visp build dir>
rm CMakeCache.txt
12. Make a distclean:
-----------------
CMake does not generate a "make distclean" target (see the cmake FAQ). CMake
generates many files related to the build system, but since CMakeLists.txt
files can run scripts and other arbitrary commands, there is no way it can
keep track of exactly which files are generated as part of running CMake.
So, for in-source build under Unix platforms, we have developped a distclean
shell script (working only under Unix platforms) that removes these files
related to the build system. To remove some intermediate files related to
the build system: sh ./distclean.sh
For out-of-source build, just remove the <visp build dir> tree.
13. Where to found documentation about CMake:
----------------------------------------
Almost complete documentation of cmake commands:
cmake --help-full and http://www.cmake.org
The 250-page book Mastering CMake by Ken Martin and Bill Hoffman, ISBN
1-930934-16-5, published by Kitware, Inc.
------------------------
Fabien Spindler