Subversion Repositories gelsvn

Rev

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

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