eaea1a1f2506aeb3ac27ae0409149e4a929d3063
[occt.git] / dox / dev_guides / building / 3rdparty / 3rdparty_osx.md
1  Building 3rd-party libraries on MacOS X {#dev_guides__building_3rdparty_osx}
2 ==============================================
3 @tableofcontents 
4
5 @section dev_guides__building_3rdparty_osx_1 Introduction
6
7   This document presents additional guidelines for building third-party products 
8   used by Open CASCADE Technology and samples on Mac OS X platform (10.6.4  and later). 
9
10   The links for downloading the third-party products are available 
11   on the web site of OPEN CASCADE SAS at 
12   http://www.opencascade.org/getocc/require/</a>. 
13
14   There are two types of third-party products, which are  necessary to build OCCT: 
15   
16   * Mandatory  products: Tcl 8.5, Tk 8.5, FreeType 2.4.10 
17   * Optional  products: TBB 3.x or 4.x, gl2ps 1.3.5, FreeImage 3.14.1 or 3.15.x 
18   
19 @section dev_guides__building_3rdparty_osx_2 Building Mandatory Third-party Products
20
21 @subsection dev_guides__building_3rdparty_osx_2_1 Tcl/Tk 8.5 
22
23   Tcl/Tk is required for DRAW test harness. Version 8.5 or  8.6 can be used with OCCT. 
24
25 @subsubsection dev_guides__building_3rdparty_osx_2_1_1 Installation from binaries
26
27   It is possible to download ready-to-install binaries from 
28   http://www.activestate.com/activetcl/downloads   
29
30   * 1. Download the disk image to some TCL_DOWNLOAD_DIR. 
31   * 2. Open in Finder the directory TCL_DOWNLOAD_DIR. 
32   * 3. Open disk image and follow instructions. 
33
34 @subsubsection dev_guides__building_3rdparty_osx_2_1_2 Installation from sources: Tcl 8.5
35
36   Download the necessary archive from http://www.tcl.tk/software/tcltk/download.html and unpack it. 
37
38   * 1. Enter the macosx sub-directory of the directory where the source files of Tcl are located (TCL_SRC_DIR). 
39
40   @verbatim
41     cd TCL_SRC_DIR/macosx   
42   @endverbatim
43
44   * 2. Run the configure command 
45
46   @verbatim
47     configure --enable-gcc  --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR   
48   @endverbatim
49
50   For a 64 bit platform also add --enable-64bit option to the command line. 
51
52   * 3. If the configure command has finished successfully, start the building process 
53
54   @verbatim
55     make   
56   @endverbatim
57   
58   * 4. If building is finished successfully, start the installation of Tcl. 
59   All binary and service files of the product will be copied to the directory defined by TCL_INSTALL_DIR 
60
61   @verbatim
62     make install   
63   @endverbatim
64
65 @subsubsection dev_guides__building_3rdparty_osx_2_1_3 Installation from sources: Tk 8.5
66
67   Download the necessary archive from http://www.tcl.tk/software/tcltk/download.html and unpack it. 
68
69   * 1. Enter the macosx sub-directory of the directory where the  source files of Tk are located (TK_SRC_DIR). 
70
71   @verbatim
72     cd TK_SRC_DIR/macosx   
73   @endverbatim
74
75   * 2. Run the configure command, where TCL_LIB_DIR is  TCL_INSTALL_DIR/lib 
76
77   @verbatim
78     configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR   
79   @endverbatim
80
81   where TCL_LIB_DIR is TCL_INSTALL_DIR/lib. For a 64 bit platform also add --enable-64bit option to the  command line. 
82
83   * 3. If the configure command has finished successfully, start  the building process 
84
85   @verbatim
86     make   
87   @endverbatim
88
89   * 4. If building has finished successfully, start the  installation of Tk. 
90   All binary and service files of the product will be copied to the directory 
91   defined by TK_INSTALL_DIR (usually TK_INSTALL_DIR  is TCL_INSTALL_DIR) 
92
93   @verbatim
94     make install   
95   @endverbatim
96
97 @subsection dev_guides__building_3rdparty_osx_2_2 FreeType 2.4.10
98   
99   FreeType is required for display of text in 3D viewer. 
100
101   Download the necessary archive from http://sourceforge.net/projects/freetype/files/ and unpack it. 
102
103   * 1. Enter the directory where the source files of FreeType  are located (FREETYPE_SRC_DIR). 
104
105   @verbatim
106     cd FREETYPE_SRC_DIR   
107   @endverbatim
108
109   * 2. Run the configure command 
110   
111   @verbatim
112     configure  --prefix=FREETYPE_INSTALL_DIR   
113   @endverbatim
114
115   For a 64 bit platform also add CFLAGS='-m64 -fPIC'  CPPFLAGS='-m64 -fPIC' option to the command line. 
116
117   * 3. If the configure command has finished successfully, start  the building process 
118
119   @verbatim
120     make   
121   @endverbatim
122
123   * 4. If building has finished successfully, start the installation of FreeType. 
124   All binary and service files of the product will be copied to the directory defined by FREETYPE_INSTALL_DIR 
125
126   @verbatim
127     make install   
128   @endverbatim
129
130 @section dev_guides__building_3rdparty_osx_3 Building Optional Third-party Products
131     
132 @subsection dev_guides__building_3rdparty_osx_3_1 TBB 3.x or 4.x
133
134   This third-party product is installed with binaries from the archive 
135   that can be downloaded from http://threadingbuildingblocks.org/. 
136   Go to \"Downloads / Commercial  Aligned Release\", find the release version you need (e.g. tbb30_018oss) 
137   and  pick the archive for Mac OS X platform. 
138   To install, unpack the downloaded archive of TBB 3.0 product (*tbb30_018oss_osx.tgz*).
139
140 @subsection dev_guides__building_3rdparty_osx_3_2 gl2ps 1.3.5
141
142   Download the necessary archive from http://geuz.org/gl2ps/ and unpack it. 
143
144   * 1. Install or build cmake product from source file. 
145
146   * 2. Start cmake in GUI mode with the directory where the source  files of fl2ps are located 
147   @verbatim
148       ccmake GL2PS_SRC_DIR   
149   @endverbatim
150      * 2.1. Press [c] to make the  initial configuration 
151      * 2.2. Define the necessary options  CMAKE_INSTALL_PREFIX 
152      * 2.3. Press [c] to make the final  configuration 
153      * 2.4. Press [g] to generate  Makefile and exit 
154
155   or just run the following command: 
156
157   @verbatim
158     cmake  –DCMAKE_INSTALL_PREFIX=GL2PS_INSTALL_DIR –DCMAKE_BUILD_TYPE=Release   
159   @endverbatim
160
161   * 3. Start building of gl2ps 
162
163   @verbatim
164       make   
165   @endverbatim
166
167   * 4. Start the installation of gl2ps. Binaries will be  installed according to the CMAKE_INSTALL_PREFIX option 
168
169   @verbatim
170       make install   
171   @endverbatim
172
173 @subsection dev_guides__building_3rdparty_osx_3_3 FreeImage 3.14.1 or 3.15.x
174
175   Download the necessary archive from 
176   http://sourceforge.net/projects/freeimage/files/Source%20Distribution/   
177   and unpack it. The directory with unpacked sources is  further referred to as FREEIMAGE_SRC_DIR.  
178
179   Note that for building FreeImage on Mac OS X 10.7 you should replace Makefile.osx 
180   in FREEIMAGE_SRC_DIR by corrected one which you  can find in attachment to issue #22811 in OCCT Mantis bug tracker 
181   (http://tracker.dev.opencascade.org/file_download.php?file_id=6937&type=bug) or elsewhere. 
182
183   * 1.If you are building FreeImage 3.15.x you can skip this  step. 
184   Modify FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h: 
185   
186   In line 60 insert the following: 
187
188   @verbatim
189     #include string.h 
190   @endverbatim
191
192   Modify FREEIMAGE_SRC_DIR/Source/FreeImage/PluginTARGA.cpp: 
193   
194   In line 320 replace: 
195   @verbatim
196     SwapShort(value); 
197   @endverbatim
198
199   with: 
200   @verbatim
201     SwapShort(&value); 
202   @endverbatim
203
204   * 2.Enter the directory where the source files of FreeImage  are located (FREEIMAGE_SRC_DIR). 
205
206   @verbatim
207     cd FREEIMAGE_SRC_DIR 
208   @endverbatim
209
210   * 3.Run the building process 
211
212   @verbatim
213     make   
214   @endverbatim
215
216   * 4.Run the installation process 
217      * 4.1. If you have permissions to write to /usr/local/include  and /usr/local/lib directories then run the following command: 
218   @verbatim
219     make install   
220   @endverbatim
221      * 4.2. If you don’t have permissions to write to /usr/include and /usr/lib directories 
222             then you need to modify the file FREEIMAGE_SRC_DIR/Makefile.osx: 
223
224    Change line 49 from:     
225
226   @verbatim
227     PREFIX ?= /usr/local
228   @endverbatim
229
230    to:
231    
232   @verbatim
233     PREFIX  ?= $(PREFIX) 
234   @endverbatim
235
236   Change lines 65-69 from: 
237
238   @verbatim
239     install -d -m 755 -o  root -g wheel $(INCDIR) $(INSTALLDIR) 
240     install  -m 644 -o root -g wheel $(HEADER) $(INCDIR) 
241     install  -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR) 
242     ranlib  -sf $(INSTALLDIR)/$(STATICLIB) 
243     ln  -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME) 
244   @endverbatim
245     
246    to: 
247
248   @verbatim
249     install  -d $(INCDIR) $(INSTALLDIR) 
250     install  -m 755 $(HEADER) $(INCDIR) 
251     install  -m 755 $(STATICLIB) $(INSTALLDIR) 
252     install  -m 755 $(SHAREDLIB) $(INSTALLDIR) 
253     ln  -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)  
254     ln  -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
255   @endverbatim
256
257   Then run the installation process by the following command: 
258   
259   @verbatim
260     make PREFIX=FREEIMAGE_INSTALL_DIR  install 
261   @endverbatim
262   
263   * 5.Clean the temporary files 
264   
265   @verbatim
266     make clean 
267   @endverbatim
268
269 @see http://www.opencascade.org for details