Subversion Repositories gelsvn

Rev

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

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