Skip to main content

Hello everyone I will show you how to build OpenCASCADE 7.4.0 in Windows 10 platform. I will use Mingw-w64 builds as a development toolchain but there are many other ways to achieve it like Cygwin, MSYS, etc.  Note that I don’t used MSYS and Cygwin before I tried with them also but I couldn’t handle it, if you managed to do with them please let me know.

Prerequisites

  • Installing Mingw-w64
  • Installing CMake

Installing Mingw-w64

  • Download Mingw-w64 builds installer  ==>  Link
  • Open the installer and change the architecture to “x86_64” and exception to “seh”;
  • Then chosse where you wanna install and click next to install.
    Note: I created a folder named “Dev” in right under “C:\” it is advised to don’t install this kind stuff to paths contains whitespaces like “program files”.
  • When installation finished click on the Windows Start Menu and type “Run” and click the respective App.
  • Then type “sysdm.cpl” and click OK.
  • Switch to the Advanced Tab and click Environment Variables .
  • Now select “Path” from system variables (Don’t select it from user variables!!) and click edit.
  • Now Click new and add your Mingw installation’s “bin” folder to list.
    Note: Click OK in every window popped up if you close them any other way variable wont be added.
  • Now for just testing open a command prompt and type “gcc” if it says;

    gcc: fatal error: no input files

    everything works fine.

Installing CMake

  • Download CMake installer ==> Link
  • Run the installer and select “Add CMake to the system PATH for all users” option.
  • For testing open a command prompt and type “‘cmake-gui.exe” if it opens a cmake gui window it installed successfully.

Building OpenCASCADE

  • Download OpenCASCADE 7.4.0 source package  ==> link 
  • Download third party components associated with Mingw ==> link
    Note: for TBB it redirect to the github just download windows asset from releases.
  • Create a folder named OpenCASCADE (I created mine in C:\Dev), an another two subfolders named OpenCASCADEv740 and ThirdParty
    –OpenCASCADE
    –OpenCASCADEv740
    –ThirdParty
  • Extract every third party components to ThirdParty folder.
  • Assuming your OpenCASCADE source package is downloaded to “Downloads” folder extract it there and create another folder named “build” next to it.
  • Open a command prompt and go to your build folder and type;
    cmake-gui.exe ../opencascade-7.4.0
  • This will open cmake-gui window click configure in there;
  • After you pressed configure a window will pop up and asks generator select MinGW Makefiles and continue.
  • It can prompt an error “Configuring incomplete, project files may be invalid” but don’t worry we ‘ll handle that.
  • The red entry means respective entry not configured yet or incorrect,
    but you may say; dude every line is red what the hell ? Don’t worry we ‘ll just configure couple of them rest will be handled by cmake.
  • Now fill the entries below like that;
  • After that press configure “couple” of times (first for configuring, second for made them in order other for just safe 🙂 ) more.
  • Now you ‘ll see cmake fill most of the empty entries.
    Note: Just a reminder not every entry has to be filled.
  • After you are sure about your configuration you can press Generate.
    NOTE: You cannot change the INSTALL_DIR after that. You can enable other options according to your needs but this is enough for most projects.
    The reason we set INSTALL_FREETYPE is avoiding Path related issues, if you wont check that option you need to add Freetype to your path also.
  • Now after you press generate close the window, open a command prompt in your build folder and type;
    `mingw32-make.exe` note that it could take hours to build you can specify allowed jobs at once with -“jN” where N is the job number, infinite jobs only with “-j” but this generally breaks the progress.
  • After every target is built, type `mingw32-make.exe install` it will install the respective files to INSTALL_DIR specified in cmake.
  • Now open your environment variables window (Demonstrated in installing mingw, look above) and add “C:\Dev\OpenCASCADE\OpenCASCADEv740\win64\gcc\bin”  to system path, (this is the path where your opencascade bin folder if installation dir differs this differs too).
  • Now open a command prompt and type ““DRAWEXE” without any extension. If it works OpenCASCADE installed successfully.

Leave a Reply