Subversion Repositories gelsvn

Rev

Rev 216 | Rev 613 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 216 Rev 596
1
GEL README, Andreas Bærentzen, February 2006.
1
GEL README, Andreas Bærentzen, February 2006.
2
==========
2
==========
3
 
3
 
4
This README describes the GEL project. GEL stands for Geometry and Linear 
4
This README describes the GEL project. GEL stands for Geometry and Linear 
5
Algebra which are the constituents we will mostly put into this library. It is
5
Algebra which are the constituents we will mostly put into this library. It is
6
intended as a library for computer graphics and computer vision tasks with a
6
intended as a library for computer graphics and computer vision tasks with a
7
strong emphasis on the handling of shape and geometry. 
7
strong emphasis on the handling of shape and geometry. 
8
 
8
 
9
GEL is broken down into a number of libraries, and the overall structure is as
9
GEL is broken down into a number of libraries, and the overall structure is as
10
follows:
10
follows:
11
 
11
 
12
- CGLA is a library targeted at vectors and matrices of dimensions 2,3, and
12
- CGLA is a library targeted at vectors and matrices of dimensions 2,3, and
13
  4. CGLA is useful in computer graphics where small efficient vectors are
13
  4. CGLA is useful in computer graphics where small efficient vectors are
14
	everywhere.
14
	everywhere.
15
- LinAlg is a very simple Lapack wrapper which simplifies solving (large)
15
- LinAlg is a very simple Lapack wrapper which simplifies solving (large)
16
  linear systems. 
16
  linear systems. 
17
- Geometry contains (mostly) Spatial data structures. There are voxel grid
17
- Geometry contains (mostly) Spatial data structures. There are voxel grid
18
	class templates and a K-D tree template. There is also a triangle mesh class
18
	class templates and a K-D tree template. There is also a triangle mesh class
19
	useful for real time rendering.
19
	useful for real time rendering.
20
- HMesh is a half edge based polygonal mesh data structure. This is useful for
20
- HMesh is a half edge based polygonal mesh data structure. This is useful for
21
	algorithms which change mesh connectivity.
21
	algorithms which change mesh connectivity.
22
- GLGraphics contains Tools for visualization. There is a trackball and some
22
- GLGraphics contains Tools for visualization. There is a trackball and some
23
	other OpenGL compatible tools.
23
	other OpenGL compatible tools.
24
- Util contains various utilities such as hash table classes, a tool for
24
- Util contains various utilities such as hash table classes, a tool for
25
	command line arguments, a 2D grid class, a resource manager and other
25
	command line arguments, a 2D grid class, a resource manager and other
26
	miscellany.  
26
	miscellany.  
27
 
27
 
28
GEL is intended for use both under a variety of unix platforms (Linux
28
GEL is intended for use both under a variety of unix platforms (Linux
29
and OSX in particular) and  under windows. This README is mostly for
29
and OSX in particular) and  under windows. This README is mostly for
30
unix users. Windows users should also consult README_MSVC
30
unix users. Windows users should also consult README_MSVC
31
 
31
 
32
Dependencies: GEL depends on the Developers Image Library DevIL,
-
 
33
Lapack, and OpenGL and GLUT. However, most of GEL does not require
32
Dependencies: GEL depends on Lapack/BLAS, and OpenGL and GLUT. However, the applications have more dependencies.
34
these dependencies. In particular, you do not need DevIL except if you
-
 
35
want the OBJ viewer example program.
-
 
36
 
33
 
37
Who made GEL
34
Who made GEL
38
==========
35
==========
39
 
36
 
40
GEL is mostly the work of Andreas Bærentzen, but other people
37
GEL is mostly the work of Andreas Bærentzen, but other people
41
contribute. In particular, Jeppe Frisvad, Bjarke Jakobsen, Henrik
38
contribute. In particular, Jeppe Frisvad, Bjarke Jakobsen, Henrik
42
Aanæs, and Bent D. Larsen. We are all from Informatics and
39
Aanæs, and Bent D. Larsen. We are all from Informatics and
43
Mathematical Modelling, a department of the Technical University of
40
Mathematical Modelling, a department of the Technical University of
44
Denmark. 
41
Denmark. 
45
 
42
 
46
Regarding LICENSE.
43
Regarding LICENSE.
47
==========
44
==========
48
 
45
 
