Build OCCT655 With MSVC 11 Express (Old)

This content moved from temporary-name-0001

Building OpenCASCADE655 with MS Visual Studio 11 Express for Desktop Development

This section is the log of building of OpenCASCADE and all required dependencies with declared tool chain.

The build is done (started) on April 18, 2013.

Note, that this page is not assumed to be any kind of guide or tutorial. It is only the description of the experience, which I have with building OCCT.

Getting started

  • We need MSVS 11 (2012) Express (for Desktop development). For this I go to "msdn.com" and on the front page there is adverticement of MSVS12 with download button. I use this button and install Visual Studio of required version. Then register it and update. Note, that it is only possible to download "current" version of MSVS Express, e.g. at this moment I can only download version 11 (and cannot download version 10)
  • We need source distribution of OCCT655 (this is latest version of OCCT for the moment of writing this: April 18, 2013). For this I go to "opencascade.org". To download OpenCASCADE one have to be logged in. I already have account, so I login and go to "Get It -> Download Center ->Download Open CASCADE Technology latest public version! -> OpenCASCADE655.tgz"
  • I use 7zip to extract the archive (there are problems with duplicated files in documentation. I select "overwrite all").
  • The content of the archive is in the "D:\Libs\OCCT\OpenCASCADE655" now. From now on I will set env var OCCT_DIR to point to this location and use it to refer to the dir:
set OCCT_DIR=D:\Libs\OCCT\OpenCASCADE655
  • Either I will set CASROOT dir as it is traditionally done for OpenCASCADE environment:
set CASROOT=%OCCT_DIR%\ros

Installation documentation

  • As I understand, there are two documents relevant for building OpenCASCADE on windows. The first is "%OCCT_DIR\doc\OCCT_Build3rdParty_Windows_V2.pdf%", which describes building of 3-rd party libs required for OpenCASCADE. The second one is "%CASROOT%\BUILD.Windows", which describes build of OpenCASCADE on windows itself. Actually, among with official documentation this wiki site either have pages related to building OpenCASCADE (and its 3-rd party dependences).
  • I start with 3-rd party libs. So, we open "%OCCT_DIR\doc\OCCT_Build3rdParty_Windows_V2.pdf%" and see, which libs are listed there:
      • Mandatory
          • Tcl 8.5
          • Tk 8.5
          • TclX 8.4
          • FreeType 2.4.10
          • Ftgl 2.1.3
      • Optional
          • TBB 3.0-018
          • gl2ps 1.3.5
          • FreeImage 3.14.1
  • Either I will build Qt 4.8.4 (latest Qt 4.x for the moment: April 18, 2013).
  • After some speculations I decided for simplicity initially build only four mandatory packages: Tcl, Tk, FreeType and Ftgl. Than add Qt if everything will be OK.

* … To be continued

So, today is April 19, 2013 and I continue building OCCT655.

The first prerequisite is Tcl 8.5. I downloaded sources for it as described above and now ready to start building it. Official document, which describes building OCCT 3-rd party libs tells that we should take prebuilt activestate Tcl. But we want to build it from scratch, so we will do it as described in source package.

