Building Modules

Common pre-requisites.

Starting from Open CASCADE 5.1.2 Open CASCADE is certified with using STL implementation by the supported compilers. Nevertheless the source code can be rebuilt using other implementations (for example STLPort) but Open CASCADE S.A.S. did not undertake any certification actions on such implementations and therefore cannot guarantee reliable work with other implementations.

You need about 4 GB of free disk space to rebuild Open CASCADE.

Before compilation, you need to build (or to install the binaries of) 3rd party libraries mentioned in Hardware and Software Requirements.

Rebuilding on Windows.

Attention:

- Please make sure you have Service Pack 5 installed for your MS Visual C++ 6.0 Compiler.

- Libraries (dll ,dlld ,lib and libd) and executable (exe) files built by MS Visual Studio projects on Windows platform, are now placed to the ros/win32 folder and replace their corresponding original libraries and executable files.

- Before compilation, you must define a path (menu Tools/Option, tab Directories of MS Visual Studio) to the include and library files of Tcl, Tk, Tix and have Java installed on your station. For building samples make sure paths to Qt and Fltk are also added.

- When building Open CASCADE Technology libraries from sources on Windows NT platform, the macro USE_OLD_STREAMS can be defined to enforce it using the old-style streams library rather than new (STL) streams (by default).

Rebuilding on Windows with MS Visual Studio project files.

The directory ros/adm/win32 contains two types of MS Visual Studio project files for MS VC++6.0 and VC++7.1 or VC++8.0 that you can use to rebuild Open CASCADE using either VC++6.0, VC++7.1 or VC++8.0 correspondingly. Each of them describes and builds one toolkit (.dll) or executable (.exe). They are designed to compile sources and to search include files in a directory structure created from downloaded archives. All these projects are gathered in workspaces corresponding to Open CASCADE modules.

The workspaces are listed below and must be rebuilt in accordance with that order. Inside every workspace there is a primary virtual project, called All, that should be used to rebuild all projects belonging to a workspace.

Below is the ordered list of workspaces to rebuilt.

- Foundation Classes (file FoundationClasses.*)

- Modeling Data (file ModelingData.*)

- Modeling Algorithms (file ModelingAlgorithms.*)

- Visualization (file Visualization.*)

- Application Framework (file ApplicationFramework.*)

- Data Exchange (file DataExchange.*)

- Draw (file Draw.*)

- WOK (file WOK.*)

- Wrappers (file Wrappers.*)

Where * is dsw for VC++ 6.0 or sln for VC++ 7.1 and VC++8.0

Rebuilding on Windows with the nmake command.

Apart from MS Visual Studio project files the directory ros/adm/win32 contains a set of *.mak files that allow to build OCCT modules and the whole OCCT using the nmake command.

Example:

nmake –f All.mak : This string allows to build the whole Open CASCADE.

nmake –f TKernel.mak : This string allows to build TKernel toolkit.

Rebuilding on Unix and Linux with WOK-derived scripts.

On Unix and Linux each module can be rebuilt with a file named <module>.COMP located in the $CASROOT/adm/platform/ directory where platform is a result of the uname command.

Attention:

- In order to adapt compilation procedures to your system configuration edit the $CASROOT/adm/<OS>/init file

- Modules must be rebuilt in accordance with the order described in "How to rebuild modules on Windows" chapter.

Example:

cd $CASROOT/adm/Linux
csh -f FoundationClasses.COMP

Rebuilding on Unix and Linux with autoconf, automake and libtool scripts.

Attention:

- During the compilation by makefiles on Mandrake 10.1 OS on a station with NVIDIA video card you may experience problems because the installation procedure of NVIDIA video driver removes library libGL.so included in package libMesaGL from directory /usr/X11R6/lib and places this library libGL.so in directory /usr/lib. However, libtool expects to find the library in directory /usr/X11R6/lib, which causes compilation crash (See /usr/X11R6/lib/libGLU.la).
  We suggest making links:
  ln -s /usr/lib/libGL.so /usr/X11R6/lib/libGL.so
  ln -s /usr/lib/libGL.la /usr/X11R6/lib/libGL.la

On Unix and Linux Open CASCADE can be also rebuilt using scripts based on GNU autoconf, automake and libtool. New corrected scripts have been placed in the $CASROOT/adm/make/... folders.

Set the environment variables CC to an ANSI C compiler, and CXX to your C++ compiler. If you are using GNU GCC, you can skip this step. If you have a Java compiler installed, add the include path for it to the CXXFLAGS environment variable. Although this is not required, it can be helpful for additional reliability. In many instances the same option must be passed to the link as well, do that by setting LDFLAGS.

Now use the ./configure with the correct option as described below.

--with-tcl=/path-where-tcl-is-installed :
for example --with-tcl=/usr/lib

--with-tk=/path-where-tk-is-installed :
for example --with-tk=/usr/lib

--with-gl-include=/path-where-gl-included-are-installed :
for example --with-gl-include=/usr/X11R6/include if GL/gl.h is located in /usr/X11R6/include
--with-gl-library=/path-where-gl- library-is-installed :
for example --with-gl-library=/usr/X11R6/lib if GL.so is located in this directory
--with-xmu-include=/path-where-xmu-included-ar-defined :
for example --with-xmu-include=/usr/X11/R6/include if /X11/Xmu/Xmu.h is located in /usr/X11R6/include
--with-xmu-library=/path-where-xmu-library-is-installed :
for example --with-xmu-library=/usr/X11R6/lib

--with-dps-include=/path-where-dps-included-ar-defined :
for example --with-dps-include=/usr/X11/R6/include/X11 if /DPS/dpsXclient.h is located in /usr/X11R6/include/X11
--with-dps-library=/path-where-xmu-library-is-installed :
for example --with-dps-library=/usr/X11R6/lib

--with-java-include=/path-where-java-included-are-istalled :
for example --with-java-include=/usr/java/include if jni.h is located in /usr/java/include

--enable-static=yes if you want to generate static library
--enable-shared=no if you don't want to generate shared library by default only shared library are built.

--enable-debug=yes/no - building in debug mode (yes: set -g key of compiler).
--enable-production=yes/no - building in optimase mode (yes: set -O key of compiler).
for example :
./configure --with-tcl=/usr/lib --with-tk=/usr/lib --with-gl-include=/usr/X11R6/include --with-gl-library=/usr/X11R6/lib
--with-xmu-include=/usr/X11R6/include --with-xmu-library=/usr/X11R6/lib
--with-dps-include=/usr/X11R6/include/X11 --with-dps-library=/usr/X11R6/lib --prefix=/opt/OpenCASCADE

If configure exits successfully, you can then build all of Open CASCADE with the ./make command.