-
Notifications
You must be signed in to change notification settings - Fork 493
building_3rdparty
DEPRECATION NOTICE: This documentation is deprecated. Please visit the official documentation at https://dev.opencascade.org/doc/overview/html/ or download documentation from the release packages (https://github.com/Open-Cascade-SAS/OCCT/releases) or build it manually from the needed version. GitHub Actions triggered by PR also generates overview documentation (see "Build documentation" step in https://github.com/Open-Cascade-SAS/OCCT/actions/workflows/build-and-test-multiplatform.yml). On Windows, the easiest way to install third-party libraries is to download archive with pre-built binaries from https://dev.opencascade.org/resources/download/3rd-party-components. On Linux and macOS, it is recommended to use the version installed in the system natively.
This section presents guidelines for building third-party products used by Open CASCADE Technology (OCCT) and samples on Windows platform. It is assumed that you are already familiar with MS Visual Studio / Visual C++.
You need to use the same version of MS Visual Studio for building all third-party products and OCCT itself, in order to receive a consistent set of runtime binaries.
It is recommended to create a separate new folder on your workstation, where you will unpack the downloaded archives of the third-party products, and where you will build these products (for example, c:/occ3rdparty).
Further in this document, this folder is referred to as 3rdparty.
Tcl/Tk is required for DRAW test harness.
Installation from sources: Tcl
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
-
In the
winsub-directory, edit filebuildall.vc.bat:-
Edit the line
"call ... vcvars32.bat"to have correct path to the version of Visual Studio to be used for building, for instance:call "%VS80COMNTOOLS%\vsvars32.bat"If you are building 64-bit version, set environment accordingly, e.g.:
call "%VS80COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64 -
Define variable
INSTALLDIRpointing to directory where Tcl/Tk will be installed, e.g.:set INSTALLDIR=D:\OCCT\3rdparty\tcltk-86-32 -
Add option
installto the first command line callingnmake:nmake -nologo -f makefile.vc release htmlhelp install %1 -
Remove second call to
nmake(building statically linked executable)
-
-
Edit file
rules.vcreplacing lineSUFX = tsgxby
SUFX = sgxThis is to avoid extra prefix 't' in the library name, which is not recognized by default by OCCT build tools.
-
By default, Tcl uses dynamic version of run-time library (MSVCRT), which must be installed on the system where Tcl will be used. You may wish to link Tcl library with static version of run-time to avoid this dependency. For that:
-
Edit file
makefile.vcreplacing strings"crt = -MD"by"crt = -MT" -
Edit source file
tclMain.c(located in foldergeneric) commenting out forward declaration of functionisatty().
-
-
In the command prompt, run
buildall.vc.bat
You might need to run this script twice to havetclshexecutable installed; check subfolderbinof specified installation path to verify this. -
For convenience of use, we recommend making a copy of
tclshexecutable created in subfolderbinofINSTALLDIRand named with Tcl version number suffix, astclsh.exe(with no suffix)> cd D:\OCCT\3rdparty\tcltk-86-32\bin > cp tclsh86.exe tclsh.exe
Installation from sources: Tk
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
Apply the same steps as described for building Tcl above, with the same INSTALLDIR.
Note that Tk produces its own executable, called wish.
You might need to edit default value of TCLDIR variable defined in buildall.vc.bat (should be not necessary if you unpack both Tcl and Tk sources in the same folder).
FreeType is required for text display in a 3D viewer. You can download its sources from https://freetype.org/
-
Unpack the downloaded archive of FreeType product into the
3rdpartyfolder. As a result, you will get a folder named, for example,3rdparty/freetype-2.4.10. Further in this document, this folder is referred to asfreetype. -
Open the solution file
freetype/builds/win32/vc20xx/freetype.slnin Visual Studio. Herevc20xxstands for your version of Visual Studio. -
Select the configuration to build: either
DebugorRelease. -
Build the
freetypeproject.
As a result, you will get afreetypeimport library (.lib) in thefreetype/obj/win32/vc20xxfolder. -
If you build FreeType for a 64 bit platform, select in the main menu
Build - Configuration Managerand addx64platform to the solution configuration by copying the settings fromWin32platform:
Update the value of the Output File for
x64configuration:
Build the
freetypeproject.
As a result, you will obtain a 64 bit import library (.lib) file in thefreetype/x64/vc20xxfolder. To build FreeType as a dynamic library (.dll) follow steps 6, 7 and 8 of this procedure. -
Open menu Project-> Properties-> Configuration Properties-> General and change option
Configuration TypetoDynamic Library (.dll). -
Edit file
freetype/include/freetype/config/ftoption.h:
in line 255, uncomment the definition of macroFT_EXPORTand change it as follows:#define FT_EXPORT(x) __declspec(dllexport) x -
Build the
freetypeproject.
As a result, you will obtain the files of the import library (.lib) and the dynamic library (.dll) in foldersfreetype/objs/releaseorfreetype/objs/debug. If you build for a 64 bit platform, follow step 5 of the procedure.To facilitate the use of FreeType libraries in OCCT with minimal adjustment of build procedures, it is recommended to copy the include files and libraries of FreeType into a separate folder, named according to the pattern
freetype-compiler-bitness-building mode, where:-
compilerisvc8orvc9orvc10orvc11; -
bitnessis32or64; -
building modeisopt(forRelease) ordeb(forDebug).
The
includesubfolder should be copied as is, while libraries should be renamed tofreetype.libandfreetype.dll(suffixes removed) and placed to subdirectorieslibandbin, respectively. If theDebugconfiguration is built, the Debug libraries should be put into subdirectorieslibdandbind. -
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the Download page, find the release version you need (e.g. oneTBB 2021.5.0) and pick the archive for Windows platform.
To install, unpack the downloaded archive of TBB product (oneapi-tbb-2021.5.0-win.zip)
Unpack the downloaded archive of TBB product into the 3rdparty folder.
Further in this document, this folder is referred to as tbb.
This third-party product should be built as a dynamically loadable library (.dll file).
You can download its sources from
https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
-
Unpack the downloaded archive of FreeImage product into
3rdpartyfolder.
As a result, you should have a folder named3rdparty/FreeImage. Rename it according to the rule:freeimage-platform-compiler-building mode, where-
platformiswin32orwin64; -
compilerisvc8orvc9orvc10orvc11; -
building modeis opt (for release) ordeb(for debug)
Further in this document, this folder is referred to as
freeimage. -
-
Open the solution file
freeimage/FreeImage.*.slnin your Visual Studio.
If you use a Visual Studio version higher than VC++ 2008, apply conversion of the workspace. Such conversion should be suggested automatically by Visual Studio. -
Select a configuration to build.
- Choose
Releaseif you are building Release binaries. - Choose
Debugif you are building Debug binaries.
Note:
If you want to build a debug version of FreeImage binaries then you need to rename the following files in FreeImage projects:
Project -> Properties -> Configuration Properties -> Linker -> General -> Output File
FreeImage*d*.dll to FreeImage.dllProject -> Properties -> Configuration Properties -> Linker -> Debugging-> Generate Program Database File
FreeImage*d*.pdb to FreeImage.pdbProject -> Properties -> Configuration Properties -> Linker -> Advanced-Import Library
FreeImage*d*.lib to FreeImage.libProject -> Properties -> Configuration Properties -> Build Events -> Post -> Build Event -> Command Line
FreeImage*d*.dll to FreeImage.dll FreeImage*d*.lib to FreeImage.libAdditionally, rename in project FreeImagePlus
Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
from FreeImage*d*.lib to FreeImage.lib - Choose
-
Select a platform to build.
- Choose
Win32if you are building for a 32 bit platform. - Choose
x64if you are building for a 64 bit platform.
- Choose
-
Start the building process.
As a result, you should have the library files of FreeImage product infreeimage/Distfolder (FreeImage.dllandFreeImage.lib).
VTK Integration Services component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library.
-
Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it into
3rdpartyfolder.
As a result, you will get a folder named, for example,3rdparty/VTK-6.1.0. Further in this document, this folder is referred to asVTK. -
Use CMake to generate VS projects for building the library:
- Start CMake-GUI and select
VTKfolder as source path, and the folder of your choice for VS project and intermediate build data. - Click Configure.
- Select the VS version to be used from the ones you have installed (we recommend using VS 2015) and the architecture (32 or 64-bit).
- Generate VS projects with default CMake options. The open solution
VTK.slnwill be generated in the build folder.
- Start CMake-GUI and select
-
Build project VTK in Release mode.
This section presents additional guidelines for building third-party products used by Open CASCADE Technology and samples on Linux platform.
Debian-based distributives
All 3rd-party products required for building of OCCT could be installed from official repositories. You may install them from console using apt-get utility:
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libx11-dev libgl1-mesa-dev libfreeimage-dev
sudo apt-get install rapidjson-dev libdraco-dev
Building is possible with C++ compliant compiler:
sudo apt-get install g++
Tcl/Tk is required for DRAW test harness.
Installation from sources: Tcl
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
-
Enter the
unixsub-directory of the directory where the Tcl source files are located (TCL_SRC_DIR).cd TCL_SRC_DIR/unix -
Run the
configurecommand:configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIRFor a 64 bit platform also add
--enable-64bitoption to the command line. -
If the configure command has finished successfully, start the building process:
make -
If building is finished successfully, start the installation of Tcl. All binary and service files of the product will be copied to the directory defined by
TCL_INSTALL_DIRmake install
Installation from sources: Tk
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
-
Enter the
unixsub-directory of the directory where the Tk source files are located (TK_SRC_DIR)cd TK_SRC_DIR/unix -
Run the
configurecommand, whereTCL_LIB_DIRisTCL_INSTALL_DIR/lib.configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIRFor a 64 bit platform also add
--enable-64bitoption to the command line. -
If the configure command has finished successfully, start the building process:
make -
If the building has finished successfully, start the installation of Tk. All binary and service files of the product will be copied to the directory defined by
TK_INSTALL_DIR(usually it isTCL_INSTALL_DIR)make install
FreeType is required for text display in the 3D viewer. Download the necessary archive from https://freetype.org/ and unpack it.
-
Enter the directory where the source files of FreeType are located (
FREETYPE_SRC_DIR).cd FREETYPE_SRC_DIR -
Run the
configurecommand:configure --prefix=FREETYPE_INSTALL_DIRFor a 64 bit platform also add
CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'option to the command line. -
If the
configurecommand has finished successfully, start the building process:make -
If the building has finished successfully, start the installation of FreeType. All binary and service files of the product will be copied to the directory defined by
FREETYPE_INSTALL_DIRmake install
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the Download page, find the release version you need (e.g. oneTBB 2021.5.0) and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product (oneapi-tbb-2021.5.0-lin.tgz).
Download the necessary archive from https://sourceforge.net/projects/freeimage/files/Source%20Distribution/ and unpack it.
The directory with unpacked sources is further referred to as FREEIMAGE_SRC_DIR.
-
Modify
FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h:
In line 60 insert the following:#include string.h -
Enter the directory where the source files of FreeImage are located (
FREEIMAGE_SRC_DIR).cd FREEIMAGE_SRC_DIR -
Run the building process
make -
Run the installation process
a. If you have the permission to write into directories
/usr/includeand/usr/lib, run the following command:make installb. If you do not have this permission, you need to modify file
FREEIMAGE_SRC_DIR/Makefile.gnu:Change lines 7-9 from:
DESTDIR ?= / INCDIR ?= $(DESTDIR)/usr/include INSTALLDIR ?= $(DESTDIR)/usr/libto:
DESTDIR ?= $(DESTDIR) INCDIR ?= $(DESTDIR)/include INSTALLDIR ?= $(DESTDIR)/libChange lines 65-67 from:
install -m 644 -o root -g root $(HEADER) $(INCDIR) install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR) install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)to:
install -m 755 $(HEADER) $(INCDIR) install -m 755 $(STATICLIB) $(INSTALLDIR) install -m 755 $(SHAREDLIB) $(INSTALLDIR)Change line 70 from:
ldconfigto:
\#ldconfigThen run the installation process by the following command:
make DESTDIR=FREEIMAGE_INSTALL_DIR install -
Clean temporary files
make clean
Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it.
-
Install or build
cmakeproduct from the source file. -
Start
cmakein GUI mode with the directory where the source files of VTK are located:ccmake VTK_SRC_DIR- Press
[c]to make the initial configuration - Define the necessary options in
VTK_INSTALL_PREFIX - Press
[c]to make the final configuration - Press
[g]to generateMakefileand exit
- Press
-
Start the building of VTK:
make -
Start the installation of VTK. Binaries will be installed according to the
VTK_INSTALL_PREFIXoption.make install
This section presents additional guidelines for building third-party products used by Open CASCADE Technology and samples on Mac OS X platform (10.6.4 and later).
Tcl/Tk is required for DRAW test harness.
Installation from sources: Tcl
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
-
Enter the
macosxsub-directory of the directory where the Tcl source files are located (TCL_SRC_DIR).cd TCL_SRC_DIR/macosx -
Run the
configurecommandconfigure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIRFor a 64 bit platform also add
--enable-64bitoption to the command line. -
If the
configurecommand has finished successfully, start the building processmake -
If building is finished successfully, start the installation of Tcl. All binary and service files of the product will be copied to the directory defined by
TCL_INSTALL_DIR.make install
Installation from sources: Tk
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
-
Enter the
macosxsub-directory of the directory where the source files of Tk are located (TK_SRC_DIR).cd TK_SRC_DIR/macosx -
Run the
configurecommand, whereTCL_LIB_DIRisTCL_INSTALL_DIR/libconfigure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIRFor a 64 bit platform also add
--enable-64bitoption to the command line. -
If the
configurecommand has finished successfully, start the building process:make -
If the building has finished successfully, start the installation of Tk. All binary and service files of the product will be copied to the directory defined by
TK_INSTALL_DIR(usually it isTCL_INSTALL_DIR).make install
FreeType is required for text display in the 3D viewer. Download the necessary archive from https://freetype.org/ and unpack it.
-
Enter the directory where the source files of FreeType are located (
FREETYPE_SRC_DIR).cd FREETYPE_SRC_DIR -
Run the
configurecommandconfigure --prefix=FREETYPE_INSTALL_DIRFor a 64 bit platform also add
CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'option to the command line. -
If the
configurecommand has finished successfully, start the building processmake -
If building has finished successfully, start the installation of FreeType. All binary and service files of the product will be copied to the directory defined by
FREETYPE_INSTALL_DIR.make install
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the Download page, find the release version you need (e.g. oneTBB 2021.5.0) and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB product (oneapi-tbb-2021.5.0-mac.tgz).
Download the necessary archive from
https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
and unpack it. The directory with unpacked sources is further referred to as FREEIMAGE_SRC_DIR.
Note that for building FreeImage on Mac OS X 10.7 you should replace Makefile.osx
in FREEIMAGE_SRC_DIR by the corrected file, which you can find in attachment to issue #22811 in OCCT Mantis bug tracker.
-
If you build FreeImage 3.15.x you can skip this step.
Modify
FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h:
In line 60 insert the following:#include string.hModify
FREEIMAGE_SRC_DIR/Source/FreeImage/PluginTARGA.cpp:
In line 320 replace:SwapShort(value);with:
SwapShort(&value); -
Enter the directory where the source files of FreeImage are located (
FREEIMAGE_SRC_DIR).cd FREEIMAGE_SRC_DIR -
Run the building process
make -
Run the installation process
-
If you have the permission to write into
/usr/local/includeand/usr/local/libdirectories, run the following command:make install -
If you do not have this permission, you need to modify file
FREEIMAGE_SRC_DIR/Makefile.osx:
Change line 49 from:PREFIX ?= /usr/localto:
PREFIX ?= $(PREFIX)
Change lines 65-69 from:
install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR) install -m 644 -o root -g wheel $(HEADER) $(INCDIR) install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR) ranlib -sf $(INSTALLDIR)/$(STATICLIB) ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)to:
install -d $(INCDIR) $(INSTALLDIR) install -m 755 $(HEADER) $(INCDIR) install -m 755 $(STATICLIB) $(INSTALLDIR) install -m 755 $(SHAREDLIB) $(INSTALLDIR) ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME) ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)Then run the installation process by the following command:
make PREFIX=FREEIMAGE_INSTALL_DIR install -
-
Clean temporary files
make clean
© 2024 Open CASCADE Technology. All rights reserved.