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