49
I was considering putting GEL under the LGPL. But it is a long complex
46
I was considering putting GEL under the LGPL. But it is a long complex
50
text. The longer any kind of document, the more chances for loopholes
47
text. The longer any kind of document, the more chances for loopholes
51
in my opinion. Instead, I list a few simple rules below. The most
48
in my opinion. Instead, I list a few simple rules below. The most
52
important one is that if you want to use GEL for some purpose, and it
49
important one is that if you want to use GEL for some purpose, and it
53
is not crystal clear whether it is against the rules, contact me. As
50
is not crystal clear whether it is against the rules, contact me. As
54
for the rules:
51
for the rules:
55
 
52
 
56
You are allowed to use GEL for academic or commercial purposes. In
53
You are allowed to use GEL for academic or commercial purposes. In
57
particular, you are welcome to give GEL to students as a basis for 
54
particular, you are welcome to give GEL to students as a basis for 
58
academic work or to use it for your own applications.
55
academic work or to use it for your own applications.
59
 
56
 
60
The biggest limitation that I want to impose is that you cannot repackage
57
The biggest limitation that I want to impose is that you cannot repackage
61
GEL in any way. You are not allowed to distribute another library which
58
GEL in any way. You are not allowed to distribute another library which
62
contains GEL or parts of GEL unless you make it clear that this other
59
contains GEL or parts of GEL unless you make it clear that this other
63
library contains GEL. You are also not allowed to redistribute GEL in a
60
library contains GEL. You are also not allowed to redistribute GEL in a
64
changed form. If you want changes to be made, contact me.
61
changed form. If you want changes to be made, contact me.
65
 
62
 
66
Of course, neither I nor my employer will give you any money or be
63
Of course, neither I nor my employer will give you any money or be
67
held responsible in any way, under any circumstances what so ever - no
64
held responsible in any way, under any circumstances what so ever - no
68
matter what sort of damage GEL might inflict upon you. Not that I can
65
matter what sort of damage GEL might inflict upon you. Not that I can
69
foresee GEL causing you any damage :-) 
66
foresee GEL causing you any damage :-) 
70
 
67
 
71
If anything is unclear, please contact me. In fact, if you want to use
68
If anything is unclear, please contact me. In fact, if you want to use
72
GEL for a bigger project, I'd appreciate an email to jab@imm.dtu.dk
69
GEL for a bigger project, I'd appreciate an email to jab@imm.dtu.dk
73
 
70
 
74
In a project such as this, it is almost impossible to completely avoid
71
In a project such as this, it is almost impossible to completely avoid
75
building upon fragments of other peoples source code. GEL includes an
72
building upon fragments of other peoples source code. GEL includes an
76
obj loader based on work by Nate Robins. Some pieces of source code
73
obj loader based on work by Nate Robins. Some pieces of source code
77
from Graphics Gems have also been used. All of this amounts to only a
74
from Graphics Gems have also been used. All of this amounts to only a
78
small fraction of the GEL source code and it should not be in
75
small fraction of the GEL source code and it should not be in
79
violation of any license. Should you disagree, contact me, and I will
76
violation of any license. Should you disagree, contact me, and I will
80
rectify the situation.
77
rectify the situation.
81
 
78
 
82
----------------------------------------------------------------------
79
----------------------------------------------------------------------
83
1. INTRODUCTION
80
1. INTRODUCTION
84
----------------------------------------------------------------------
81
----------------------------------------------------------------------
85
 
82
 
86
In the following, I discuss the structure of the source code and how to
83
In the following, I discuss the structure of the source code and how to
87
add new directories to the framework. 
84
add new directories to the framework. 
88
 
85
 
89
The idea is that this framework should be a) simple to use and b) let 
86
The idea is that this framework should be a) simple to use and b) let 
90
people easily compile the same source code under various unix platforms.
87
people easily compile the same source code under various unix platforms.
91
A seperate configuration is kept for each combination of OS, architecture, 
88
A seperate configuration is kept for each combination of OS, architecture, 
92
and compiler. It is possible to specify targets release or debug.
89
and compiler. It is possible to specify targets release or debug.
93
 
90
 
94
Source files are compiled in build directories, and separate build 
91
Source files are compiled in build directories, and separate build 
95
directories are kept for each unique combination of 
92
directories are kept for each unique combination of 
96
 
93
 
97
os architecture compiler target
94
os architecture compiler target
98
 
95
 
99
such as
96
such as
100
 
97
 
101
Linux_i686_g++3_debug
98
Linux_i686_g++3_debug
102
 
99
 
103
this makes it easier to work in a heterogenous environment or to 
100
this makes it easier to work in a heterogenous environment or to 
104
experiment with seperate compilers or just to switch between debug mode 
101
experiment with seperate compilers or just to switch between debug mode 
105
and optimized.
102
and optimized.
106
 
