Open CASCADE Technlgy Building OCCT with WOK CONTENTS 1. INTRODUCTION 2 2. PRE-REQUISITES 2 3. INSTALL BINARY WOK PACKAGE 2 3.1. Windws 2 3.2. Linux 4 3.3. Mac OS X 5 4. INITIALIZE A WORKBENCH 5 5. GENERATION OF BUILDING PROJECTS 6 6. GENERATION OF DOCUMENTAION 7 7. BUILDING MODULES 7 7.1. Building n Windws with MS Visual Studi prject files 7 7.2. Building n Linux with autcnf, autmake and libtl scripts 8 7.3. Building with CMake 9 7.4. Building n MAC OS X with Cde::Blcks 9 7.5. Building n MAC OS X with Xcde 10 OPEN CASCADE SAS Page 1 / 11
1. INTRODUCTION This dcument presents a shrt guide fr installing a binary WOK package and fr building OCCT frm surces. Nte that WOK is required t generate HXX and CXX files fr OCCT classes defined using CDL language, and fr prject files. Fr the time being Binary WOK Package is available in the frm f Install Wizard n Windws platfrm nly. 2. PRE-REQUISITES Befre installing and using WOK, make sure that yu have installed a cmpiler (it is assumed that it is Visual Studi n Windws r gcc n Linux and MacOS) and third-party cmpnents required fr building OCCT. 3. INSTALL BINARY WOK PACKAGE Dwnlad the latest versin f WOK frm http://dev.pencascade.rg/index.php?q=hme/resurces. 3.1. Windws Run the installer. Yu will be prmpted t read and accept the OCCT Public License t prceed: Click Next and prceed with the installatin. At the end f the installatin yu will be prmpted t specify the versin and the lcatin f Visual Studi t be used, and the lcatin f third-party libraries: OPEN CASCADE SAS Page 2 / 11
Yu can change these settings at any time later. Fr this click n the item Custmize envirnment (GUI tl) in the WOK grup in the Windws Start menu. The shrtcuts frm this grup prvide tw ways t run WOK: In cmmand prmpt windw ( WOK TCL shell ). In Emacs editr ( WOK Emacs ). Using Emacs is cnvenient if yu need t wrk within WOK envirnment. By default WOK installer creates a WOK factry with name LOC within wrkshp dev (WOK path :LOC:dev). OPEN CASCADE SAS Page 3 / 11
3.2. Linux 1. Unpack the.tgz archive cntaining WOK distributive int an installatin directry <WOK_INSTALL_DIR>. 2. Perfrm the fllwing cmmands assuming that yu have unpacked WOK distributive archive int <WOK_INSTALL_DIR>: cd <WOK_INSTALL_DIR>/site wk_cnfgui.sh Define all necessary paths t third-party prducts in the dialg windw: 3. Run the fllwing cmmands t create WOK LOC factry: cd <WOK_INSTALL_DIR>/site wk_init.sh 4. Yur installatin prcedure is ver. T run WOK use ne the fllwing cmmands: cd <WOK_INSTALL_DIR>/site wk_emacs.sh r cd <WOK_INSTALL_DIR>/site wk_tclsh.sh OPEN CASCADE SAS Page 4 / 11
3.3. Mac OS X 1. In the Finder duble click n wksetup.dmg file. This will pen a new windw. Drag and drp wksetup flder frm this windw at the lcatin in the Finder where yu want t install WOK, i.e. <WOK_INSTALL_DIR>. 2. Brwse in the Finder t the flder <WOK_INSTALL_DIR>/site and duble click n WkCnfig. This will pen a windw with additinal search path settings. Define all necessary paths t third-party prducts in the dialg windw: 3. Run the fllwing cmmands t create WOK LOC factry: cd <WOK_INSTALL_DIR>/site wk_init.sh 4. Yur installatin prcedure is ver. T run WOK in Emacs navigate in the Finder t the flder <WOK_INSTALL_DIR>/site and duble click n WkEmacs. 4. INITIALIZE A WORKBENCH T start wrking with OCCT, clne the OCCT Git repsitry frm the server (see http://dev.pencascade.rg/index.php?q=hme/resurces fr details) r unpack the surce archive. OPEN CASCADE SAS Page 5 / 11
Then create a WOK wrkbench (cmmand wcreate) setting its Hme t the directry, where the repsitry is created ($CASROOT variable). The wrkbench shuld have the same name as that directry. Fr example, assuming that OCCT repsitry has been clned int D:/cct flder: LOC:dev> wcreate cct -DHme=D:/cct Nte: $CASROOT is equal t D:/cct nw. Then yu can wrk with this wrkbench using nrmal WOK functinality (wprcess, umake, etc.; see WOK User s Guide fr details) r use it nly fr generatin f derived surces and prject files, and build OCCT with Visual Studi n Windws r make cmmand n Linux, as described belw. 5. GENERATION OF BUILDING PROJECTS Use cmmand wgenprj in WOK t generate derived headers, surce and building prjects files: LOC:dev> wkcd cct LOC:dev:cct> wgenprj [ -target=<target> ] [ -n_wprcess ] TARGET: vc8 - Visual Studi 2005 vc9 - Visual Studi 2008 vc10 - Visual Studi 2010 vc11 - Visual Studi 2012 cbp - CdeBlcks cmake - CMake amk - AutMake xcd - Xcde -n_wprcess - skip generatin f derived headers and surce files Nte that this cmmand takes several minutes t cmplete at the first call. Re-execute this step t generate derived headers, surce and building prjects files if sme CDL files in OCCT have been mdified (either by yu directly, r due t updates in the repsitry). Nte that in sme cases WOK may fail t update crrectly; in such case remve sub-directries drv and.adm and repeat the cmmand. T regenerate derived headers and surce files withut regeneratin f prjects use cmmand: LOC:dev> wkcd cct LOC:dev:cct> wprcess -DGrups=Src,Xcpp The generated building prject will be placed int the crrespnding flder: fr vc8 - $CASROOT/adm/msvc/vc8 fr vc9 - $CASROOT/adm/msvc/vc9 fr vc10 - $CASROOT/adm/msvc/vc10 fr vc11 - $CASROOT/adm/msvc/vc11 fr cbp - $CASROOT/adm/<OS> 1 /cbp fr cmake - $CASROOT/adm/cmake fr amk - $CASROOT/adm/lin/amk 1 <OS> is the peratin system used fr building prject generatin. OPEN CASCADE SAS Page 6 / 11
xcd - $CASROOT/adm/<OS>/xcd 6. GENERATION OF DOCUMENTAION Use cmmand wgendc in WOK t generate reference dcumentatin: :LOC:dev> wkcd cct :LOC:dev:cct> wgendc The fllwing ptins can be used: -wb=<wrkbench name> the name f OCCT wrkbench (the current ne by default); -m=<list f mdules> the list f mdules that will be cntained in the dcumentatin; -utdir=<path> the utput directry fr the dcumentatin; -chm the ptin t generate CHM file; -hhc=<path> the path t HTML Help Cmpiler (hhc.exe) r equivalent; -qthelp=<path> the ptin t generate Qt Help file, it is necessary t specify the path t qthelpgeneratr executable; -dxygen=<path> the path t Dxygen executable -dt=<path> the path t GraphViz dt executable 7. BUILDING MODULES 7.1. Building n Windws with MS Visual Studi prject files Befre cmpilatin, yu must define a path t the header and library files f TclTk, Freetype, FreeImage, gl2ps and TBB. Fr this, select in MS Visual Studi menu Tls -> Optin frm Directries tab r edit custm.bat file (lcated in $CASROOT directry). gl2ps, TBB and FreeImage are ptinal prducts. T build Open CASCADE Technlgy with r withut them, use variable CSF_DEFINES t specify additinal cmpiler macrs: HAVE_TBB - if yu want t build OCCT with Intel TBB; HAVE_FREEIMAGE - if yu want t build OCCT with FreeImage; HAVE_GL2PS - if yu want t build OCCT with gl2ps. Examples f definitin in custm.bat file: Building withut gl2ps, TBB and FreeImage: set HAVE_FREEIMAGE=false set HAVE_GL2PS=false set HAVE_TBB=false These definitins frm the string "set CSF_DEFINES=;" in env.bat file. Building with gl2ps, TBB and FreeImage: set HAVE_FREEIMAGE=true set HAVE_GL2PS=true set HAVE_TBB=true These definitins frm the string "set CSF_DEFINES=HAVE_TBB;HAVE_FREEIMAGE;HAVE_GL2PS" in env.bat file. Use msvc.bat script lcated in $CASROOT flder fr launching MS Visual Studi in the envirnment cnfigured fr building OCCT libraries. The script accepts ptinal arguments: the versin f Visual Studi t launch (vc8, vc9, vc10 and vc11), the architecture (win32 r win64), the mde f libraries fr executin (Debug r Release), and the path t the slutin file, e.g.: msvc.bat vc9 win32 Release OPEN CASCADE SAS Page 7 / 11
Libraries (dll, lib) and executable (exe) files built by MS Visual Studi prjects n Windws platfrm, are placed t the flders $CASROOT/win32/vc8, vc9, vc10 and vc11 crrespndingly (r $CASROOT/win64/vc8, vc9, vc10 and vc11 fr 64-bit). Flder $CASROOT/adm/msvc cntains flders vc8, vc9, vc10 and vc11 with MS Visual Studi prject files fr MS VC 2005, 2008, 2010 and 2012 crrespndingly that can be used t rebuild Open CASCADE Technlgy in 32 r 64 bit mde. Each f them describes and builds ne library (.dll) r executable (.exe). They are designed t cmpile surces and t search header files in a directry structure created frm dwnladed archives. All these prjects are gathered in wrkspaces crrespnding t OCCT mdules. The wrkspaces are listed belw and must be rebuilt in accrdance with that rder. Belw is the rdered list f wrkspaces t rebuild. Fundatin Classes (file FundatinClasses.sln); Mdeling Data (file MdelingData.sln); Mdeling Algrithms (file MdelingAlgrithms.sln); Visualizatin (file Visualizatin.sln); Applicatin Framewrk (file ApplicatinFramewrk.sln); Data Exchange (file DataExchange.sln); Draw (file Draw.sln). Additinally a cmmn MS Visual Studi slutin file OCCT.sln is prvided. This slutin cmprises all OCCT prjects and can be used fr (re)building a cmplete set f OCCT libraries r separate OCCT mdule in ne instance f Visual Studi. 7.2. Building n Linux with autcnf, autmake and libtl scripts During the cmpilatin by makefiles with sme Linux OS n a statin with NVIDIA vide card yu may experience prblems because the installatin prcedure f NVIDIA vide driver remves library libgl.s included in package libmesagl frm directry /usr/x11r6/lib and places this library libgl.s in directry /usr/lib. Hwever, libtl expects t find the library in directry /usr/x11r6/lib, which causes cmpilatin crash (See /usr/x11r6/lib/libglu.la). We suggest making links: ln -s /usr/lib/libgl.s /usr/x11r6/lib/libgl.s ln -s /usr/lib/libgl.la /usr/x11r6/lib/libgl.la Attentin: Befre cnfiguratin it is necessary t launch build_cnfigure script t generate files cnfigure and Makefile.in Nw use./cnfigure <FLAGS>, where <FLAGS> is a set f the fllwing directives: --with-tcl=<lcatin> defines lcatin f tclcnfig.sh; --with-tk=<lcatin> defines lcatin f tkcnfig.sh; --with-freetype=<lcatin> defines lcatin f installed FreeType prduct; --with-gl2ps=<lcatin> defines lcatin f installed gl2ps prduct; --with-freeimage=<lcatin> defines lcatin f installed FreeImage prduct; --with-tbb-include=<lcatin> defines lcatin f tbb.h; --with-tbb-library=<lcatin> defines lcatin f libtbb.s; --enable-debug=<yes/n> includes/excludes debug infrmatin; --enable-prductin=<yes/n> switches n/ff cde ptimizatin; --prefix=<lcatin> defines the lcatin fr installatin f OCCT binaries. Additinal flags: --disable-draw allws OCCT building withut Draw. Open CASCADE technlgy will be built withut ptinal prducts if yu will nt define the fllwing ptins: withut tbb: with-tbb-include= OPEN CASCADE SAS Page 8 / 11
with-tbb-library= withut gl2ps: --with-gl2ps= withut freeimage: --with-freeimage= 7.3. Building with CMake CMake is free sftware that can create GNU Makefiles, KDevelp, XCde and Visual Studi prject files. T use it fr building OCCT n different platfrms, dwnlad and install the latest versin f CMake sftware. The main meta-prject CmakeListx.txt fr the entire OCCT and ne metafile fr each OCCT tlkit are generated by WOK tl. The created files are lcated in $CASROOT/adm/cmake/. Run installed CMake and prceed t the cnfiguratin f generated main meta-prject, cnfiguratin f 3rd-party prject paths and finally OCCT prject files generatin. The entire prcedure is described with instructins fr all supprted platfrms in Building OCCT with CMake User s Guide. 7.4. Building n MAC OS X with Cde::Blcks T build OCCT with Cde::Blcks n Mac OS X, perfrm the fllwing steps: 1. Add paths t the mandatry 3rd-party prducts (Tcl/Tk and FreeType) in file custm.sh (lcated in $CASROOT directry). Fr this: Add paths t the includes in variable CSF_OPT_INC ; Add paths t the binary libraries in variable CSF_OPT_LIB64 ; All paths shuld be separated by : symbl (cln). 2. Add paths t the ptinal 3rd-party libraries (TBB, gl2ps and FreeImage) in the afrementined envirnment variables CSF_OPT_INC and CSF_OPT_LIB64 frm file custm.sh. If yu want t build OCCT withut the ptinal libraries perfrm the fllwing steps: Disable unnecessary library in custm.sh by setting the crrespnding variable HAVE_<LIBRARY_NAME> t false, e.g.: exprt HAVE_GL2PS=false; Remve this library frm Linker settings in Cde::Blcks fr each prject that uses it: right click n the required prject; chse Build ptins ; g t Linker settings tab in the pened windw; select unnecessary libraries; click Delete buttn. 3. Open Terminal applicatin. 4. Enter $CASROOT directry (e.g. $HOME/cct): cd $HOME/cct. 5. T start Cde::Blcks, run the cmmand /cdeblcks.sh. 6. T build all tlkits, click Build->Build wrkspace in the menu bar. OPEN CASCADE SAS Page 9 / 11
T start DRAWEXE, which has been built with Cde::Blcks n Mac OS X, perfrm the fllwing steps: 1. Open Terminal applicatin; 2. Enter $CASROOT directry (e.g. $HOME/cct): cd $HOME/cct 3. Run script./draw_cbp.sh cbp [d]. Optin d is used if OCCT has been built in Debug mde. 7.5. Building n MAC OS X with Xcde T build OCCT with Xcde n Mac OS X, perfrm the fllwing steps: 1. Add paths t the mandatry 3rd-party prducts (Tcl/Tk and FreeType) in file custm.sh (lcated in $CASROOT directry). Fr this: add paths t the includes in variable CSF_OPT_INC ; add paths t the binary libraries in variable CSF_OPT_LIB64. All paths shuld be separated by : symbl (cln). 2. Add paths t the ptinal 3rd-party libraries (TBB, gl2ps and FreeImage) in the afrementined envirnment variables CSF_OPT_INC and CSF_OPT_LIB64 frm file custm.sh. If yu want t build OCCT withut the ptinal libraries perfrm the fllwing steps: disable unnecessary library in custm.sh by setting the crrespnding variable HAVE_<LIBRARY_NAME> t false, e.g.: exprt HAVE_GL2PS=false; remve this library frm Prject navigatr in Xcde fr each prject that uses it: 3. Open Terminal applicatin. chse the required prject; right click n the unnecessary library and select Delete buttn. 4. Enter $CASROOT directry (e.g. $HOME/cct): cd $HOME/cct. 5. T start Xcde, run the cmmand /xcde.sh. 6. T build a certain tlkit: select it in Scheme drp-dwn list in Xcde tlbar; press Prduct in the menu; click Build buttn. T build the entire OCCT: create a new empty prject (select File -> New -> Prject-> "Empty prject" in the menu. Input the prject name, e.g., OCCT, click Next and Create buttns); drag and drp the OCCT flder in the created "OCCT prject in the Prject navigatr; select File -> New -> Target -> Aggregate in the menu. Enter the prject name (e.g. OCCT) and click "Finish". "Build Phases tab will pen. Click + buttn t add the necessary tlkits t the target prject. It is pssible t select all tlkits by pressing Cmmand+A cmbinatin. OPEN CASCADE SAS Page 10 / 11
T start DRAWEXE, which has been built with Xcde n Mac OS X, perfrm the fllwing steps: 1. Open Terminal applicatin. 2. Enter $CASROOT directry (e.g. $HOME/cct): cd $HOME/cct. 3. Run script./draw_cbp.sh cbp [d]. Optin d is used if OCCT has been built in Debug mde. OPEN CASCADE SAS Page 11 / 11