Hide menu
Loading...
Searching...
No Matches
Building C++ Examples

C++ examples are located in the subfolder examples/cxx.

Note
Save the license key file you received for your evaluation program as ${install_dir}/examples/cxx/cadex_license.cxx. When you become a customer you will substitute it with a commercial license key.

Building

C++ examples are provided with cmake-based configuration files. To build examples download the cmake tool from cmake.org.

Building with Microsoft Visual Studio on Windows

The following video explains how to generate Microsoft Visual Studio projects for C++ examples:

To build C++ examples open cmake-gui, choose the example's subdirectory, choose build directory and press "Configure" button.

Next specify required Visual Studio version (e.g. Visual Studio 15 2017 Win64).

When configuring has been done press "Generate" button.

This will create Visual Studio project and solution files in the build subdirectory.

Note
For building Qt-based examples set QT_ROOT_DIR entry to Qt 5 installation folder and reconfigure project again.

Building with GNU Makefiles

On Linux or MacOS, to build an example with the help of GNU make, use respective generator with cmake:

cd /dev/cadexchanger/3.20.0/examples/cxx/
mkdir build
cmake -H. -Bbuild -G "Unix Makefiles"
cmake --build build
Note
To get the list of supported generators invoke cmake --help.
To build a debug configuration add the switch -DCMAKE_BUILD_TYPE=Debug.
For building Qt-based examples add the switch -DQT_ROOT_DIR=<path_to_qt_directory>

To run built examples, you should add the path to CAD Exchanger dynamic libraries directory to the environment variable LD_LIBRARY_PATH on Linux and DYLD_LIBRARY_PATH on MacOS.

Note
Pay attention that you need to set respective directories depending on your particular configuration, including target architecture (x86 or x64), compiler (e.g. gcc4 or clang7), and mode (release or debug). Refer to Setting up development environment for detailed descriptions of subfolders.

Recommended compiler options

CAD Exchanger SDK should work out of the box with the standard compiler options. Exception support should be enabled to ensure their proper handling (/EHa or /EHsc flags in MSVC, -fexceptions in Clang and GCC).