72b7576f |
1 | Building with CMake {#dev_guides__building__cmake} |
2 | =================== |
3 | |
4 | This file describes steps to build OCCT libraries from complete source package |
5 | with CMake. CMake is free software that can create GNU Makefiles, KDevelop, |
6 | XCode, and Visual Studio project files. Version 2.6 or above of CMake is |
7 | required. |
8 | |
9 | If you are building OCCT from bare sources (as in Git repository), or do some |
10 | changes affecting CDL files, you need to use WOK to re-generate header files |
11 | and build scripts / projects. See file \ref wok "WOK" for instructions. |
12 | |
13 | Before building OCCT, you need to install required third-party libraries; see |
14 | instructions for your platform on Resources page at http://dev.opencascade.org |
15 | |
16 | 1. Decide on location of build and install directories. |
17 | |
18 | The build directory is the one where intermediate files will be created |
19 | (projects / makefiles, objects, binaries). |
20 | The install directory is the one where binaries will be installed after |
21 | build, along with header files and resources required for OCCT use in |
22 | applications. |
23 | |
24 | OCCT CMake scripts assume use of separate build and one install directories |
25 | for each configuration (Debug or Release). |
26 | |
27 | It is recommended to separate build and install directories from OCCT |
28 | source directory, for example: |
29 | |
30 | /user/home/occt/ros - sources |
31 | /user/home/tmp/occt-build-release - intermediate files (release) |
32 | /user/home/occt-install-release - installed binaries (release) |
33 | |
34 | 2. Run CMake indicating path to OCCT sources (ros subdirectory) and selected build directory. |
35 | It is recommended to use GUI tools provided by CMake: cmake-gui on Windows |
36 | and Mac, ccmake on Linux. |
37 | |
38 | Example: |
39 | |
40 | Linux> cd /user/home/occt-install-release |
41 | Linux> ccmake /user/home/occt/ros |
42 | |
43 | 3. Run Configure |
44 | |
45 | You will likely get CMake errors due to missing paths to 3rd-party |
46 | libraries. This is normal; proceed with configuration as follows. |
47 | |
48 | 4. Check parameters shown by CMake, set them in accordance with your |
49 | environment, and repeat Configure until it runs without error: |
50 | |
51 | - 3RDPARTY_DIR: path to directory whethe 3rd-party libraries are installed |
52 | (for the cases when they are not in default locations, or on Windows) |
53 | - 3RDPARTY_USE_\<library\>: select to use optional libraries |
54 | - Other options in 3RDPARTY group can be used to fine-tune paths to |
55 | 3rd-party libraries |
56 | |
57 | - BUILD_TYPE: configuration to build (Debug or Release) |
58 | - BUILD_BITNESS: bitness (32 or 64) |
59 | - BUILD_TOOLKITS: optional string containing list of toolkits to be built |
60 | in addition to those included in completely built modueles |
61 | - BUILD_\<module\>: select to build corresponding OCCT module |
62 | |
63 | - INSTALL_DIR: directory to install OCCT |
64 | - INSTALL_\<library\>: select to copy corresponding 3rd-party library to OCCT |
65 | install dir |
66 | |
67 | 5. Run Generate |
68 | |
69 | This will create makefiles or project files for your build system. |
70 | |
71 | 6. Build OCCT: |
72 | |
73 | - on Windows with MSVC: open solution OCCT.sln and build it, when build project INSTALL_ALL explicitly to have binaries and headers installed |
74 | - on Linux with make files: run 'make install' |
75 | |
76 | |
77 | |