8a7cd95679cb4d7a31b5f63d8dd1d850ded50909
[occt.git] / dox / dev_guides / building / msvc.md
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* -- if set to "true", folder *inc* will be populated by short-cut files pointing to actual headers located in *src*; otherwise, header files will be copied to *inc*.
34
35 Alternatively, you can launch **genconf**, a GUI tool allowing to configure build options interactively.
36 That tool will analyze your environment and propose you to choose available options:
37
38 * Version of Visual Studio to be used (from the list of installed ones, detected by presence of environment variables like *VS100COMNTOOLS*)
39 * Option to use short-cuts to header files in folder *inc* (enabled by default).
40 * Location of third-party libraries (usually downloaded from OCCT web site, see above).
41 * Path to common directory where third-party libraries are located (optional)
42 * Paths to headers and binaries of the third-party libraries (found automatically basing on previous options; click button "Reset" to update).
43
44 @figure{/dev_guides/building/3rdparty/images/genconf_windows.png}
45
46 Click "Save" to store the specified configuration in *custom.bat* file.
47   
48 @section build_msvc_generate Projects generation
49
50 Launch **genproj** to update content of *inc* folder and generate project files after changes in OCCT code affecting layout or composition of source files.
51
52 @note To use **genproj** and **genconf** tools you need to have Tcl installed and accessible by PATH.
53 If Tcl is not found, the tool may prompt you to enter the path to directory where Tcl can be found.
54  
55 ~~~~~
56   $ genproj.bat
57 ~~~~~
58
59 Note that if *custom.bat* is not present, **genproj** will start **genconf** to configure environment.
60
61 @section build_msvc_build Building
62
63 Launch *msvc.bat* to start Visual Studio with all necessary environment variables defined, and build the whole solution or required toolkits.
64
65 Note: the MSVC project files are located in folders <i>adm\\msvc\\vc...</i>.
66 Binaries are produced in *win32* or *win64* folders.
67
68 To start DRAW, launch *draw.bat*.