Subversion Repositories gelsvn

Rev

Rev 178 | Rev 210 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
209 jab 1
GEL README, Andreas Bærentzen, February 2006.
2
==========
2 bj 3
 
209 jab 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.
2 bj 6
 
209 jab 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
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. 
12 jab 12
 
209 jab 13
Also found are two packages for linear algebra: CGLA is strictly for
14
small vectors and matrices. LinAlg is a Lapack wrapper for slightly
15
larger problems. At this point, it is fairly simple. 
12 jab 16
 
209 jab 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. 
2 bj 20
 
209 jab 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
 
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.
74
 
2 bj 75
----------------------------------------------------------------------
76
1. INTRODUCTION
77
----------------------------------------------------------------------
78
 
79
In the following, I discuss the structure of the source code and how to
80
add new directories to the framework. 
81
 
82
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.
84
A seperate configuration is kept for each combination of OS, architecture, 
85
and compiler. It is possible to specify targets release or debug.
86
 
87
Source files are compiled in build directories, and separate build 
88
directories are kept for each unique combination of 
89
 
90
os architecture compiler target
91
 
92
such as
93
 
94
Linux_i686_g++3_debug
95
 
96
this makes it easier to work in a heterogenous environment or to 
97
experiment with seperate compilers or just to switch between debug mode 
98
and optimized.
99
 
100
To see how to use the framework, you may skip to section 5.
101
 
102
----------------------------------------------------------------------
103
2. DIRECTORY STRUCTURE
104
----------------------------------------------------------------------
105
 
106
The directories under the root of the source tree (where you find this 
107
README) are
108
 
12 jab 109
src        - Source code for GEL libraries
110
apps       - Source code for applications
114 jab 111
apps       - Source code for test programs
2 bj 112
doc        - Documentation
113
bin        - Executables
114
lib        - Libraries
115
makefiles  - As the name suggests, makefiles
116
 
12 jab 117
src contains a number of subdirectories each of which represents a 
118
link library. apps  also contains subdirectories, however each of these
2 bj 119
is supposed to contain source code for an executable.
120
 
121
----------------------------------------------------------------------
122
3. FILE NAMES
123
----------------------------------------------------------------------
124
 
125
source files are *.c or *.cpp depending on whether it is C or C++
126
header files are named *.h
127
 
128
----------------------------------------------------------------------
129
4. MAKEFILES
130
----------------------------------------------------------------------
131
 
132
Some defintions:
133
----------------
134
 
135
The PLATFORM is a string concatenation of the os cpu and compiler, e.g.
136
 
137
Linux_i686_g++
138
 
58 jab 139
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
141
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
143
environment.
2 bj 144
 
145
 
146
Make'ing from the source root
147
-----------------------------
148
 
149
Just typing
150
> make 
151
 
152
from the root of the source tree will cause first every library and
153
then every application to be remade. However, there are several
154
targets.
155
 
178 bj 156
make all			 - equivalent to "make lib shared test app"
58 jab 157
 
2 bj 158
make lib       - make all libraries
159
 
178 bj 160
make shared    - For the current target platform combination, a shared library
161
								 is created by stringing together the compiled static libraries
162
 
2 bj 163
make app       - make all applications
164
 
165
make clean     - clean all library directories and app directories.
166
                 this removes only files pertaining to the current
167
                 platform and target (release/debug). This also
168
                 removes generated libraries. 
169
 
170
make distclean - cleans and completely removes all build directories. 
171
 
172
make platform  - copies a template to OS_CPU_COMPILER.mk in the
58 jab 173
                 makefiles directory. Use this only if you know what you
174
								 are doing.
2 bj 175
 
58 jab 176
make install   - Copies header files and libraries to the appropriate place
178 bj 177
							   which is PREFIX=/usr/local by default. The libraries which
178
								 are copied are either the debug or release versions depending
179
								 on the active target. 
58 jab 180
 
178 bj 181
								 Install does not install applications since many are little
182
								 test programs that do not belong in your path.
58 jab 183
 
178 bj 184
 
