Subversion Repositories gelsvn

Rev

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

Rev Author Line No. Line
2 bj 1
 
12 jab 2
 GEL README, Andreas Bærentzen, March 05
2 bj 3
 
12 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.
6
 
7
 This is a complex source tree which is intended for use both under a 
114 jab 8
 variety of unix platforms and under windows. This README is mostly for
9
 unix users. Windows users should also consult README_MSVC
12 jab 10
 
2 bj 11
======================================================================
12
 
13
----------------------------------------------------------------------
14
1. INTRODUCTION
15
----------------------------------------------------------------------
16
 
17
In the following, I discuss the structure of the source code and how to
18
add new directories to the framework. 
19
 
20
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.
22
A seperate configuration is kept for each combination of OS, architecture, 
23
and compiler. It is possible to specify targets release or debug.
24
 
25
Source files are compiled in build directories, and separate build 
26
directories are kept for each unique combination of 
27
 
28
os architecture compiler target
29
 
30
such as
31
 
32
Linux_i686_g++3_debug
33
 
34
this makes it easier to work in a heterogenous environment or to 
35
experiment with seperate compilers or just to switch between debug mode 
36
and optimized.
37
 
38
To see how to use the framework, you may skip to section 5.
39
 
40
----------------------------------------------------------------------
41
2. DIRECTORY STRUCTURE
42
----------------------------------------------------------------------
43
 
44
The directories under the root of the source tree (where you find this 
45
README) are
46
 
12 jab 47
src        - Source code for GEL libraries
48
apps       - Source code for applications
114 jab 49
apps       - Source code for test programs
2 bj 50
doc        - Documentation
51
bin        - Executables
52
lib        - Libraries
53
makefiles  - As the name suggests, makefiles
54
 
12 jab 55
src contains a number of subdirectories each of which represents a 
56
link library. apps  also contains subdirectories, however each of these
2 bj 57
is supposed to contain source code for an executable.
58
 
59
----------------------------------------------------------------------
60
3. FILE NAMES
61
----------------------------------------------------------------------
62
 
63
source files are *.c or *.cpp depending on whether it is C or C++
64
header files are named *.h
65
 
66
----------------------------------------------------------------------
67
4. MAKEFILES
68
----------------------------------------------------------------------
69
 
70
Some defintions:
71
----------------
72
 
73
The PLATFORM is a string concatenation of the os cpu and compiler, e.g.
74
 
75
Linux_i686_g++
76
 
58 jab 77
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
79
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
81
environment.
2 bj 82
 
83
 
84
Make'ing from the source root
85
-----------------------------
86
 
87
Just typing
88
> make 
89
 
90
from the root of the source tree will cause first every library and
91
then every application to be remade. However, there are several
92
targets.
93
 
178 bj 94
make all			 - equivalent to "make lib shared test app"
58 jab 95
 
2 bj 96
make lib       - make all libraries
97
 
178 bj 98
make shared    - For the current target platform combination, a shared library
99
								 is created by stringing together the compiled static libraries
100
 
2 bj 101
make app       - make all applications
102
 
103
make clean     - clean all library directories and app directories.
104
                 this removes only files pertaining to the current
105
                 platform and target (release/debug). This also
106
                 removes generated libraries. 
107
 
108
make distclean - cleans and completely removes all build directories. 
109
 
110
make platform  - copies a template to OS_CPU_COMPILER.mk in the
58 jab 111
                 makefiles directory. Use this only if you know what you
112
								 are doing.
2 bj 113
 
58 jab 114
make install   - Copies header files and libraries to the appropriate place
178 bj 115
							   which is PREFIX=/usr/local by default. The libraries which
116
								 are copied are either the debug or release versions depending
117
								 on the active target. 
58 jab 118
 
178 bj 119
								 Install does not install applications since many are little
120
								 test programs that do not belong in your path.
58 jab 121
 
178 bj 122
 
2 bj 123
Make'ing in subdirectories
124
--------------------------
125
 
