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