Objective
This article and its attachments provide CMake* guidance to create Intel® Rendering Toolkit (Render Kit) based software projects. Download and review CMakeLists
files to build programs with Microsoft Visual Studio* or the GNU* compiler. These downloads assist in using tutorial sources located on the public repositories for Render Kit components with the Intel® oneAPI distribution.
Recommended: Render Kit getting started guide users (Linux* OS, Windows* OS) who are experienced with CMake usage can download CMakeLists files through the attachment and skip this article.
See table at bottom of page for downloads.
Toolkit Provisions
Typical installs of the toolkit are located underneath C:\Program Files (x86)\inteloneapi
or /opt/intel/inteloneapi
.
In this administrator privileged area, the Render Kit stages three types of components required to build a Render Kit program: Header files for source inclusion, link time libraries, and runtime libraries.
A CMake configuration file is also included on disk for the Intel® Embree and Intel® OSPRay components of the toolkit. Referencing these configuration files within CMakeLists.txt
makes incorporating build requirements for including these libraries easier. Use these files as inspiration for developing your own projects. See embree-config.cmake
and osprayConfig.cmake
included in the install.
What Does the CMake Configuration Provide?
Short answer: The CMake configuration files provide a quicker start to focus on your application and the APIs it uses, as opposed to build requirements.
Details:
Scaffolding each of these requirements into a user build system may not be scalable nor clear. A CMake configuration file is used to simplify this. A CMake configuration file allows you to target different development environments and program build environments. The developer has the CMake provision of a generator to create scaffolding for different build systems.
Such configuration files used for generation can be dense for new users. So, the training sample attachment is basic from a feature standpoint and complexity standpoint.
Our walk-through guide with this CMake file uses the generator for "Visual Studio 15 2017 Win64"
on Windows OS. This generator creates corresponding solution .sln and project .proj files for the Visual Studio 2017 IDE. These files are generated with the required references for the Render Kit's Intel OSPRay or Intel Embree. This avoids much manual project setup. For Visual Studio*, you can build the generated solutions through the command line interface with CMake or review them in the IDE.
On Linux OS, no generator is indicated. The CMake file uses the default Unix* Makefile generator.
You can also use a different generator (runcmake --help
from the command line to see all available generators). Try -G"Visual Studio 14 2015 Win64"
or -G"Visual Studio 16 2019" -A x64
for alternate versions of Visual Studio*. Consider alternate generators from other environments at your discretion.
Intel® OSPRay
The Intel® OSPRay CMakeLists.txt
training file is configured for both C and C++ target executables. The example expects you to deploy it in the the user home directory, as it does not have administrator privileges to stage, build, and execute the programs. On Windows, the user home directory is %USERPROFILE%
, on Linux, it is ${HOME}
.
For the generation step on Windows OS, we use:
mkdir build
cd build
REM 2017
cmake -G"Visual Studio 15 2017 Win64" ..
REM 2019
cmake -G"Visual Studio 16 2019" -A x64 ..
For the generation step on Linux OS, we use:
mkdir build
cd build
cmake ..
Note: Generation in the build
directory reference is to not pollute our other directories with our build.
Intel® Embree
The Intel® Embree CMakeLists training file configures a suite of tutorial target executables. The example expects you to deploy it in the the user home directory, as it does not have administrator privileges to stage, build, and execute the programs. On Windows, the user home directory is %USERPROFILE%
, on Linux, it is ${HOME}
.
For the generation step on Windows OS, we use:
mkdir build
cd build
REM 2017
cmake -G"Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX=%USERPROFILE%\oneapi_renderkit_tutorial\embree -DCMAKE_TOOLCHAIN_FILE=C:/Users/<username>/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release ..
REM 2019
cmake -G"Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=%USERPROFILE%\oneapi_renderkit_tutorial\embree -DCMAKE_TOOLCHAIN_FILE=C:/Users/<username>/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
For the generation step on Linux OS, we use:
mkdir build
cd build
#Generate
cmake -DCMAKE_INSTALL_PREFIX=~/oneapi_renderkit_tutorial/embree -DCMAKE_BUILD_TYPE=Release ..
Note: Generation in the build
directory reference is to not pollute our other directories with our build.
Run-Time Dependencies
If you need help with run-time dependencies, refer to the Ubuntu_embree_advanced_package_dependencies.txt
library manifest. See it with the article Download button.