Subversion Repositories gelsvn

Rev

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

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