103
 
107
To see how to use the framework, you may skip to section 5.
104
To see how to use the framework, you may skip to section 5.
108
 
105
 
109
----------------------------------------------------------------------
106
----------------------------------------------------------------------
110
2. DIRECTORY STRUCTURE
107
2. DIRECTORY STRUCTURE
111
----------------------------------------------------------------------
108
----------------------------------------------------------------------
112
 
109
 
113
The directories under the root of the source tree (where you find this 
110
The directories under the root of the source tree (where you find this 
114
README) are
111
README) are
115
 
112
 
116
src        - Source code for GEL libraries
113
src        - Source code for GEL libraries
117
apps       - Source code for applications
114
apps       - Source code for applications
118
apps       - Source code for test programs
115
apps       - Source code for test programs
119
doc        - Documentation
116
doc        - Documentation
120
bin        - Executables
117
bin        - Executables
121
lib        - Libraries
118
lib        - Libraries
122
makefiles  - As the name suggests, makefiles
119
makefiles  - As the name suggests, makefiles
123
 
120
 
124
src contains a number of subdirectories each of which represents a 
121
src contains a number of subdirectories each of which represents a 
125
link library. apps  also contains subdirectories, however each of these
122
link library. apps  also contains subdirectories, however each of these
126
is supposed to contain source code for an executable.
123
is supposed to contain source code for an executable.
127
 
124
 
128
----------------------------------------------------------------------
125
----------------------------------------------------------------------
129
3. FILE NAMES
126
3. FILE NAMES
130
----------------------------------------------------------------------
127
----------------------------------------------------------------------
131
 
128
 
132
source files are *.c or *.cpp depending on whether it is C or C++
129
source files are *.c or *.cpp depending on whether it is C or C++
133
header files are named *.h
130
header files are named *.h
134
 
131
 
135
----------------------------------------------------------------------
132
----------------------------------------------------------------------
136
4. MAKEFILES
133
4. MAKEFILES
137
----------------------------------------------------------------------
134
----------------------------------------------------------------------
138
 
135
 
139
Some defintions:
136
Some defintions:
140
----------------
137
----------------
141
 
138
 
142
The PLATFORM is a string concatenation of the os cpu and compiler, e.g.
139
The PLATFORM is a string concatenation of the os cpu and compiler, e.g.
143
 
140
 
144
Linux_i686_g++
141
Linux_i686_g++
145
 
142
 
146
The TARGET is either `debug' or `release'. By default it is debug. It is
143
The TARGET is either `debug' or `release'. By default it is debug. It is
147
recommended that you do _not_ hardwire your own default into the makefiles
144
recommended that you do _not_ hardwire your own default into the makefiles
148
as I did for many years. It seems better to define the variable when running
145
as I did for many years. It seems better to define the variable when running
149
make, using "make TARGET=release" or by setting the target variable in the
146
make, using "make TARGET=release" or by setting the target variable in the
150
environment.
147
environment.
151
 
148
 
152
 
149
 
153
Make'ing from the source root
150
Make'ing from the source root
154
-----------------------------
151
-----------------------------
155
 
152
 
156
Just typing
153
Just typing
157
> make 
154
> make 
158
 
155
 
159
from the root of the source tree will cause first every library and
156
from the root of the source tree will cause first every library and
160
then every application to be remade. However, there are several
157
then every application to be remade. However, there are several
161
targets.
158
targets.
162
 
159
 
163
make all			 - equivalent to "make lib shared test app"
160
make all			 - equivalent to "make lib shared test app"
164
 
161
 
165
make lib       - make all libraries
162
make lib       - make all libraries
166
 
163
 
167
make shared    - For the current target platform combination, a shared library
164
make shared    - For the current target platform combination, a shared library
168
								 is created by stringing together the compiled static libraries
165
								 is created by stringing together the compiled static libraries
169
 
166
 
170
make app       - make all applications
167
make app       - make all applications
171
 
168
 
172
make clean     - clean all library directories and app directories.
169
make clean     - clean all library directories and app directories.
173
                 this removes only files pertaining to the current
170
                 this removes only files pertaining to the current
174
                 platform and target (release/debug). This also
171
                 platform and target (release/debug). This also
175
                 removes generated libraries. 
172
                 removes generated libraries. 
176
 
173
 
177
make distclean - cleans and completely removes all build directories. 
174
make distclean - cleans and completely removes all build directories. 
178
 
175
 
179
make platform  - copies a template to OS_CPU_COMPILER.mk in the
176
make platform  - copies a template to OS_CPU_COMPILER.mk in the
180
                 makefiles directory. Use this only if you know what you
