ba06f8bb |
1 | Building with Xcode {#occt_dev_guides__building_xcode} |
72b7576f |
2 | =================== |
3 | |
72c37458 |
4 | @tableofcontents |
72b7576f |
5 | |
72c37458 |
6 | @section build_xcode_intro General |
72b7576f |
7 | |
72c37458 |
8 | This file describes steps to build OCCT libraries from sources on Mac OS X with **Xcode** projects, generated by OCCT legacy tool **genproj**. |
72b7576f |
9 | |
72c37458 |
10 | @section build_xcode_3rdparty Third-party libraries |
72b7576f |
11 | |
72c37458 |
12 | Before building OCCT, make sure to have all the needed third-party libraries installed. |
13 | On OS X we recommend to use native libraries. |
14 | You can also build third-party libraries from their sources, see @ref occt_dev_guides__building_3rdparty_osx for instructions. |
72b7576f |
15 | |
72c37458 |
16 | @section build_xcode_conf Configuration |
72b7576f |
17 | |
72c37458 |
18 | Before building it is necessary to set up build environment. |
72b7576f |
19 | |
72c37458 |
20 | The environment is defined in the file *custom.sh* which can be edited directly: |
72b7576f |
21 | |
72c37458 |
22 | * Add paths to includes of used third-party libraries in variable *CSF_OPT_INC* (use colon ":" as path separator). |
23 | * Add paths to their binary libraries in variable *CSF_OPT_LIB64*. |
24 | * Set variable *SHORTCUT_HEADERS* to "true" to have folder *inc* populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*. |
25 | * For optional third-party libraries, set corresponding environment variable <i>HAVE_<LIBRARY_NAME></i> to either *false*, e.g.: |
576f8b11 |
26 | ~~~~~ |
72b7576f |
27 | export HAVE_GL2PS=false |
576f8b11 |
28 | ~~~~~ |
72b7576f |
29 | |
72c37458 |
30 | Alternatively, or when *custom.sh* does not exist, you can launch *genconf.sh* to configure environment interactively: |
31 | |
32 | @figure{/dev_guides/building/3rdparty/images/genconf_osx.png} |
33 | |
34 | Click "Save" to store the specified configuration in *custom.sh* file. |
35 | |
36 | @section build_xcode_gen Projects generation |
37 | |
38 | 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. |
39 | |
40 | @note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH. |
41 | |
42 | For instance, in Terminal application: |
72b7576f |
43 | |
576f8b11 |
44 | ~~~~~ |
72c37458 |
45 | $ cd /dev/OCCT/opencascade-7.0.0 |
944d808c |
46 | $ ./genproj |
576f8b11 |
47 | ~~~~~ |
576f8b11 |
48 | |
72c37458 |
49 | @section build_xcode_build Building |
50 | |
51 | To start **Xcode**, launch script *xcode.sh*. |
52 | |
53 | To build a certain toolkit, select it in **Scheme** drop-down list in Xcode toolbar, press **Product** in the menu and click **Build** button. |
576f8b11 |
54 | |
72c37458 |
55 | To build the entire OCCT: |
56 | * 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**). |
57 | * Drag and drop the *OCCT* folder in the created *OCCT* project in the Project navigator. |
58 | * Select **File -> New -> Target -> Aggregate** in the menu. |
59 | * Enter the project name (e.g. *OCCT*) and click **Finish**. The **Build Phases** tab will open. |
60 | * Click "+" button to add the necessary toolkits to the target project. It is possible to select all toolkits by pressing **Command+A** combination. |
61 | |
62 | @section build_xcode_draw Launching DRAW |
72b7576f |
63 | |
576f8b11 |
64 | To start *DRAWEXE*, which has been built with Xcode on Mac OS X, perform the following steps: |
72b7576f |
65 | |
576f8b11 |
66 | 1.Open Terminal application |
72b7576f |
67 | |
576f8b11 |
68 | 2.Enter <i>\<OCCT_ROOT_DIR\></i>: |
69 | ~~~~~ |
72b7576f |
70 | cd \<OCCT_ROOT_DIR\> |
576f8b11 |
71 | ~~~~~ |
72b7576f |
72 | |
576f8b11 |
73 | 3.Run the script |
74 | ~~~~~ |
72b7576f |
75 | ./draw_cbp.sh xcd [d] |
576f8b11 |
76 | ~~~~~ |
72c37458 |
77 | |
78 | Option *d* is used if OCCT has been built in **Debug** mode. |