So, we go to "%OCCT_3RD_PARTY%\tcl8.5.14\win". README file tells, that we should look into "Makefile.vc" (there is also tcl.dsw, which can be used to build Tcl from Visual Studio, but I'd like to build from command line, so I stick to Makefile.vc).

Makefile.vc contains very detailed comments about how to use it in the beginning of the file.

I rename sources dir of Tcl from "D:\Libs\OCCT\3rd_parties\tcl8.5.14" to "D:\Libs\OCCT\3rd_parties\tcl8.5.14-build".

I use standard MSVS 2012 Express installation, so to set MSVS env vars I use command

%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat""

(Copied from shortcut in Start menu). This script sets %vcinstalldir% and %windowssdkdir%, which should be enough to run makefile.vc

I want to have debug version of Tcl (just in case - right now I don't want to load huge projects, so performance is not an issue for me right now).
I want to get dll-s and shell.
I want to install the output to "D:\Libs\OCCT\3rd_parties\tcl-8.5-win-32-deb".
The output will be x32.
The output will contain debug symbols.
The output should support threading.

So, I compile with the script like this:

REM file D:\Libs\OCCT\3rd_parties\tcl8.5.14-build\win\BuildTcl.cmd
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat"
nmake -f makefile.vc release OPTS=threads,symbols MACHINVE=IX86 && ^
nmake -f makefile.vc install OPTS=threads,symbols MACHINVE=IX86 INSTALLDIR=D:\Libs\OCCT\3rd_parties\tcl-8.5-win-32-deb

Note: one should "build" and "install" with the same options defined as otherwise make will not find files to install.

Finally I've got the following layout of files:

D:\LIBS\OCCT\3RD_PARTIES\TCL-8.5-WIN-32-DEB
├───bin
│       tcl85tg.dll
│       tclpip85g.dll
│       tclsh85tg.exe
│
├───include
│       tcl.h
│       tclDecls.h
│       tclPlatDecls.h
│       tclTomMath.h
│       tclTomMathDecls.h
│       tommath_class.h
│       tommath_superclass.h
│
└───lib
    │   tcl85tg.lib
    │   tclConfig.sh
    │   tclstub85.lib
    │
    ├───dde1.3
    │       pkgIndex.tcl
    │       tcldde13g.dll
    │
    ├───reg1.2
    │       pkgIndex.tcl
    │       tclreg12g.dll
    │
    ├───tcl8
    │   ├───8.2
    │   ├───8.3
    │   ├───8.4
    │   │   │   http-2.7.11.tm
    │   │   │   platform-1.0.11.tm
    │   │   │
    │   │   └───platform
    │   │           shell-1.1.4.tm
    │   │
    │   └───8.5
    │           msgcat-1.5.1.tm
    │           tcltest-2.3.5.tm
    │
    └───tcl8.5
        │   auto.tcl
        │   clock.tcl
        │   history.tcl
        │   init.tcl
        │   package.tcl
        │   parray.tcl
        │   safe.tcl
        │   tclIndex
        │   tm.tcl
        │   word.tcl
             ...

You can see, that as we build "debug" and "threaded" there are "t" and "g" suffixes at the end of many file's names.


Now we have built Tcl and can switch to building Tk. I think, that the procedure will be similar.

I have extracted sources to ""

Renamed it to ""

I will install sources to ""

I go to "" and find there similar "makefile.vc". After reading it I have written the BuildTK.cmd script with the following content:

REM file D:\Libs\OCCT\3rd_parties\tk8.5.14-build\win\TkBuild.cmd
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat"
nmake -f makefile.vc ^
 release ^
 OPTS=threads,symbols,noxp ^
 MACHINVE=IX86 ^
 TCLDIR=D:\Libs\OCCT\3rd_parties\tcl8.5.14-build
nmake -f makefile.vc ^
 install ^
 OPTS=threads,symbols,noxp ^
 MACHINVE=IX86 ^
 INSTALLDIR=D:\Libs\OCCT\3rd_parties\tk-8.5-win-32-deb\test ^
 TCLDIR=D:\Libs\OCCT\3rd_parties\tcl8.5.14-build

Notes:

  • I had to use source directory (build directory) of Tcl as TCLDIR (not install dir of Tcl).
  • I had to use "noxp" option.
  • It seems, that there is some bug in makefile.vc, so that install dir ignores last "name" in the path, so append some "dummy" dir to it. In our case trailing "test" is "dummy".

After build I have the following layout of output dirs.:

D:\LIBS\OCCT\3RD_PARTIES\TK-8.5-WIN-32-DEB
├───bin
│       tk85tg.dll
│       wish85tg.exe
│
├───include
│   │   tk.h
│   │   tkDecls.h
│   │   tkIntXlibDecls.h
│   │   tkPlatDecls.h
│   │
│   └───X11
│           cursorfont.h
│           keysym.h
│           keysymdef.h
│           X.h
│           Xatom.h
│           Xfuncproto.h
│           Xlib.h
│           Xutil.h
│
└───lib
    │   tk85tg.lib
    │   tkstub85.lib
    │
    └───tk8.5
        │   bgerror.tcl
        │   button.tcl
        │   choosedir.tcl
        │   clrpick.tcl
            ...

Now we can go further to build freetype. While reading doc/INSTALL in its source dir I found, that corresponding page on this site is right[http://opencascade.wikidot.com/build3rd] and I need GNU make tool. So I used the instructions to build it.

I have built freetype as described on the page (using GNU make tool). It worked fine.

Notes:

  • freetype.lib after build is located in "obj" dir

FTGL

To build FTGL I've extracted sources, and went to the dir. Copy dir with vc8 solution. Open the solution with Visual Studio IDE. Convert solution when prompted. Corrected include dir, lib dir and lib file in the DLL project. And built it. Everything worked fine.

—-

Building OCCT itself:

Adapt cuatom.bat.

TKernel cannot find mapiwin.h - add manually from PRogram Files x86/… windows SDK … /include

Some lib cannof find freeimage.h


It seems, that we need FreeImage.

To build FreeImage we need MFC, which are not part of the MSVS Express, so we have to install Windows Driver Kit, which provides MFC.


During build of TKOpenGL msvcrt lib (standard C++ runtime lib) conflicts with libcmt.lib (I guess it is standar C runtime lib). So I just disabled linkage of the second one (libcmt.lib) in TKOpenGl (in Visualization logical project folder). Then it linked normally (some warnings still presented).