177
                 makefiles directory. Use this only if you know what you
181
								 are doing.
178
								 are doing.
182
 
179
 
183
make install   - Copies header files and libraries to the appropriate place
180
make install   - Copies header files and libraries to the appropriate place
184
							   which is PREFIX=/usr/local by default. The libraries which
181
							   which is PREFIX=/usr/local by default. The libraries which
185
								 are copied are either the debug or release versions depending
182
								 are copied are either the debug or release versions depending
186
								 on the active target. 
183
								 on the active target. 
187
 
184
 
188
								 Install does not install applications since many are little
185
								 Install does not install applications since many are little
189
								 test programs that do not belong in your path.
186
								 test programs that do not belong in your path.
190
 
187
 
191
 
188
 
192
Make'ing in subdirectories
189
Make'ing in subdirectories
193
--------------------------
190
--------------------------
194
 
191
 
195
Go to a subdirectory of src, say src/somedir. 
192
Go to a subdirectory of src, say src/somedir. 
196
Here you have the following options:
193
Here you have the following options:
197
 
194
 
198
make
195
make
199
make lib
196
make lib
200
make clean
197
make clean
201
 
198
 
202
The first two invocations are identical and will rebuild all sourcefiles and
199
The first two invocations are identical and will rebuild all sourcefiles and
203
put them in a library directory. The latter will remove all object and
200
put them in a library directory. The latter will remove all object and
204
dependency files (but only for the current platform
201
dependency files (but only for the current platform
205
(e.g. Linux_i686_g++_debug) The default target is lib.
202
(e.g. Linux_i686_g++_debug) The default target is lib.
206
 
203
 
207
Go to a subdirectory of apps, say apps/somedir. 
204
Go to a subdirectory of apps, say apps/somedir. 
208
Here you have the following options:
205
Here you have the following options:
209
 
206
 
210
make
207
make
211
 
208
 
212
or
209
or
213
 
210
 
214
make app
211
make app
215
 
212
 
216
will recompile the source files in the current directory and build the 
213
will recompile the source files in the current directory and build the 
217
programs. This is the default target. When compiled, the application is
214
programs. This is the default target. When compiled, the application is
218
moved to wherever/GEL/bin
215
moved to wherever/GEL/bin
219
 
216
 
220
make force
217
make force
221
 
218
 
222
does the same but tries first to recompile all libraries that the 
219
does the same but tries first to recompile all libraries that the 
223
applications in somedir depend on. This is the safe way to recompile,
220
applications in somedir depend on. This is the safe way to recompile,
224
but it takes a few seconds more, so if you are sure the libraries are
221
but it takes a few seconds more, so if you are sure the libraries are
225
up to date, just go make.
222
up to date, just go make.
226
 
223
 
227
make clean
224
make clean
228
 
225
 
229
works like above. 
226
works like above. 
230
 
227
 
231
Makefiles in subdirectories under apps should generally be edited.
228
Makefiles in subdirectories under apps should generally be edited.
232
When create by `make makefiles' the Makefile in apps/somedir looks
229
When create by `make makefiles' the Makefile in apps/somedir looks
233
like this 
230
like this 
234
 
231
 
235
PROGRAMS 	= prog1 prog2
232
PROGRAMS 	= prog1 prog2
236
OWN_LIBS 	= Lib1 Lib2
233
OWN_LIBS 	= Lib1 Lib2
237
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
234
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
238
 
235
 
239
Add something like this
236
Add something like this
240
 
237
 
241
PROGRAMS 	= prog1 prog2
238
PROGRAMS 	= prog1 prog2
242
OWN_LIBS 	= Lib1 Lib2
239
OWN_LIBS 	= Lib1 Lib2
243
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
240
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
244
 
241
 
245
where prog1 and prog2 are programs you wish to create. These must 
242
where prog1 and prog2 are programs you wish to create. These must 
246
correspond to source files with the same name and suffix .cpp. In
243
correspond to source files with the same name and suffix .cpp. In
247
other words, 
244
other words, 
248
 
245
 
249
prog1.cpp 
246
prog1.cpp 
250
prog2.cpp
247
prog2.cpp
251
 
248
 
252
must exist (and contain a main function)
249
must exist (and contain a main function)
253
 
250
 
254
Lib1 and Lib2 are libraries that must also be in the directory structure,
251
Lib1 and Lib2 are libraries that must also be in the directory structure,
255
i.e. under src there are subdirectories 
252
i.e. under src there are subdirectories 
256
 
253
 
257
src/Lib1
254
src/Lib1
258
src/Lib2
255
src/Lib2
259
 
256
 
260
the files in these subdirectories will be compiled and put in library 
257
the files in these subdirectories will be compiled and put in library 
261
files named libLib1.a under lib. More precisely it will be put here:
258
files named libLib1.a under lib. More precisely it will be put here:
262
 
259
 
263
lib/PLATFORM_TARGET/
260
lib/PLATFORM_TARGET/
264
 
261
 
265
PLATFORM and TARGET are defined above. Another library directory are for
262
PLATFORM and TARGET are defined above. Another library directory are for
266
precompiled libraries whose source code is not a part of this tree. Put
263
precompiled libraries whose source code is not a part of this tree. Put
267
such libraries here:
264
such libraries here:
268
 
265
 
269
lib/PLATFORM/
266
lib/PLATFORM/
270
 
267
 
271
this directory is created by 
268
this directory is created by 
272
 
269
 
273
make platform from the source root.
270
make platform from the source root.
274
 
271
 
275
----------------------------------------------------------------------
272
----------------------------------------------------------------------
276
5. CONFIGURATION
273
5. CONFIGURATION
277
----------------------------------------------------------------------
274
----------------------------------------------------------------------
278
 
275
 
279
When you add a new project to this framework, you should go through
276
When you add a new project to this framework, you should go through
280
the following steps:
277
the following steps:
281
 
278
 
282
Add directories for libraries under src. E.g. add 
279
Add directories for libraries under src. E.g. add 
283
 
280
 
284
mkdir src/somelib
281
mkdir src/somelib
285
 
282
 
286
Then add directories for applications:
283
Then add directories for applications:
287
 
284
 
288
mkdir apps/someapp
285
mkdir apps/someapp
289
 
286
 
290
Copy appropriate source files to these directories and then edit
287
Copy appropriate source files to these directories and then edit
291
 
288
 
292
makefiles/config.mk
289
makefiles/config.mk
293
 
290
 
294
to tell us which compiler to use (leave blank to use default) 
291
to tell us which compiler to use (leave blank to use default) 
295
 
292
 
296
Finally, from the source root type 
293
Finally, from the source root type 
297
 
294
 
298
make platform
295
make platform
299
 
296
 
300
Depending on your compiler you may now have to edit the makefile called
297
Depending on your compiler you may now have to edit the makefile called
301
 
298
 
302
makefiles/PLATFORM.mk 
299
makefiles/PLATFORM.mk 
303
 
300
 
304
to set special compile flags. No go 
301
to set special compile flags. No go 
305
 
302
 
306
make makefiles
303
make makefiles
307
 
304
 
308
Finally you are all set. Go
305
Finally you are all set. Go
309
 
306
 
310
make
307
make
311
 
308
 
312
 
309
 
313
----------------------------------------------------------------------
310
----------------------------------------------------------------------
314
6. DEPENDENCIES IN GEL
311
6. DEPENDENCIES IN GEL
315
----------------------------------------------------------------------
312
----------------------------------------------------------------------
316
 
313
 
317
Each directory under src represents a library. There are some dependencies
314
Each directory under src represents a library. There are some dependencies
318
between these libraries.
315
between these libraries.
319
 
316
 
320
 
317
 
321
 
318
 
322
lib						depends on
319
lib						depends on
323
-----------------------------------
320
-----------------------------------
324
CGLA 					nothing 
321
CGLA 					nothing 
325
 
322
 
326
Util 					CGLA
323
Util 					CGLA
327
 
324
 
328
LinAlg 				CGLA
325
LinAlg 				CGLA
329
 
326
 
330
Geometry 			LinAlg, CGLA
327
Geometry 			LinAlg, CGLA
331
 
328
 
332
HMesh					CGLA, Util, Geometry, LinAlg (indirectly)
329
HMesh					CGLA, Util, Geometry, LinAlg (indirectly)
333
 
330
 
334
GLGraphics		Everything (since it contains general rendering
331
GLGraphics		Everything (since it contains general rendering
335
							facilities)
332
							facilities)
336
 
333
 
337
 
334
 
338
----------------------------------------------------------------------
335
----------------------------------------------------------------------
339
7. TODO
336
7. TODO
340
----------------------------------------------------------------------
337
----------------------------------------------------------------------
341
 
338
 
342
- No real testing of blended C and C++.
339
- No real testing of blended C and C++.
343
- No dependency computation for .c 
340
- No dependency computation for .c 
344
 
341
 
345
 
342
 
346
 
343
 
347
 
344
 
348
 
345
 
349
 
346
 
350
 
347