Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

Click the above “Mechanical and Electronic Engineering Technology” to follow us

1. Introduction

The Open CASCADE (OCC) platform is a CAD/CAE/CAM software platform developed by the French company Matra Datavision, and it is one of the most important geometric modeling software platforms in the world. The open-source OCC object library is an object-oriented C++ library designed for the rapid development of professional applications in the design field. OCC is primarily used for developing two-dimensional and three-dimensional geometric modeling applications, including general or specialized computer-aided design (CAD) systems, applications in manufacturing or analysis, simulation applications, or graphical presentation tools. OCC provides six modules through an organically organized C++ library file. The visualization module, as the core part of OCC, embodies the visualization technology.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

2. Download

2.1 Download Visual Studio 2022 Community

https://visualstudio.microsoft.com/en-us/vs/

2.2 Download CMake Tool

https://cmake.org/download/, just select the latest version

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

2.3 Download Source Code

https://dev.opencascade.org/release, download version 7.7.0 from the official website

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

2.4 Download Third-Party Plugins

https://dev.opencascade.org/resources/download/3rd-party-components, download third-party plugins from the official website, at least download the three dependency packages: freeimage-3.17.0-vc14-64, freetype-2.5.5-vc14-64, tcltk-86-64.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

Finally, unzip the source code into a directory, create a folder named 3rdparty for the unzipped dependency packages, and create two additional folders named build and install in that directory.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

3. Installation

3.1 Install Visual Studio 2022 Community

Select C++ Desktop Development, ensure that MSVC, Windows 10 SDK, and C++ CMake tools are checked, and select the rest as needed. Modify the installation location as necessary and proceed with the installation.

3.2 Install CMake

Install with default options.

4. Compile Source Code

Open the CMake tool and first configure the OCC source location and the temporary build directory.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

Then click Configure, select “Visual Studio 17 2022”, and choose X64 for compilation.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

Next, configure the CMake options for 3RDPARTY_DIR to point to the 3rdparty directory where the dependencies are placed, and set INSTALL_DIR to the install directory.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

After configuring, click Configure again, then click Generate, and finally click Open Project.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

This will automatically open Visual Studio. Right-click on the solution and build the solution to start the build process.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

Now comes the long wait.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

Once you see that the build is successful and there are no errors, you are done.

Then right-click on INSTALL in the solution explorer, click build, and execute make install. This will install the compiled files into the specified install directory.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

5. Testing

The build is now complete, and you can run DRAWEXE to test if the functionality is working properly.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

Right-click on DRAWEXE in the dropdown menu and set it as the startup project, then press CTRL+F5 to execute. You can test the DRAWEXE command in the opened command window.

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

References

https://dev.opencascade.org/doc/overview/html/build_upgrade__building_occt.html

Learning Open CASCADE | Compiling Source Code Based on Visual Studio 2022

To learn more

Quickly scan the code to follow

Leave a Comment