Subversion Repositories gelsvn

Rev

Rev 12 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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