39 bj 126
Go to a subdirectory of src, say src/somedir. 
2 bj 127
Here you have the following options:
128
 
58 jab 129
make
2 bj 130
make lib
131
make clean
132
 
58 jab 133
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
135
dependency files (but only for the current platform
136
(e.g. Linux_i686_g++_debug) The default target is lib.
2 bj 137
 
39 bj 138
Go to a subdirectory of apps, say apps/somedir. 
2 bj 139
Here you have the following options:
140
 
58 jab 141
make
142
 
143
or
144
 
2 bj 145
make app
146
 
147
will recompile the source files in the current directory and build the 
148
programs. This is the default target. When compiled, the application is
58 jab 149
moved to wherever/GEL/bin
2 bj 150
 
151
make force
152
 
153
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,
155
but it takes a few seconds more, so if you are sure the libraries are
156
up to date, just go make.
157
 
158
make clean
159
 
160
works like above. 
161
 
39 bj 162
Makefiles in subdirectories under apps should generally be edited.
163
When create by `make makefiles' the Makefile in apps/somedir looks
2 bj 164
like this 
165
 
166
PROGRAMS 	= prog1 prog2
167
OWN_LIBS 	= Lib1 Lib2
168
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
169
 
170
Add something like this
171
 
172
PROGRAMS 	= prog1 prog2
173
OWN_LIBS 	= Lib1 Lib2
174
LIBS			= ${GLLIBS} ${XLIBS} -lm -lz -lexpat
175
 
176
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
178
other words, 
179
 
180
prog1.cpp 
181
prog2.cpp
182
 
183
must exist (and contain a main function)
184
 
185
Lib1 and Lib2 are libraries that must also be in the directory structure,
39 bj 186
i.e. under src there are subdirectories 
2 bj 187
 
39 bj 188
src/Lib1
189
src/Lib2
2 bj 190
 
191
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:
193
 
194
lib/PLATFORM_TARGET/
195
 
196
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
198
such libraries here:
199
 
200
lib/PLATFORM/
201
 
202
this directory is created by 
203
 
204
make platform from the source root.
205
 
206
----------------------------------------------------------------------
207
5. CONFIGURATION
208
----------------------------------------------------------------------
209
 
210
When you add a new project to this framework, you should go through
211
the following steps:
212
 
39 bj 213
Add directories for libraries under src. E.g. add 
2 bj 214
 
39 bj 215
mkdir src/somelib
2 bj 216
 
217
Then add directories for applications:
218
 
39 bj 219
mkdir apps/someapp
2 bj 220
 
221
Copy appropriate source files to these directories and then edit
222
 
223
makefiles/config.mk
224
 
225
to tell us which compiler to use (leave blank to use default) 
58 jab 226
 
2 bj 227
Finally, from the source root type 
228
 
229
make platform
230
 
231
Depending on your compiler you may now have to edit the makefile called
232
 
233
makefiles/PLATFORM.mk 
234
 
235
to set special compile flags. No go 
236
 
237
make makefiles
238
 
239
Finally you are all set. Go
240
 
241
make
242
 
243
 
244
----------------------------------------------------------------------
178 bj 245
6. DEPENDENCIES IN GEL
2 bj 246
----------------------------------------------------------------------
247
 
178 bj 248
Each directory under src represents a library. There are some dependencies
249
between these libraries.
250
 
251
 
252
 
253
lib						depends on
254
-----------------------------------
255
CGLA 					nothing 
256
 
257
Util 					CGLA
258
 
259
LinAlg 				CGLA
260
 
261
Geometry 			LinAlg, CGLA
262
 
263
HMesh					CGLA, Util, Geometry, LinAlg (indirectly)
264
 
265
GLGraphics		Everything (since it contains general rendering
266
							facilities)
267
 
268
 
269
----------------------------------------------------------------------
270
7. TODO
271
----------------------------------------------------------------------
272
 
2 bj 273
- No real testing of blended C and C++.
274
- No dependency computation for .c 
275
 
276
 
277
 
278
 
279
 
280