| 1 | Building with MS Visual C++ {#occt_dev_guides__building_msvc} |
| 2 | =========================== |
| 3 | |
| 4 | @tableofcontents |
| 5 | |
| 6 | @section build_msvc_intro General |
| 7 | |
| 8 | 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. |
| 9 | It is an alternative to use of CMake build system (see @ref occt_dev_guides__building_cmake). |
| 10 | |
| 11 | **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. |
| 12 | These project files are placed inside OCCT directory (in *adm* subfolder) and use relative paths, thus can be moved together with sources. |
| 13 | |
| 14 | The project files included in official distribution of OCCT are generated by this tool. |
| 15 | If you have official distribution with project files included, you can use them directly without a need to call **genproj**. |
| 16 | |
| 17 | @section build_msvc_3rdparty Third-party libraries |
| 18 | |
| 19 | Before building OCCT, make sure to have all the required third-party libraries installed. |
| 20 | |
| 21 | 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 http://www.opencascade.com/content/3rd-party-components. |
| 22 | |
| 23 | You can also build third-party libraries from their sources, see @ref occt_dev_guides__building_3rdparty_windows for instructions. |
| 24 | |
| 25 | @section build_msvc_conf Configuration |
| 26 | |
| 27 | If you have Visual Studio projects already available (pre-installed or generated), you can edit file *custom.bat* manually to adjust the environment: |
| 28 | |
| 29 | * *VCVER* -- version of Visual Studio (vc10, vc11, vc12, or vc14), and relevant *VCVARS* path |
| 30 | * *ARCH* -- architecture (32 or 64), affects only *PATH* variable for execution |
| 31 | * <i>HAVE_*</i> -- flags to enable or disable use of optional third-party products |
| 32 | * <i>CSF_OPT_*</i> -- paths to search for includes and binaries of all used third-party products |
| 33 | * *SHORTCUT_HEADERS* -- defines method for population of folder *inc* by header files. Supported methods are: |
| 34 | * *Copy* - headers will be copied from *src*; |
| 35 | * *ShortCut* - short-cut header files will be created, redirecting to same-named header located in *src*; |
| 36 | * "HardLink* - hard links to headers located in *src* will be created. |
| 37 | |
| 38 | Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively. |
| 39 | That tool will analyze your environment and propose you to choose available options: |
| 40 | |
| 41 | * Version of Visual Studio to be used (from the list of installed ones, detected by presence of environment variables like *VS100COMNTOOLS*) |
| 42 | * Method to populate folder *inc* (short-cuts by default). |
| 43 | * Location of third-party libraries (usually downloaded from OCCT web site, see above). |
| 44 | * Path to common directory where third-party libraries are located (optional) |
| 45 | * Paths to headers and binaries of the third-party libraries (found automatically basing on previous options; click button "Reset" to update). |
| 46 | |
| 47 | @figure{/dev_guides/building/3rdparty/images/genconf_windows.png} |
| 48 | |
| 49 | Click "Save" to store the specified configuration in *custom.bat* file. |
| 50 | |
| 51 | @section build_msvc_generate Projects generation |
| 52 | |
| 53 | Launch **genproj** to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files. |
| 54 | |
| 55 | @note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH. |
| 56 | If Tcl is not found, the tool may prompt you to enter the path to directory where Tcl can be found. |
| 57 | |
| 58 | ~~~~~ |
| 59 | $ genproj.bat |
| 60 | ~~~~~ |
| 61 | |
| 62 | Note that if *custom.bat* is not present, **genproj** will start **genconf** to configure environment. |
| 63 | |
| 64 | @section build_msvc_build Building |
| 65 | |
| 66 | Launch *msvc.bat* to start Visual Studio with all necessary environment variables defined, and build the whole solution or required toolkits. |
| 67 | |
| 68 | Note: the MSVC project files are located in folders <i>adm\\msvc\\vc...</i>. |
| 69 | Binaries are produced in *win32* or *win64* folders. |
| 70 | |
| 71 | To start DRAW, launch *draw.bat*. |