1 Build OCCT {#build_upgrade__building_occt}
6 @note Before building OCCT, make sure to have all required third-party libraries installed.
7 The list of required libraries depends on what OCCT modules will be used, and your preferences.
8 The typical minimum is **Freetype** (necessary for Visualization) and **Tcl/Tk** (for DRAW).
9 See @ref intro_req "requirements on 3rdparty libraries" for a full list.
10 On OS X we recommend to use native libraries.
12 @section build_occt_windows Windows
14 @subsection build_occt_win_cmake Building with CMake tool
16 This article describes the **CMake**-based build process, which is now suggested as a standard way to produce the binaries of Open CASCADE Technology from sources. *OCCT requires CMake version 2.8.12 or later*.
18 @note Compared to the previous (6.x) releases of Open CASCADE Technology, OCCT 7.x has a complete set of CMake scripts and projects, so that there is no need to use WOK anymore. Moreover, CMake gives you a powerful configuration tool, which allows to control many aspects of OCCT deployment. At the same time this tool is quite intuitive, which is a significant advantage over the legacy WOK utilities.
20 Here we describe the build procedure on the example of Windows platform with Visual Studio 2010.
21 However, CMake is cross-platform and can be used to build OCCT on Linux and OS X in essentially the same way.
23 @note Before you start, make sure to have installed all 3-rd party products that you are going to use with OCCT; see @ref build_upgrade.
25 @subsubsection build_cmake_start Start CMake
27 CMake is a tool that generates the actual project files for the selected target build system (e.g. Unix makefiles) or IDE (e.g. Visual Studio 2010).
29 For unexperienced users we recommend to start with *cmake-gui* -- a cross-platform GUI tool provided by CMake on Windows, Mac and Linux.
30 A command-line alternative, *ccmake* can also be used.
32 CMake deals with three directories: source, build or binary and installation.
34 * The source directory is where the sources of OCCT are located in your file system;
35 * The build or binary directory is where all files created during CMake configuration and generation process will be located. The mentioned process will be described below.
36 * The installation directory is where binaries will be installed after building the *INSTALL* project that is created by CMake generation process, along with header files and resources required for OCCT use in applications.
38 The good practice is not to use the source directory as a build one.
39 Different configurations should be built in different build directories to avoid conflicts.
40 It is however possible to choose one installation directory for several configurations of OCCT (differentiated by platform, bitness, compiler and build type), for example:
42 d:/occt/ -- the source directory
43 d:/tmp/occt-build-vc10-x64 -- the build directory with the generated
44 solution and other intermediate files created during a CMake tool working
45 d:/occt-install -- the installation directory that is
46 able to contain several OCCT configurations
48 @subsubsection build_cmake_conf Configuration process
50 If the command-line tool is used, run the tool from the build directory with a single argument indicating the source (relative or absolute path) directory:
52 cd d:/tmp/occt-build-vc10-x64
55 @figure{/build/build_occt/images/cmake_image000.png}
57 Press *c* to configure.
59 All actions required in the configuration process with the GUI tool will be described below.
61 If the GUI tool is used, run this tool without additional arguments and after that specify the source directory by clicking **Browse Source** and the build (binary) one by clicking **Browse Build**.
63 @figure{/build/build_occt/images/cmake_image001.png}
65 **Note**: Each configuration of the project should be built in its own directory. When building multiple configurations it is recommended to indicate in the name of build directories the system, bitness and compiler (e.g., <i>d:/occt/build/win32-vc10</i> ).
67 Once the source and build directories are selected, "Configure" button should be pressed in order to start manual configuration process. It begins with selection of a target configurator. It is "Visual Studio 10 2010 Win64" in our example.
69 @figure{/build/build_occt/images/cmake_image002.png}
71 To build OCCT for **Universal Windows Platform (UWP)** specify the path to toolchain file for cross-compiling <i>d:/occt/adm/templates/uwp.toolchain.config.cmake</i>.
73 Alternatively, if you are using CMake from the command line add options -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 .
75 **Note**: Universal Windows Platform (UWP) is supported only on "Visual Studio 14 2015". File <i>d:/occt/samples/xaml/ReadMe.md</i> describes the building procedure of XAML (UWP) sample.
77 Once "Finish" button is pressed, the first pass of the configuration process is executed. At the end of the process, CMake outputs the list of environment variables, which have to be properly specified for successful configuration.
79 @figure{/build/build_occt/images/cmake_image003.png}
81 The error message provides some information about these variables. This message will appear after each pass of the process until all required variables are specified correctly.
83 The change of the state of some variables can lead to the appearance of new variables. The new variables appeared after the pass of the configuration process are highlighted with red color by CMake GUI tool.
85 Note: There is "grouped" option, which groups variables with a common prefix.
87 The following table gives the full list of environment variables used at the configuration stage:
89 | Variable | Type | Purpose |
90 |----------|------|---------|
91 | CMAKE_BUILD_TYPE | String | Specifies the build type on single-configuration generators (such as make). Possible values are Debug, Release and RelWithDebInfo |
92 | USE_FREEIMAGE | Boolean flag | Indicates whether FreeImage product should be used in OCCT visualization module for support of popular graphics image formats (PNG, BMP, etc.) |
93 | USE_RAPIDJSON | Boolean flag | Indicates whether RapidJSON product should be used in OCCT Data Exchange module for support of glTF mesh file format |
94 | USE_TBB | Boolean flag | Indicates whether TBB 3rd party is used or not. TBB stands for Threading Building Blocks, the technology of Intel Corp, which comes with different mechanisms and patterns for injecting parallelism into your application. OCCT remains parallel even without TBB product |
95 | USE_VTK | Boolean flag | Indicates whether VTK 3rd party is used or not. VTK stands for Visualization ToolKit, the technology of Kitware Inc intended for general-purpose scientific visualization. OCCT comes with a bridge between CAD data representation and VTK by means of its dedicated VIS component (VTK Integration Services). You may skip this 3rd party unless you are planning to use VTK visualization for OCCT geometry. See the official documentation @ref occt_user_guides__vis for the details on VIS |
96 | 3RDPARTY_DIR | Path | Defines the root directory where all required 3rd party products will be searched. Once you define this path it is very convenient to click "Configure" button in order to let CMake automatically detect all necessary products|
97 | 3RDPARTY_FREETYPE_* | Path | Path to Freetype binaries |
98 | 3RDPARTY_TCL_* 3RDPARTY_TK_* | Path | Path to Tcl/Tk binaries |
99 | 3RDPARTY_FREEIMAGE* | Path | Path to Freeimage binaries |
100 | 3RDPARTY_TBB* | Path | Path to TBB binaries |
101 | 3RDPARTY_VTK_* | Path | Path to VTK binaries |
102 | BUILD_MODULE_<MODULE>| Boolean flag | Indicates whether the corresponding OCCT module should be built or not. It should be noted that some toolkits of a module can be built even if this module is not checked (this happens if some other modules depend on these toolkits). The main modules and their descriptions can be found in @ref user_guides |
103 | BUILD_LIBRARY_TYPE | String | Specifies the type of library to be created. "Shared" libraries are linked dynamically and loaded at runtime. "Static" libraries are archives of object files used when linking other targets. Note that Draw Harness plugin system is incompatible with "Static" builds, and therefore it is disabled for these builds.|
104 | BUILD_ADDITIONAL_TOOLKITS | String | Semicolon-separated individual toolkits to include into build process. If you want to build some particular libraries (toolkits) only, then you may uncheck all modules in the corresponding *BUILD_MODUE_\<MODULE\>* options and provide the list of necessary libraries here. Of course, all dependencies will be resolved automatically |
105 | BUILD_YACCLEX | Boolean flag | Enables Flex/Bison lexical analyzers. OCCT source files relating to STEP reader and ExprIntrp functionality are generated automatically with Flex/Bison. Checking this option leads to automatic search of Flex/Bison binaries and regeneration of the mentioned files |
106 | BUILD_SAMPLES_MFC | Boolean flag | Indicates whether MFC samples should be built together with OCCT. This option is only relevant to Windows platforms |
107 | BUILD_SAMPLES_QT | Boolean flag | Indicates whether QT samples should be built together with OCCT. |
108 | BUILD_Inspector | Boolean flag | Indicates whether Inspector should be built together with OCCT. |
109 | BUILD_DOC_Overview | Boolean flag | Indicates whether OCCT overview documentation project should be created together with OCCT. It is not built together with OCCT. Checking this option leads to automatic search of Doxygen binaries. Its building calls Doxygen command to generate the documentation in HTML format |
110 | BUILD_PATCH | Path | Points to the directory recognized as a "patch" for OCCT. If specified, the files from this directory take precedence over the corresponding native OCCT sources. This way you are able to introduce patches to Open CASCADE Technology not affecting the original source distribution |
111 | BUILD_WITH_DEBUG | Boolean flag | Enables extended messages of many OCCT algorithms, usually printed to cout. These include messages on internal errors and special cases encountered, timing, etc. |
112 | BUILD_ENABLE_FPE_SIGNAL_HANDLER | Boolean flag | Enable/Disable the floating point exceptions (FPE) during DRAW execution only. Corresponding environment variable (CSF_FPE) can be changed manually in custom.bat/sh scripts without regeneration by CMake. |
113 | CMAKE_CONFIGURATION_TYPES | String | Semicolon-separated CMake configurations |
114 | INSTALL_DIR | Path | Points to the installation directory. *INSTALL_DIR* is a synonym of *CMAKE_INSTALL_PREFIX*. The user can specify both *INSTALL_DIR* or *CMAKE_INSTALL_PREFIX* |
115 | INSTALL_DIR_BIN | Path | Relative path to the binaries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_BIN}) |
116 | INSTALL_DIR_SCRIPT | Path | Relative path to the scripts installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_SCRIPT}) |
117 | INSTALL_DIR_LIB | Path | Relative path to the libraries installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_LIB}) |
118 | INSTALL_DIR_INCLUDE | Path | Relative path to the includes installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_INCLUDE}) |
119 | INSTALL_DIR_RESOURCE | Path | Relative path to the resources installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_RESOURCE}) |
120 | INSTALL_DIR_LAYOUT | String | Defines the structure of OCCT files (binaries, resources, headers, etc.) for the install directory. Two variants are predefined: for Windows (standard OCCT layout) and for Unix operating systems (standard Linux layout). If needed, the layout can be customized with INSTALL_DIR_* variables |
121 | INSTALL_DIR_DATA | Path | Relative path to the data files installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DATA}) |
122 | INSTALL_DIR_SAMPLES | Path | Relative path to the samples installation directory. Note that only "samples/tcl" folder will be installed. (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_SAMPLES}) |
123 | INSTALL_DIR_TESTS | Path | Relative path to the tests installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_TESTS}) |
124 | INSTALL_DIR_DOC | Path | Relative path to the documentation installation directory (absolute path is ${INSTALL_DIR}/${INSTALL_DIR_DOC}) |
125 | INSTALL_FREETYPE | Boolean flag | Indicates whether Freetype binaries should be installed into the installation directory |
126 | INSTALL_FREEIMAGE* | Boolean flag | Indicates whether Freeimage binaries should be installed into the installation directory |
127 | INSTALL_TBB | Boolean flag | Indicates whether TBB binaries should be installed into the installation directory |
128 | INSTALL_VTK | Boolean flag | Indicates whether VTK binaries should be installed into the installation directory |
129 | INSTALL_TCL | Boolean flag | Indicates whether TCL binaries should be installed into the installation directory |
130 | INSTALL_TEST_CASES | Boolean flag | Indicates whether non-regression OCCT test scripts should be installed into the installation directory |
131 | INSTALL_DOC_Overview | Boolean flag | Indicates whether OCCT overview documentation should be installed into the installation directory |
133 **Note:** Only the forward slashes ("/") are acceptable in the CMake options defining paths.
135 @subsubsection build_cmake_3rdparty 3rd party search mechanism
137 If *3RDPARTY_DIR* directory is defined, then required 3rd party binaries are sought in it, and default system folders are ignored.
139 The procedure expects to find binary and header files of each 3rd party product in its own sub-directory: *bin*, *lib* and *include*.
141 The results of the search (achieved on the next pass of the configuration process) are recorded in the corresponding variables:
143 * *3RDPARTY_\<PRODUCT\>_DIR* -- path to the 3rdparty directory (with directory name) (e.g. <i>D:/3rdparty/tcltk-86-32</i>)
144 * *3RDPARTY_\<PRODUCT\>_LIBRARY_DIR* -- path to the directory containing a library (e.g. <i>D:/3rdparty/tcltk-86-32/lib</i>).
145 * *3RDPARTY_\<PRODUCT\>_INCLUDE_DIR* -- path to the directory containing a header file (e.g., <i>D:/3rdparty/tcltk-86-32/include</i>)
146 * *3RDPARTY_\<PRODUCT\>_DLL_DIR* -- path to the directory containing a shared library (e.g., <i>D:/3rdparty/tcltk-86-32/bin</i>) This variable is only relevant to Windows platforms.
148 Note: each library and include directory should be children of the product directory if the last one is defined.
150 The search process is as follows:
152 1. Common path: *3RDPARTY_DIR*
153 2. Path to a particular 3rd-party library: *3RDPARTY_\<PRODUCT\>_DIR*
154 3. Paths to headers and binaries:
155 1. *3RDPARTY_\<PRODUCT\>_INCLUDE_DIR*
156 2. *3RDPARTY_\<PRODUCT\>_LIBRARY_DIR*
157 3. *3RDPARTY_\<PRODUCT\>_DLL_DIR*
159 If a variable of any level is not defined (empty or <i> \<variable name\>-NOTFOUND </i>) and the upper level variable is defined, the content of the non-defined variable will be sought at the next configuration step. If the search process at level 3 does not find the required files, it seeks in default places.
161 If a search result (include path, or library path, or dll path) does not meet your expectations, you can change *3RDPARTY_\<PRODUCT\>_*_DIR variable*, clear (if they are not empty) *3RDPARTY_\<PRODUCT\>_DLL_DIR, 3RDPARTY_\<PRODUCT\>_INCLUDE_DIR* and 3RDPARTY_\<PRODUCT\>_LIBRARY_DIR variables (or clear one of them) and run the configuration process again.
163 At this time the search will be performed in the newly identified directory
164 and the result will be recorded to corresponding variables (replace old value if it is necessary).
166 For example, *3RDPARTY_FREETYPE_DIR* variable
168 d:/3rdparty/freetype-2.4.10
172 d:/3rdparty/freetype-2.5.3
174 During the configuration process the related variables (*3RDPARTY_FREETYPE_DLL_DIR*, *3RDPARTY_FREETYPE_INCLUDE_DIR* and *3RDPARTY_FREETYPE_LIBRARY_DIR*) will be filled with new found values.
176 **Note**: The names of searched libraries and header files are hard-coded. If there is the need to change their names, change appropriate cmake variables (edit CMakeCache.txt file or edit in cmake-gui in advance mode) without reconfiguration: *3RDPARTY_\<PRODUCT\>_INCLUDE* for include, *3RDPARTY_\<PRODUCT\>_LIB* for library and *3RDPARTY_\<PRODUCT\>_DLL* for shared library.
178 @subsubsection build_cmake_gen Projects generation
180 Once the configuration process is done, the "Generate" button is used to prepare project files for the target IDE.
181 In our exercise the Visual Studio solution will be automatically created in the build directory.
183 @subsubsection build_cmake_build Building
185 Go to the build folder, start the Visual Studio solution *OCCT.sln* and build it by clicking **Build -> Build Solution**.
187 @figure{/build/build_occt/images/cmake_image004.png}
189 By default the build solution process skips the building of the INSTALL and Overview project.
191 When the building process is finished build:
192 * Overview project to generate OCCT overview documentation (if BUILD_DOC_Overview variable is checked)
193 * the *INSTALL* project to run **the installation process**
195 For this, right-click on the *Overview/INSTALL* project and select **Project Only -> Build Only** -> *Overview/INSTALL* in the solution explorer.
197 @subsubsection build_cmake_install Installation
199 Installation is a process of extracting redistributable resources (binaries, include files etc) from the build directory into the installation one. The installation directory will be free of project files, intermediate object files and any other information related to the build routines.
201 Normally you use the installation directory of OCCT to link against your specific application.
203 The directory structure is as follows:
205 data -- data files for OCCT (brep, iges, stp)
206 doc -- OCCT overview documentation in HTML format
209 src -- all required source files for OCCT
210 tests -- OCCT test suite
211 win32\vc10\bind -- binary files (installed 3rdparties and occt)
212 \libd -- libraries (installed 3rdparties and occt)
214 **Note:** The above example is given for debug configuration. However, it is generally safe to use the same installation directory for the release build. In the latter case the contents of install directory will be enriched with subdirectories and files related to the release configuration. In particular, the binaries directory win64 will be expanded as
222 If CMake installation flags are enabled for the 3rd party products (e.g. INSTALL_FREETYPE), then the corresponding binaries will be copied to the same bin(d) and lib(d) directories together with the native binaries of OCCT. Such organization of libraries can be especially helpful if your OCCT-based software does not use itself the 3rd parties of Open CASCADE Technology (thus, there is no sense to pack them into dedicated directories).
224 The installation folder contains the scripts to run *DRAWEXE* (*draw.bat* or *draw.sh*), samples (if they were installed) and overview.html (short-cut for installed OCCT overview documentation).
226 @subsection build_occt_win_codeblocks Building with Code::Blocks
228 This file describes steps to build OCCT libraries from sources using **Code::Blocks**, a cross-platform IDE, using project files generated by OCCT legacy tool **genproj**.
229 It can be used as an alternative to CMake build system (see @ref build_occt_win_cmake) for all supported platforms.
231 @subsubsection build_codeblocks_3rdparty Third-party libraries
233 Before building OCCT, make sure to have all the needed third-party libraries installed, see @ref build_upgrade.
235 @subsubsection build_codeblocks_conf Configuration
237 Before building it is necessary to set up build environment.
239 The environment is defined in the file *custom.sh* (on Linux and OS X) or *custom.bat* (on Windows) which can be edited directly:
241 * Add paths to includes of used third-party libraries in variable *CSF_OPT_INC*.
242 * Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
243 * Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
244 * *Copy* - headers will be copied from *src*;
245 * *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
246 * "HardLink* - hard links to headers located in *src* will be created.
247 * For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
249 export HAVE_FREEIMAGE=false
252 Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure environment interactively:
254 @figure{/build/build_occt/images/genconf_linux.png}
256 Click "Save" to store the specified configuration in *custom.sh* or *custom.bat* file.
258 @subsubsection build_codeblocks_gen Projects generation
260 Launch **genproj** tool with option *cbp* to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files:
263 $ cd /dev/OCCT/opencascade-7.0.0
267 The generated Code::Blocks project are placed into subfolder *adm/<OS>/cbp*.
269 @note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
271 @subsubsection build_codeblocks_build Building
273 To start **Code::Blocks**, launch script *codeblocks.sh*.
275 To build all toolkits, click **Build->Build workspace** in the menu bar.
277 To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script
281 Option *d* is used if OCCT has been built in **Debug** mode.
283 @subsection build_occt_genproj Building with Genproj tool
285 This page describes steps to build OCCT libraries from a complete source archive on Windows with <b>MS Visual C++</b> using projects generated by **genproj** tool.
286 It is an alternative to use of CMake build system (see @ref build_occt_win_cmake).
288 **genproj** is a legacy tool (originated from command "wgenproj" in WOK) for generation of Visual Studio, Code.Blocks, and XCode project files used for building Open CASCADE Technology.
289 These project files are placed inside OCCT directory (in *adm* subfolder) and use relative paths, thus can be moved together with sources.
291 The project files included in official distribution of OCCT are generated by this tool.
292 If you have official distribution with project files included, you can use them directly without a need to call **genproj**.
294 @subsubsection build_msvc_3rdparty Third-party libraries
296 Before building OCCT, make sure to have all the required third-party libraries installed.
298 The easiest way to install third-party libraries is to download archive with pre-built binaries, corresponding to version of Visual Studio you are using, from https://opencascade.com/content/3rd-party-components.
300 You can also build third-party libraries from their sources, see @ref build_upgrade_building_3rdparty for instructions.
302 @subsubsection build_msvc_conf Configuration
304 If you have Visual Studio projects already available (pre-installed or generated), you can edit file *custom.bat* manually to adjust the environment:
306 * *VCVER* -- specification of format of project files, defining also version of Visual Studio to be used, and default name of the sub-folder for binaries:
308 | VCVER | Visual Studio version | Windows Platform | Binaries folder name |
309 |-----------|-----------------------|----------------------------------|----------------------|
310 | vc10 | 2010 (10) | Desktop (Windows API) | vc10 |
311 | vc11 | 2012 (11) | Desktop (Windows API) | vc11 |
312 | vc12 | 2013 (12) | Desktop (Windows API) | vc12 |
313 | vc14 | 2015 (14) | Desktop (Windows API) | vc14 |
314 | vc14-uwp | 2015 (14) | UWP (Universal Windows Platform) | vc14-uwp |
315 | vc141 | 2017 (15) | Desktop (Windows API) | vc14 |
316 | vc141-uwp | 2017 (15) | UWP (Universal Windows Platform) | vc14-uwp |
317 | vc142 | 2019 (16) | Desktop (Windows API) | vc14 |
318 | vc142-uwp | 2019 (16) | UWP (Universal Windows Platform) | vc14-uwp |
320 * *ARCH* -- architecture (32 or 64), affects only *PATH* variable for execution
321 * <i>HAVE_*</i> -- flags to enable or disable use of optional third-party products
322 * <i>CSF_OPT_*</i> -- paths to search for includes and binaries of all used third-party products
323 * *SHORTCUT_HEADERS* -- defines method for population of folder *inc* by header files. Supported methods are:
324 * *Copy* - headers will be copied from *src*;
325 * *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
326 * "HardLink* - hard links to headers located in *src* will be created.
328 Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively.
329 That tool will analyze your environment and propose you to choose available options:
331 * Version of Visual Studio to be used (from the list of installed ones, detected by presence of environment variables like *VS100COMNTOOLS*).
332 * Method to populate folder *inc* (short-cuts by default).
333 * Location of third-party libraries (usually downloaded from OCCT web site, see above).
334 * Path to common directory where third-party libraries are located (optional).
335 * Paths to headers and binaries of the third-party libraries (found automatically basing on previous options; click button "Reset" to update).
336 * Generation of PDB files within Release build ("Release with Debug info", false by default).
338 @figure{/build/build_occt/images/genconf_windows.png}
340 Click "Save" to store the specified configuration in *custom.bat* file.
342 @subsubsection build_msvc_generate Projects generation
344 Launch **genproj** to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files.
346 @note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
347 If Tcl is not found, the tool may prompt you to enter the path to directory where Tcl can be found.
353 Note that if *custom.bat* is not present, **genproj** will start **genconf** to configure environment.
355 @subsubsection build_msvc_build Building
357 Launch *msvc.bat* to start Visual Studio with all necessary environment variables defined, and build the whole solution or required toolkits.
359 Note: the MSVC project files are located in folders <i>adm\\msvc\\vc...</i>.
360 Binaries are produced in *win32* or *win64* folders.
362 To start DRAW, launch *draw.bat*.
364 @section build_occt_linux Linux
366 You may choose one of the following ways to generate, configure and build OCCT sources on Linux just keeping in mind
367 this platform specific:
369 * @ref build_occt_win_cmake "Configuration, generation and building OCCT on Windows using CMake tool"
370 * @ref build_occt_code_blocks "Building on Mac OS X with Code::Blocks IDE"
372 @section build_occt_crossplatform_cmake Android (cross-compiling)
374 This article describes the steps to build OCCT libraries for Android from a complete source package
375 with GNU make (makefiles). The steps on Windows 7 and Ubuntu 15.10 are similar. There is the only one difference:
376 makefiles are built with mingw32-make
377 on Windows and native GNU make on Ubuntu.
379 Required tools (download and install if it is required):
380 - CMake v3.0+ http://www.cmake.org/cmake/resources/software.html
381 - Cross-compilation toolchain for CMake https://github.com/taka-no-me/android-cmake
382 - Android NDK rev.10+ https://developer.android.com/tools/sdk/ndk/index.html
383 - GNU Make: MinGW v4.82+ for Windows (http://sourceforge.net/projects/mingw/files/), GNU Make 4.0 for Ubuntu.
385 Run GUI tool provided by CMake.
387 @subsection build_occt_crossplatform_cmake_config Configuration
390 - Specify the root folder of OCCT (<i>$CASROOT</i>, which contains *CMakelists.txt* file) by clicking **Browse Source**.
391 - Specify the location (build folder) for Cmake generated project files by clicking **Browse Build**.
393 @figure{/build/build_occt/images/android_image001.png}
395 Click **Configure** button. It opens the window with a drop-down list of generators supported by CMake project.
397 Select "MinGW MakeFiles" item from the list
398 - Choose "Specify toolchain file for cross-compiling"
400 @figure{/build/build_occt/images/android_image002.png}
402 - Specify a toolchain file at the next dialog by android.toolchain.cmake . It is contained by cross-compilation
405 @figure{/build/build_occt/images/android_image003.png}
407 If ANDROID_NDK environment variable is not defined in current OS, add cache entry ANDROID_NDK (entry type is PATH) --
408 path to the NDK folder ("Add Entry" button)
409 @figure{/build/build_occt/images/android_image004.png}
411 If on Windows the message is appeared: "CMake Error: CMake was unable to find a build program corresponding
413 CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.",
414 specify **CMAKE_MAKE_PROGRAM** to mingw32-make executable.
415 @figure{/build/build_occt/images/android_image005.png}
419 How to configure OCCT, see "OCCT Configuration" section of @ref build_occt_win_cmake
420 "Configure, Generate, Build using CMake tool" taking into account the specific configuration variables for android:
421 - ANDROID_ABI = armeabi-v7a
422 - ANDROID_NATIVE_API_LEVEL = 15
423 - ANDROID_NDK_LAYOUT is equal to CMAKE_BUILD_TYPE variable
424 - **BUILD_MODULE_Draw = OFF**
426 @figure{/build/build_occt/images/android_image006.png}
428 @subsection build_occt_crossplatform_cmake_generation Generate Makefiles
430 Click **Generate** button and wait until the generation process is finished.
431 Then makefiles will appear in the build folder (e.g. <i> D:/tmp/occt-android </i>).
433 @subsection build_occt_crossplatform_cmake_building Build Makefiles
435 Open console and go to the build folder. Type "mingw32-make" (Windows) or "make" (Ubuntu) to start build process.
441 Parallel building can be started with using **"-jN"** argument of "mingw32-make/make", where N is the number of
448 @subsection build_occt_crossplatform_cmake_install Install OCCT Libraries
450 Type "mingw32-make/make" with argument "install" to place the libraries to the install folder
452 > mingw32-make install
456 @section build_occt_macos Mac OS X
458 @subsection build_occt_macos_xcode Building with Xcode
460 This file describes steps to build OCCT libraries from sources on Mac OS X with **Xcode** projects, generated by OCCT legacy tool **genproj**.
462 <h2>Configuration</h2>
464 Before building it is necessary to set up build environment.
466 The environment is defined in the file *custom.sh* which can be edited directly:
468 * Add paths to includes of used third-party libraries in variable *CSF_OPT_INC* (use colon ":" as path separator).
469 * Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
470 * Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
471 * *Copy* - headers will be copied from *src*;
472 * *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
473 * "HardLink* - hard links to headers located in *src* will be created.
474 * For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
476 export HAVE_GL2PS=false
479 Alternatively, or when *custom.sh* does not exist, you can launch *genconf.sh* to configure environment interactively:
481 @figure{/build/build_occt/images/genconf_osx.png}
483 Click "Save" to store the specified configuration in *custom.sh* file.
485 <h2>Projects generation</h2>
487 Launch **genproj** tool to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files.
489 @note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
491 For instance, in Terminal application:
494 $ cd /dev/OCCT/opencascade-7.0.0
500 To start **Xcode**, launch script *xcode.sh*.
502 To build a certain toolkit, select it in **Scheme** drop-down list in Xcode toolbar, press **Product** in the menu and click **Build** button.
504 To build the entire OCCT:
505 * Create a new empty project (select **File -> New -> Project -> Empty project** in the menu; input the project name, e.g. *OCCT*; then click **Next** and **Create**).
506 * Drag and drop the *OCCT* folder in the created *OCCT* project in the Project navigator.
507 * Select **File -> New -> Target -> Aggregate** in the menu.
508 * Enter the project name (e.g. *OCCT*) and click **Finish**. The **Build Phases** tab will open.
509 * Click "+" button to add the necessary toolkits to the target project. It is possible to select all toolkits by pressing **Command+A** combination.
511 <h2>Launching DRAW</h2>
513 To start *DRAWEXE*, which has been built with Xcode on Mac OS X, perform the following steps:
515 1.Open Terminal application
517 2.Enter <i>\<OCCT_ROOT_DIR\></i>:
524 ./draw_cbp.sh xcd [d]
527 Option *d* is used if OCCT has been built in **Debug** mode.
529 @subsection build_occt_code_blocks Building with Code::Blocks
531 This file describes steps to build OCCT libraries from sources using **Code::Blocks**, a cross-platform IDE, using
532 project files generated by OCCT legacy tool **genproj**.
536 Before building it is necessary to set up build environment.
538 The environment is defined in the file *custom.sh* (on Linux and OS X) or *custom.bat* (on Windows) which can be edited
541 * Add paths to includes of used third-party libraries in variable *CSF_OPT_INC*.
542 * Add paths to their binary libraries in variable *CSF_OPT_LIB64*.
543 * Set variable *SHORTCUT_HEADERS* to specify a method for population of folder *inc* by header files. Supported methods are:
544 * *Copy* - headers will be copied from *src*;
545 * *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*;
546 * "HardLink* - hard links to headers located in *src* will be created.
547 * For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.:
549 export HAVE_GL2PS=false
552 Alternatively, or when *custom.sh* or *custom.bat* does not exist, you can launch **genconf** tool to configure
553 environment interactively:
555 @figure{/build/build_occt/images/genconf_linux.png}
557 Click "Save" to store the specified configuration in *custom.sh* or *custom.bat* file.
559 <h2>Generate Projects</h2>
561 Launch **genproj** tool with option *cbp* to update content of *inc* folder and generate project files after changes in
562 OCCT code affecting layout or composition of source files:
565 $ cd /dev/OCCT/opencascade-7.0.0
569 The generated Code::Blocks project are placed into subfolder *adm/<OS>/cbp*.
571 @note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
575 To start **Code::Blocks**, launch script *codeblocks.sh*.
577 To build all toolkits, click **Build->Build workspace** in the menu bar.
579 To start *DRAWEXE*, which has been built with **Code::Blocks** on Mac OS X, run the script
581 ./draw_cbp.sh cbp [d]
583 Option *d* is used if OCCT has been built in **Debug** mode.