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