2 bj 185
Make'ing in subdirectories
186
--------------------------
187
 
39 bj 188
Go to a subdirectory of src, say src/somedir. 
2 bj 189
Here you have the following options:
190
 
58 jab 191
make
2 bj 192
make lib
193
make clean
194
 
58 jab 195
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
197
dependency files (but only for the current platform
198
(e.g. Linux_i686_g++_debug) The default target is lib.
2 bj 199
 
39 bj 200
Go to a subdirectory of apps, say apps/somedir. 
2 bj 201
Here you have the following options:
202
 
58 jab 203
make
204
 
205
or
206
 
2 bj 207
make app
208
 
209
will recompile the source files in the current directory and build the 
210
programs. This is the default target. When compiled, the application is
58 jab 211
moved to wherever/GEL/bin
2 bj 212
 
213
make force
214
 
215
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,
217
but it takes a few seconds more, so if you are sure the libraries are
218
up to date, just go make.
219
 
220
make clean
221
 
222
works like above. 
223
 
39 bj 224
Makefiles in subdirectories under apps should generally be edited.
225
When create by `make makefiles' the Makefile in apps/somedir looks
2 bj 226
like this 
227
 
228
PROGRAMS 	= prog1 prog2
229
OWN_LIBS 	= Lib1 Lib2
230
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
231
 
232
Add something like this
233
 
234
PROGRAMS 	= prog1 prog2
235
OWN_LIBS 	= Lib1 Lib2
236
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
237
 
238
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
240
other words, 
241
 
242
prog1.cpp 
243
prog2.cpp
244
 
245
must exist (and contain a main function)
246
 
247
Lib1 and Lib2 are libraries that must also be in the directory structure,
39 bj 248
i.e. under src there are subdirectories 
2 bj 249
 
39 bj 250
src/Lib1
251
src/Lib2
2 bj 252
 
253
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:
255
 
256
lib/PLATFORM_TARGET/
257
 
258
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
260
such libraries here:
261
 
262
lib/PLATFORM/
263
 
264
this directory is created by 
265
 
266
make platform from the source root.
267
 
268
----------------------------------------------------------------------
269
5. CONFIGURATION
270
----------------------------------------------------------------------
271
 
272
When you add a new project to this framework, you should go through
273
the following steps:
274
 
39 bj 275
Add directories for libraries under src. E.g. add 
2 bj 276
 
39 bj 277
mkdir src/somelib
2 bj 278
 
279
Then add directories for applications:
280
 
39 bj 281
mkdir apps/someapp
2 bj 282
 
283
Copy appropriate source files to these directories and then edit
284
 
285
makefiles/config.mk
286
 
287
to tell us which compiler to use (leave blank to use default) 
58 jab 288
 
2 bj 289
Finally, from the source root type 
290
 
291
make platform
292
 
293
Depending on your compiler you may now have to edit the makefile called
294
 
295
makefiles/PLATFORM.mk 
296
 
297
to set special compile flags. No go 
298
 
299
make makefiles
300
 
301
Finally you are all set. Go
302
 
303
make
304
 
305
 
306
----------------------------------------------------------------------
178 bj 307
6. DEPENDENCIES IN GEL
2 bj 308
----------------------------------------------------------------------
309
 
178 bj 310
Each directory under src represents a library. There are some dependencies
311
between these libraries.
312
 
313
 
314
 
315
lib						depends on
316
-----------------------------------
317
CGLA 					nothing 
318
 
319
Util 					CGLA
320
 
321
LinAlg 				CGLA
322
 
323
Geometry 			LinAlg, CGLA
324
 
325
HMesh					CGLA, Util, Geometry, LinAlg (indirectly)
326
 
327
GLGraphics		Everything (since it contains general rendering
328
							facilities)
329
 
330
 
331
----------------------------------------------------------------------
332
7. TODO
333
----------------------------------------------------------------------
334
 
2 bj 335
- No real testing of blended C and C++.
336
- No dependency computation for .c 
337
 
338
 
339
 
340
 
341
 
342