Salome HOME
DCQ: prepare V2.0.0
[modules/kernel.git] / doc / DevelopersGuide / DevelopersGuide.tex.in
1 \documentclass[11pt,a4paper]{article}
2 \usepackage{isolatin1}
3 \usepackage{psfig}
4 \usepackage{graphicx}
5 \usepackage{fancyheadings}
6 \usepackage{lastpage}
7 \usepackage{epic}
8 \usepackage{longtable}
9 \usepackage{times}
10 \usepackage{verbatim}
11
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 % mise en page du document %
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
16   \voffset -20pt
17   \topmargin 0 cm
18   \headheight 15pt
19   \headsep 0 cm
20   \textheight 670 pt
21   \footskip 1 cm
22   \marginparwidth 0 cm
23   \oddsidemargin 0 cm
24   \evensidemargin 0 cm
25   \textwidth 16.2 cm
26   \parindent 0 cm
27
28 %
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 % test si on passe par pdflatex %
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 \newif\ifpdf 
33         \ifx\pdfoutput\undefined 
34         \pdffalse % we are not running pdflatex 
35         \else 
36         \pdfoutput=1 % we are running pdflatex 
37         \pdfcompresslevel=9     % compression level for text and image;
38         \pdftrue 
39         \fi
40
41 \ifpdf
42 \usepackage{thumbpdf}
43 \usepackage[pdftex,
44         colorlinks=true,
45         urlcolor=rltblue,       % \href{...}{...} external (URL)
46         filecolor=rltgreen,     % \href{...} local file
47         linkcolor=rltred,       % \ref{...} and \pageref{...}
48         pdftitle={Adding a new module or unit development},
49         pdfauthor={Patrick Goldbronn, Marc Tajchman},
50         pdfsubject={},
51         pdfkeywords={},
52         pagebackref,
53         pdfpagemode=None,
54         bookmarksopen=true]{hyperref}
55 \usepackage{color}
56 \definecolor{rltred}{rgb}{0.75,0,0}
57 \definecolor{rltgreen}{rgb}{0,0.5,0}
58 \definecolor{rltblue}{rgb}{0,0,0.75}
59 \else
60 \usepackage{color}
61 \fi
62
63 %%
64 %%%%%%%%%%%%%%%%%%%%%%%%%
65 %% epaisseur des traits %
66 %%%%%%%%%%%%%%%%%%%%%%%%%
67 \linethickness{1pt}
68 %%
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
70 %% mise en page des environnement array %
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72  \arraycolsep 2pt
73  \renewcommand{\arraystretch}{1.6}
74 %%
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%
76 %% interligne du document %
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%
78 \renewcommand{\baselinestretch}{1.2}
79 %%
80 %%%%%%%%%%%%%%%%%%%%%%%%
81 %% haut et bas de page %
82 %%%%%%%%%%%%%%%%%%%%%%%%
83 \newcommand{\version}{0.3}
84
85 \pagestyle{fancy}
86 %
87  \chead{}
88  \lhead{}
89  \rhead{}
90 %
91  \lfoot{
92         SALOME
93        }
94  \cfoot{
95          Using the SALOME configuration and building system V. \version
96        }
97  \rfoot{
98         \thepage/\pageref{LastPage}
99        }
100 %%
101  \setlength{\headrulewidth}{0pt}
102  \setlength{\footrulewidth}{1pt}
103 %
104 %-----------------------------------------------------------
105 % Les racourcis :
106 \newcommand{\fsc}{\sc}
107
108
109 %%-----------------------------------------------------------
110 %%-----------------------------------------------------------
111 %%-----------------------------------------------------------
112
113
114 %% Bring items closer together in list environments
115 % Prevent infinite loops
116 \let\Itemize =\itemize
117 \let\Enumerate =\enumerate
118 \let\Description =\description
119 % Zero the vertical spacing parameters
120 \def\Nospacing{\itemsep=4pt\topsep=-5pt\partopsep=-5pt%
121 \parskip=0pt\parsep=0pt}
122 % Redefinition de art12.sty pour commencer a la marge de gauche
123 %\leftmargini 1.2em      % 2.5em
124
125 \def\noitemsep{
126 % Redefine the environments in terms of the original values
127 \renewenvironment{itemize}{\Itemize\Nospacing}{\endlist}
128 \renewenvironment{enumerate}{\Enumerate\Nospacing}{\endlist}
129 \renewenvironment{description}{\Description\Nospacing}%
130 {\endlist}
131 }
132
133 \def\doitemsep{
134 % Redefine the environments to the original values
135 \renewenvironment{itemize}{\Itemize}{\endlist}
136 \renewenvironment{enumerate}{\Enumerate}{\endlist}
137 \renewenvironment{description}{\Description}{\endlist}
138 }
139
140 %%%% fin macro %%%%
141
142 \begin{document}
143 \noitemsep
144
145 %%%%%%%%%%%%%%%%%%%%
146 %% TITRE AUTEUR(S) %
147 %%%%%%%%%%%%%%%%%%%%
148
149 \textcolor{white}{.}
150 \vfill\vfill
151 \begin{figure}[!h]
152 \begin{center}
153 \ifpdf
154         \includegraphics[width=11.88cm, height=5.11cm]{@srcdir@/SALOME.png}
155 \else
156         \includegraphics[width=11.88cm, height=5.11cm]{@srcdir@/SALOME.ps}
157 \fi
158 \end{center}
159 \end{figure}
160
161 \bigskip
162 \bigskip
163
164 \begin{center}
165 {\usefont{T1}{phv}{bx}{n}
166 \huge Using the SALOME configuration and building system
167 environment
168 }
169 \bigskip
170 \medskip
171
172 {\LARGE Version \version}
173 \end{center}
174
175 \vfill
176
177 {
178 \large
179 \renewcommand{\arraystretch}{0.85}
180 \begin{tabular}{lll}
181 Patrick & Goldbronn & C.E.A. \\
182 Marc & Tajchman & C.E.A.
183 \end{tabular}
184 }
185
186
187 \def\Mkin{{\tt Makefile.in }}
188
189 \thispagestyle{empty}
190
191 \newpage
192 %-----------------------------------------------------------
193 \section*{Successive versions}
194
195 \vfill
196 \begin{tabular}{|p{2cm}|p{1.5cm}|p{8cm}|p{2cm}|}
197 \hline
198 \textbf{Date} & \textbf{Version} & \textbf{Description} & \textbf{Author(s)}\\
199 \hline
200 10/07/2001& 0.0 & Initial version & PG \\
201 \hline
202 25/07/2001 & 0.1 & English traduction, rewriting & MT \\
203 \hline
204 29/08/2001 & 0.2 & Add source creation, some precision & PG \\
205 \hline
206 24/05/2002 & 0.3 & Add instruction to do installation correctly & PG \\
207 \hline
208 \end{tabular}
209 \vfill
210 \vfill
211
212 %\thispagestyle{empty}
213 \newpage
214 %-----------------------------------------------------------
215   \begin{abstract}
216     This document contains rules and advices to configure,
217     build and extend the SALOME platform.
218   \end{abstract}
219
220   \newpage
221 %-----------------------------------------------------------
222   \tableofcontents
223   \newpage
224   \parskip 0.2 cm
225 %-----------------------------------------------------------
226 \newpage
227
228 \section{SALOME Configuration}
229
230 \subsection{Directories organisation}
231
232 We suppose here that you unpack the SALOME distribution from scratch.
233 The path to the SALOME sources will be named ``top source directory''
234 or {\tt SALOME\_ROOT}.
235
236 It is possible, but not advised, to build the set of binaries and libraries
237 in the same subtree. Instead, we suppose you have choosen a different subtree
238 where to put builded files (you can so build to multiples architectures from the same source tree). The root of the build subtree will be named
239 ``top build directory''.
240
241 At the end of configuration and compilation processs, you may install
242 builded files in a separate subtree, name ``installation subtree''.
243 The root of the installation subtree will be named ``top installation directory''.
244
245 The figure \ref{FigDirs} shows subtrees organisation.
246
247 \begin{figure}[h]
248 \ifpdf
249         \includegraphics{@srcdir@/subtrees.pdf}
250 \else
251         \includegraphics{@srcdir@/subtrees.eps}
252 \fi
253 \caption{\label{FigDirs} Subtrees organisation}
254 \end{figure}
255
256 \subsection{PreConfiguration step}
257
258 SALOME needs some environment variables (to be defined for example in
259 a .cshrc or .bashrc file in your home directory)~:
260
261 \begin{tabular}{|p{3.5cm}|p{11cm}|}
262 \hline
263 \it variable & \it set value and check \\
264 \hline
265 {\tt QTDIR} & root directory of qt distribution ({\tt \$QTDIR/lib} must contain libqt.so) \\ 
266 \hline
267 {\tt HDF5HOME} & root directory of hdf5 distribution ({\tt \$HDF5HOME/lib} must contain libhdf5.so) \\
268 \hline
269 {\tt VTKHOME} & root directory of vtk distribution ({\tt \$VTKHOME/common} must contain libVTKCommon.so) \\
270 \hline
271 {\tt CASROOT} & root directory of OpenCascade distribution ({\tt \$CASROOT/Linux/lib} must contain libTKernel.so) \\
272 \hline
273 {\tt PYTHONHOME} & root directory of python distribution ({\tt \$PYTHONHOME/lib/pythonXXX/config} must contain libpythonXXX.a) \\
274 \hline
275 {\tt OMNIORB\_CONFIG } & path to the omniORB.cfg file (this file contains default
276 options to omniORB, see below) \\
277 \hline
278 \end{tabular}
279
280 \bigskip
281 Create a file named omniORB.cfg in your root tree, containing default
282 options to omniORB. Put in this file, the following line~:
283 \begin{verbatim}
284 ORBInitRef NameService=corbaname::localhost
285 \end{verbatim}
286
287 (tells omniORB that the CORBA name service is local).
288
289 \subsection{Configuration step}
290
291 \begin{enumerate}
292 \item There are two cases~:
293 \begin{itemize}
294 \item There is a {\tt configure} file in the top source directory,
295 and you didn't change the SALOME structure (adding a module or unit,
296 see sections \ref{sec_module} or \ref{sec_unit} below).
297 Go to point \ref{pConf}.
298 \item You don't have a {\tt configure} file or you add a module/unit
299 in the SALOME system.
300 Go to point \ref{pReConf}
301 \end{itemize}
302
303 \item \label{pReConf}
304 Go to the top source directory and type~:
305 \begin{verbatim}
306 ./reconfigure
307 \end{verbatim}
308 This script find all file with suffix {\tt .in} (which will be generate by {\tt configure} script) and add them in {\tt configure.in} file, launch {\tt aclocal} and {\tt autoconf} to generete {\tt configure} script.
309
310 Continue with point \ref{pConf}
311
312 \item \label{pConf}
313 Go to the top build directory you choose.
314
315 If you plan to install SALOME files after building in a non-standard
316 location (i.e. different from /usr/local), type~:
317
318 \begin{verbatim}
319 <path to the top source directory>/configure \
320                   --prefix=<installation directory>
321 \end{verbatim}
322
323 otherwise, type~:
324 \begin{verbatim}
325 <path to the top source directory>/configure
326 \end{verbatim}
327
328 where ``path to the top source directory'' is to be replaced by the path
329 to the SALOME sources.
330
331 For other options to the configure command, type~:
332 \begin{verbatim}
333 <path to the top source directory>/configure --help
334 \end{verbatim}
335
336 This will create a mirror subtree of the sources into the top build directory
337 where object files, binaries and libraries will be builded. Also a makefile
338 system will be created into the build tree.
339
340 \end{enumerate}
341
342 \subsection{PostConfiguration step}
343
344 This phase is optional, to be used only if the compilation process
345 (see next section) fails to use {\tt libtool} script.
346
347 On some systems, the {\tt libtool} script generated by the configure
348 command will not operate correctly during compilation
349 (see next section). If you encounter this situation,
350 copy the local libtool script in your system (e.g. in the /usr/bin
351 directory) to the top build directory after configuration and before
352 compilation phases.
353
354 Check the following line in libtool script :
355 \begin{verbatim}
356 deplibs_check_method=...
357 \end{verbatim}
358
359 If needed, replace this line by
360 \begin{verbatim}
361 deplibs_check_method="pass_all"
362 \end{verbatim}
363
364 \section{SALOME compilation}
365
366 From the top build directory, type
367 \begin{verbatim}
368 make
369 \end{verbatim}
370
371 After some time (be patient ...), it will create various binaries.
372 Building SALOME is split in several phases~:
373
374 \begin{itemize}
375 \item {\tt make inc} : copy/update header files exported by development units
376 in the directory {\tt inc} of the build tree ;
377 \item {\tt make depend\_idl} : determine dependencies between idl files (useful when recompiling SALOME after idl modification);
378 \item {\tt make depend (make dep)} : determine dependencies between source files and header files (useful when recompiling SALOME after source modification);
379 \item {\tt make lib} : generate libraries, put a copy/link into the {\tt lib} directory of the build tree;
380 \item {\tt make bin} : generate binaries;
381 \item {\tt make tests (make check)} : build and run tests (not yet implemented).
382 \end{itemize}
383
384 After building, testing, the user may install the system in a choosen directory
385 (different from and not included in the top source directory and the top build directory).
386
387 From the top build directory, type~:
388 \begin{quotation}\noindent%
389  {\tt make install} : install libraries, header and idl files, binaries,
390 resource files in the installation directory
391 \end{quotation}
392
393 \section{\label{sec_module}Module creation}
394
395 In this section, the new module will be named {\tt <Module>}. Replace
396 each occurence with the real name of your module.
397
398 \begin{enumerate}
399 \item In the source tree root {\tt SALOME\_ROOT}, create a new directory 
400 {\tt <Module>} :
401
402 \begin{verbatim}
403 cd SALOME_ROOT
404 mkdir <Module>
405 \end{verbatim}
406
407 \item Modify the \Mkin file in the {\tt SALOME\_ROOT} directory to add the new module~:
408
409 Append to the line beginning with
410 \begin{verbatim}
411 SUBDIRS = 
412 \end{verbatim}
413
414 the name of the new module.
415
416 \item In the module root directory, create two subdirectories {\tt src} and {\tt resources} and create a file \Mkin
417  (e.g. copy the corresponding file in {\tt GEOM} module for example)~:
418
419 \begin{verbatim}
420 cd <Module>
421 mkdir src
422 mkdir resources
423 cp ../GEOM/Makefile.in .
424 \end{verbatim}
425
426 \item In the {\tt src} subdirectory, copy a \Mkin file (e.g. from the corresponding file in {\tt GEOM/src} subdirectory  for example)~:
427
428 \begin{verbatim}
429 cd src
430 cp ../../GEOM/src/Makefile.in .
431 \end{verbatim}
432
433 \item Edit this file and replace the line
434 \begin{verbatim}
435 MODULE = GEOM
436 \end{verbatim}
437
438 with
439 \begin{verbatim}
440 MODULE = <Module>
441 \end{verbatim}
442
443 \item Edit this file and replace the line
444 \begin{verbatim}
445 SUBDIRS = GEOMDS GEOM GEOMGUI
446 \end{verbatim}
447
448 with
449 \begin{verbatim}
450 SUBDIRS = 
451 \end{verbatim}
452
453 (empty list of development units in this module).
454
455 \item Edit this file and replace the line
456 \begin{verbatim}
457 RESOURCES_FILES = arc.png \
458 ...
459 \end{verbatim}
460
461 with
462 \begin{verbatim}
463 RESOURCES_FILES = 
464 \end{verbatim}
465
466 (list of all ressources for this module).
467
468 \item Add the new \Mkin files in the global list of .in files.
469
470 In the root directory of the source tree, execute the {\tt reconfigure}
471 script or manually :
472
473 \begin{enumerate}
474 \item edit the configure.in file in the source tree root,
475 add \Mkin files into the {\tt AC\_OUTPUT} list,
476 \item from the source tree root directory, run the {\tt genconf} script which launch {\tt aclocal} and {\tt autoconf}.
477 \end{enumerate}
478
479 \end{enumerate}
480
481 Figure \ref{srctree_module} summarize these changes.
482
483 \begin{figure}[h]
484 \ifpdf
485         \includegraphics{@srcdir@/srctree_module.pdf}
486 \else
487         \includegraphics{@srcdir@/srctree_module.eps}
488 \fi
489 \caption{\label{srctree_module} Source tree : modification when adding an new module}
490
491 \end{figure}
492
493 \section{\label{sec_unit}Development unit creation}
494
495 Here we want to add a development unit named {\tt <Unit>}
496 in the existing module {\tt <Module>} (replace the names {\tt <Unit>}
497 and {\tt <Module>} with real ones).
498
499 \begin{enumerate}
500
501 \item In the {\tt src} subdirectory of {\tt <Module>}, create a 
502 subdirectory named {\tt <Unit>}~:
503
504 \begin{verbatim}
505 cd <path to <Module> >/src
506 mkdir <Unit> 
507 \end{verbatim}
508
509 Modify then \Mkin file in the {\tt src} directory to add 
510 the new unit
511 to the compilation process~:
512
513 Complete the line beginning with 
514 \begin{verbatim}
515 SUBDIRS = ... 
516 \end{verbatim}
517
518 with the name of the new directory
519
520 \begin{verbatim}
521 SUBDIRS = ... <Unit>
522 \end{verbatim}
523
524 \item Create a \Mkin file in the new {\tt <Unit>} directory (you can copy a \Mkin file from the corresponding subdirectory in {\tt GEOM} module : {\tt GEOM/src/GEOMGUI} subdirectory  for example, and modify as you need)
525
526
527 \begin{verbatim}
528 cd <Unit>
529 ... create Makefile.in
530 \end{verbatim}
531
532 The details of \Mkin creation is detailed in the next section.
533 \end{enumerate}
534
535
536 The different files of your unit must be located in several directories
537 (see figure \ref{srctree_unit} and the list below).
538
539 \begin{figure}[!h]
540 \ifpdf
541         \includegraphics{@srcdir@/srctree_unit.pdf}
542 \else
543         \includegraphics{@srcdir@/srctree_unit.eps}
544 \fi
545 \caption{\label{srctree_unit}Source tree : modification when adding an new unit in an existing module}
546 \end{figure}
547
548 \begin{itemize}
549 \item Private source and header files of your unit
550
551 Place the only copy of these files in your unit. If you use
552 the proposed makefile system, dont put them in subdirectories
553 of your unit.
554
555 Note
556 \begin{quotation}\noindent%
557 Using a non-flat directory structure for an unit, has not been
558 tested but it should work. You must write your makefile to take care 
559 of subdirectories.
560 \end{quotation}
561
562 \item Exported idl files from a unit
563
564 These files are provided by the unit for CORBA communication
565 with other units.
566
567 Place the only copy of these files into the idl subdirectory of the
568 root source tree.
569
570 \item Exported header files from a unit
571
572 These files are provided by the unit for direct communication
573 from other units (using the unit's library).
574
575 Place the master copy of these files in your unit subtree.
576
577 Assure that these files are automatically or manually copied in
578 the inc subdirectory of the root build tree.
579
580 \end{itemize}
581
582 \section{Creating a \Mkin file in a new unit}
583
584 \subsection{Using predefined make rules}
585
586 Copy the following \Mkin \ skeleton in the unit directory~:
587
588 \verbatiminput{@srcdir@/makefile.skel}
589
590 Adapt this \Mkin skeleton to your particular needs~:
591 \begin{itemize}
592 \item if you have to compile a library
593
594 \begin{enumerate} 
595 \item Complete the line
596 \begin{verbatim}
597 LIB = 
598 \end{verbatim}
599
600 as
601 \begin{verbatim}
602 LIB = lib<MyLibrary>.la
603 \end{verbatim}
604
605 Example~:
606 \begin{verbatim}
607 LIB = libGeometryGui.la
608 \end{verbatim}
609
610 Notes
611 \begin{enumerate}
612 \item the library name {\bf must} begin with {\tt lib} and end with 
613 {\tt .la} (this allows automatic creation of shared libraries with libtool).
614 \item there must be only one library by development unit
615 \end{enumerate}
616
617 \item Also add to the line~:
618 \begin{verbatim}
619 LIB_SRC = 
620 \end{verbatim}
621 the list of sources files (in this unit) needed to build the library
622
623 \item If your library uses QT MOC file, add to the line~:
624 \begin{verbatim}
625 LIB_MOC =
626 \end{verbatim}
627 the list of headers files to transform with moc.
628
629 \item If your library uses CORBA functionnalities from other units (i.e.
630 uses idl files exported from other units), add to the line~:
631 \begin{verbatim}
632 LIB_CLIENT_IDL =
633 \end{verbatim}
634 the list of idl files.
635
636 \item If your unit provides CORBA functionnalities (i.e. exports idl
637 files to the other units), add to the line~:
638 \begin{verbatim}
639 LIB_SERVER_IDL =
640 \end{verbatim}
641 the list of idl files.
642 \end{enumerate}
643
644 \item if you want to build one or more executables~:
645
646 \begin{enumerate} 
647 \item Complete the line
648 \begin{verbatim}
649 BIN = 
650 \end{verbatim}
651
652 as
653 \begin{verbatim}
654 BIN = <MyBin1> <MyBin2> ..
655 .
656 \end{verbatim}
657
658 Note
659 \begin{quotation}\noindent%
660 For each executable in the {\tt BIN} list, say {\tt MyBin1}, the main 
661 function {\bf must} be in a file named accordingly, in this example~: 
662 {\tt MyBin1.cxx} and {\tt MyBin2.cxx}.
663 \end{quotation}
664
665 \item Also add to the line~:
666 \begin{verbatim}
667 BIN_SRC = 
668 \end{verbatim}
669 the list of source files (in this unit) needed to build {\bf all} the executables,
670 {\bf excluding files containing main function(s)}.
671
672 Notes~:
673 \begin{enumerate}
674 \item The makefile system will automatically add to each executable, its
675 main function file. That's why these files must not be included in the 
676 {\tt BIN\_SRC} list
677 \item The object files (compiled from the source files in the {\tt BIN\_SRC}
678 list) will be properly dispatched between the executables by the linker.
679 \end{enumerate}
680
681 \item If your binaries uses QT MOC file, add to the line~:
682 \begin{verbatim}
683 BIN_MOC =
684 \end{verbatim}
685 the list of headers files to transform with moc.
686
687 \item If your binaries uses CORBA functionnalities from other units (i.e.
688 uses idl files exported from other units), add to the line~:
689 \begin{verbatim}
690 BIN_CLIENT_IDL =
691 \end{verbatim}
692 the list of idl files.
693
694 \item If your unit provides CORBA functionnalities (i.e. exports idl
695 files to the other units), add to the line~:
696 \begin{verbatim}
697 BIN_SERVER_IDL = 
698 \end{verbatim}
699 the list of idl files.
700
701 \end{enumerate}
702
703 \item List the exported header files that your unit provides
704 to other developments units~:
705
706 Complete the line
707 \begin{verbatim}
708 EXPORT_HEADERS =
709 \end{verbatim}
710 with the list header files.
711
712 Note
713 \begin{quotation}\noindent%
714 The makefile system will automatically copy these files in a 
715 subdirectory {\tt inc} in the top build directory, and maintain
716 coherence with your private copy inside your unit subtree.
717 This is to assure name uniqueness of differents exported header
718 files from different units and to write easier makefiles. 
719 \end{quotation}
720
721 \item List the python scripts files that your unit export~:
722
723 Complete the line
724 \begin{verbatim}
725 EXPORT_PYSCRIPTS =
726 \end{verbatim}
727
728 \item To generate qm file from po file (use by QT), list po files in~:
729
730 \begin{verbatim}
731 PO_FILES =
732 \end{verbatim}
733 Note
734 \begin{quotation}\noindent%
735 The resulting qm files will ge generated directory which contain Makefile.
736 It will be copied in resources directory when do {\tt 'make install'}.
737 \end{quotation}
738
739 \end{itemize}
740
741
742 \subsection{Using your own makefiles in an unit}
743
744 If the proposed makefile system don't suit your needs (several libraries,
745 non flat unit subtree structure, ...). It's possible
746 to write your own makefiles.
747
748 \begin{enumerate}
749 \item Create a file \Mkin
750
751 This file must begin with the lines
752
753 \verbatiminput{@srcdir@/makefile_own.skel}
754
755 \bigskip
756
757 The rest of the file has the standard GNU make format.
758
759 You must define the following targets~:
760
761 \begin{enumerate}
762 \item {\tt inc} : copy/update the exported header files to the {\tt \$top\_builddir/inc} directory
763 \item {\tt dep} : update dependencies
764 \item {\tt lib} : build libraries and link them into the {\tt \$top\_builddir/lib} directory
765 \item {\tt bin} : build executables and link them into the {\tt \$top\_builddir/bin} directory
766 \end{enumerate}
767
768 Some of these targets may be empty, if not applicable.
769
770 \end{enumerate}
771
772 The line 
773 \begin{verbatim}
774 @\texttt{COMMENCE}@
775 \end{verbatim}
776 provides a number of predefined variables that you can use in your makefile
777 rules (defining standard libraries locations, compiler options, ..., see next section).
778
779
780 \section{Add or remove a script}
781
782 If you want to add a new shell script in {\tt SALOME\_ROOT/bin}, you must edit {\tt SALOME\_ROOT/Makefile.in} to add it in {\tt BIN\_SCRIPT}.
783
784 If this script have some package dependent variable, you must create a ".in" file and add this reference to {\tt configure.in} file.
785
786 To remove an existing script, you must of course remove it from CVS archive and also remove it from {\tt SALOME\_ROOT/Makefile.in} and if any, from {\tt configure.in}.
787
788 If you want to add a new python script, put it in {\tt EXPORT\_PYSCRIPTS} variable. It will be copied at same place than others executables.
789
790
791 \section{Add or remove an IDL file}
792
793 If you want to add a new IDL file in {\tt SALOME\_ROOT/idl}, you must edit {\tt SALOME\_ROOT/idl/Makefile.in} and add its in {\tt IDL\_FILES}.
794
795 To remove an existing IDL file, you must of course remove it from CVS archive and also remove it from {\tt SALOME\_ROOT/idl/Makefile.in}.
796
797
798 \section{Predefined symbols used in {\tt Makefile.in}}
799
800 You can use predefined symbols in you {\tt Makefile.in} files.
801 These symbols define
802 \begin{itemize}
803 \item compilation flags for source compiling,
804 \item header files location in your local system,
805 \item libraries needed for binaries linking.
806 \end{itemize}
807
808 For example to use the OpenCascade libraries in your unit, you will add the
809 \begin{itemize}
810 \item {\tt \$OCC\_INCLUDES} symbol to the included header file locations,
811 \item {\tt \$OCC\_CXXFLAGS} symbol to the compilation flags,
812 \item {\tt \$OCC\_LIBS} symbol to the linker's flags
813 \end{itemize}
814
815 If you use the predefined make rules, add the lines
816 \begin{verbatim}
817 CPPFLAGS+=$(OCC_INCLUDES)
818 CXXFLAGS+=$(OCC_CXXFLAGS)
819 LDFLAGS+=$(OCC_LIBS)
820 \end{verbatim}
821 in your {\tt Makefile.in} file after the @{\tt COMMENCE}@ line.
822
823 For each standard tool you need in SALOME (QT, python, OpenCascade, CORBA, VTK, \ldots), main symbols listed below.
824
825 \begin{enumerate}
826 \bigskip
827
828 \item {\it Corba}
829 \smallskip
830
831 \begin{longtable}{|p{3.2cm}|p{9.1cm}|}
832 \hline
833 \it variable & \it value \\
834 \hline
835 {\tt CORBA\_ROOT } & CORBA home base \\
836 \hline
837 {\tt CORBA\_INCLUDES} & compiler options to include CORBA headers \\ 
838 \hline
839 {\tt CORBA\_LIBS } & libraries needed to link with CORBA \\
840 \hline
841 {\tt CORBA\_CXXFLAGS } & C++ compiler options to use with CORBA \\ 
842 \hline
843 {\tt IDL} &  idl compiler \\
844 \hline
845 {\tt IDLCXXFLAGS} & options to the idl compiler to generate C++ 
846 stub or skeleton code \\ 
847 \hline
848 {\tt IDLPYFLAGS} &  options to the idl compiler to generate python
849 stub or skeleton code \\
850 \hline
851 {\tt IDL\_CLN\_H} & extension of generated CORBA header files (client side) \\
852 \hline
853 {\tt IDL\_CLN\_CXX} & extension of generated CORBA source files (client side) \\
854 \hline
855 {\tt IDL\_CLN\_OBJ} & extension of generated CORBA object files (client side) \\
856 \hline
857 {\tt IDL\_SRV\_H} & extension of generated CORBA header files (server side) \\
858 \hline
859 {\tt IDL\_SRV\_CXX} & extension of generated CORBA source files (server side) \\
860 \hline
861 {\tt IDL\_SRV\_OBJ} & extension of generated CORBA object files (server side) \\
862 \hline
863 \end{longtable}
864
865 \item {\it python}
866 \smallskip
867
868 \begin{longtable}{|p{3.2cm}|p{9.1cm}|}
869 \hline
870 \it variable & \it value \\
871 \hline
872 {\tt PYTHON} & python interpreter (absolute path to) \\
873 \hline
874 {\tt PYTHON\_VERSION} & python version \\
875 \hline
876 {\tt PYTHONHOME} & python home base (sometimes needed
877                   to run python) \\
878 \hline
879 {\tt PYTHON\_INCLUDES} & compiler options to include python header files \\
880 \hline
881 {\tt PYTHON\_LIBS} & libraries needed to link with python \\
882 \hline
883 \end{longtable}
884
885 \bigskip
886 \item {\it QT}
887 \smallskip
888
889 \begin{longtable}{|p{3.2cm}|p{9.1cm}|}
890 \hline
891 \it variable & \it value \\
892 \hline
893 {\tt MOC} & moc compiler \\
894 \hline
895 {\tt UIC} & uic graphical compiler \\
896 \hline
897 {\tt QTDIR} & QT home base \\
898 \hline
899 {\tt QT\_ROOT} & QT home base \\
900 \hline
901 {\tt QT\_INCLUDES} & compiler options to include QT headers \\
902 \hline
903 {\tt QT\_MT\_INCLUDES} & same as above, for multithreaded applications \\
904 \hline
905 {\tt QT\_LIBS} & libraries needed to link with QT (single threaded) \\
906 \hline
907 {\tt QT\_MT\_LIBS} & same as above, for multithreaded applications \\
908 \hline
909 \end{longtable}
910
911 For SALOME developments, multithreaded versions of qt options and libraries
912 are needed.
913
914 \bigskip
915 \item {\it OpenGL}
916 \smallskip
917
918 \begin{longtable}{|p{3.2cm}|p{9.1cm}|}
919 \hline
920 \it variable & \it value \\
921 \hline
922 {\tt OGL\_INCLUDES} & compiler options to include OpenGL headers \\
923 \hline
924 {\tt OGL\_LIBS} & libraries needed to link with OpenGL  \\
925 \hline
926 \end{longtable}
927
928 \bigskip
929 \item {\it VTK}
930 \smallskip
931
932 \begin{longtable}{|p{3.2cm}|p{9.1cm}|}
933 \hline
934 \it variable & \it value \\
935 \hline
936 {\tt VTK\_INCLUDES} & compiler options to include VTK headers \\
937 \hline
938 {\tt VTK\_LIBS} & libraries needed to link with VTK  \\
939 \hline
940 \end{longtable}
941
942 \bigskip
943 \item {\it HDF (v5)}
944 \smallskip
945
946 \begin{longtable}{|p{3.2cm}|p{9.1cm}|}
947 \hline
948 \it variable & \it value \\
949 \hline
950 {\tt HDF5\_INCLUDES} & compiler options to include HDF headers \\
951 \hline
952 {\tt HDF5\_LIBS} & libraries needed to link with HDF  \\
953 \hline
954 {\tt HDF5\_MT\_LIBS} & libraries needed to link with HDF
955   (multithreaded version)  \\
956 \hline
957 \end{longtable}
958
959 \bigskip
960 \item {\it OpenCascade}
961 \smallskip
962
963 \begin{longtable}{|p{3.2cm}|p{9.1cm}|}
964 \hline
965 \it variable & \it value \\
966 \hline
967 {\tt OCC\_INCLUDES} & compiler options to include OpenCascade headers \\
968 \hline
969 {\tt OCC\_LIBS} & libraries needed to link with OpenCascade  \\
970 \hline
971 {\tt OCC\_CXXFLAGS} & C++ compiler options to use with OpenCascade \\
972 \hline
973 \end{longtable}
974
975 \end{enumerate}
976
977 \section{Location of generated files in the build tree}
978
979 A partial view of the build tree shows the location of files generated
980 during the compilation process.
981
982 \begin{figure}[h]
983 \ifpdf
984         \includegraphics{@srcdir@/bldtree.pdf}
985 \else
986         \includegraphics{@srcdir@/bldtree.eps}
987 \fi
988 \caption{Partial view of the build tree : generated files during compilation}
989 \end{figure}
990
991 \section{What's matter when launch {\tt make install}}
992
993 When all libraries and binaries files are generated, make copies all identified files as {\tt configure} parameters {\tt --prefix}, {\tt bindir}, {\tt datadir}, ... (see {\tt configure --help} for details).
994
995 If you specify nothing, all are installed in {\tt <prefix>=/usr/local}.
996
997 All executables (binaries and scripts) are placed in {\tt <prefix>/bin} (see BIN and BIN\_SCRIPT variables in {\tt Makefile}).
998
999 All libraries are placed in {\tt <prefix>/lib} (see LIB variable in {\tt Makefile}).
1000
1001 All includes are placed in {\tt <prefix>/include} (see EXPORT\_HEADERS variable in {\tt Makefile}).
1002
1003 All idls are placed in {\tt <prefix>/idl} (see IDL\_FILES variable in {\tt Makefile}).
1004
1005 All python srcipts are placed in {\tt <prefix>/lib/pythonX.X/...} (see {\tt EXPORT\_PYSCRIPTS} variable in {\tt Makefile}).
1006
1007 All ressources files (icons, messages, configuration, ...) are placed in {\tt <prefix>/share/salome/ressources} (see RESOURCES\_FILES variable in {\tt Makefile}).
1008
1009
1010 \section{Creating source files according to SALOME building system}
1011
1012 Building system use dependencies between files writing in Makefile rules. We use {\tt C} or {\tt C++} preprocessor to automatically generate this dependencies rules.
1013
1014 There are some configuration and useful macro defined in header file {\tt SALOMEconfig.h}. \textbf{All files should be included this header !}
1015 You must include it ussing {\tt <>} delimiter because {\tt SALOMEconfig.h} must not appear in dependencies rules (see below \ref{include}). 
1016
1017 When a {\tt Makefile} is regenerate with {\tt config.status} script, all files are regenerates (in particular {\tt SALOMEconfig.h}).It is a restriction of {\tt autoconf 2.13} which could not regenerate only one particular file. 
1018 So, all files which depend of {\tt SALOMEconfig.h} are rebuild even if it does not change. If you effectively change {\tt SALOMEconfig.h} file, you must clean all and rebuild.
1019
1020 \subsection{{\tt C} or {\tt C++} source files}
1021
1022 \textbf{You must name your {\tt C} file {\tt <myCFile>.c} and header file {\tt <myCHeaderFile>.h}}
1023
1024 \textbf{You must name your {\tt C++} file {\tt <myC++File>.cxx} and header file {\tt <myC++HeaderFile>.hxx}}
1025
1026 To have right dependencies rules, you must correctly write the include statement in your source files. We only take care about SALOME package header files to generate dependencies. We suppose that other header files (qt, vtk, OpenCascade, ...) are stables and are not modified when we build some SALOME modules.
1027
1028 According to cpp documentation, local header files must be included with {\tt ""} statement and system or tools headers files must be included with {\tt <>} statement.
1029 \label{include}
1030
1031 If you do not respect this notation, dependencies would not be true and some rebuilding trouble can appear~ !
1032
1033 \subsection{idl files}
1034
1035 We use {\tt C} preprocessor to build dependencies between idl files. The same convention must be applied as {\tt C} or {\tt C++} source files. 
1036
1037 If included file is an external files, you must use statement {\tt <>} because this file will not be modified during SALOME devloppement and/or building. 
1038 If included file is part of SALOME files, you must use statement {\tt ""}.
1039
1040 If you do not respect this notation, dependencies would not be true and some building or rebuilding trouble can appear~ !
1041
1042 \subsection{Included header file generated from idl file}
1043
1044 To include header file generated from idl file, you must use macro {\tt CORBA\_CLIENT\_HEADER} or \\
1045 {\tt CORBA\_SERVER\_HEADER} defined in {\tt SALOMEconfig.h}.
1046
1047 These two macros replace idl prefix into corresponding header name generated (take care if you use client part or server part)
1048
1049 {\bf Example :}
1050 \begin{verbatim}
1051 #include  CORBA_CLIENT_HEADER(geom)
1052 #include  CORBA_SERVER_HEADER(mesh)
1053 \end{verbatim}
1054
1055
1056 \end{document}