Manual Compilation via SCons
Using SCons you can re-build the UNIGINE Engine and its components (standalone tools, plugins, API samples) as well as binary executable of a custom application. It reads the default compilation settings stored in SConstruct and SConscript files which are provided in the UNIGINE SDK.
SCons allows cross-platform building: you can build the engine, tools and applications on both Windows and Linux. The build scripts are implemented in Python.
Building with SCons
You should properly set the development environment to build with SCons.
To build the development version of the UNIGINE Engine, its tools or a custom application (the same bitness as the native platform) via SCons, perform the following steps:
- Specify the SCONSFLAGS environment variable with -Q and -u options to avoid typing them by hand every time:
- -Q to suppress SCons status messages (except commands that are executed to rebuild files). This is optional.
- -u to search up the folder structure until an SConstruct file is found and build components at or below the current folder.
- In the command prompt, go to the <UnigineSDK>/source directory which contains an SConstruct file.
- Type scons and press ENTER to start building. If necessary, you can specify components and/or compilation options.
By default, the compiled UNIGINE Engine library is built with single precision coordinates support and the native platform bitness. On Windows, SCons will detect and build with the highest version of the installed Visual Studio toolset.
C:\Windows\system32>c: C:\Windows\system32>cd c:\UnigineSDK\source C:\UnigineSDK\source>scons
To build the debug version of the UNIGINE Engine, tools or an application for a native platform, you should type scons debug=1. For example:
C:\UnigineSDK\source\>scons debug=1
Compilation Options
When building with SCons, the available options are the following:
- bits BITS - bitness of the target platform. Possible values are:
- default - version with the same bitness as the platform that SCons is currently run on. This is a default option.
- x86 - 32-bit version
- x64 - 64-bit version
- vs VS - Visual Studio toolset to build with. Possible values are:
- default - Visual Studio version is detected by SCons as highest.
- 2013 - VS 2013 (12.0)
- 2015 - VS 2015 (14.0)
- 2017 - VS 2017 (14.1). For the Visual Studio 2017 to be detected in OS, SCons 3.0 or higher is required.
- debug - generate detailed debug information. Possible values are: 1 to build the development version, 0 to build the release version (by default).
- half_texcoords - build with half float texture coordinates. Possible values are: 1 (by default), 0.
- double - build with double precision coordinates (for large coordinates support). Possible values are: 1, 0 (by default).
- jobs JOBS - the number of parallel building jobs to be run. Possible values are: all, 1, 2, 3, 4, 6, 8, 16. The default is all.
- simd SIMD - perform parallel compilation using the SIMD operations. Possible values are:
- default - use Streaming SIMD Extensions 2 technology (Intel SIMD). This is the default value.
- none - do not use SIMD
- sse - use Streaming SIMD Extensions technology
- sse2 - use Streaming SIMD Extensions 2 technology (Intel SIMD)
- avx - use AVX
To create the 32-bit version of the UNIGINE Engine library that supports double precision coordinates, use the following:
C:\UnigineSDK\source\>scons bits=x86 double=1
Renderer Options
If your application is not targeting different platforms at once, it is possible to exclude all information about non-used renderers from the Unigine library and thus decrease its size.
Sound Options
- openal - include OpenAL sound support. The default is 1.
Computing Options
- cuda - include CUDA support. The default is 0.
- opencl - include OpenCL support. The default is 0.
Other Options
- microprofile - use the third-party profiler with web integration. The default is 0.
- terminal - enable TELNET terminal. The default is 0.
- openexr - OpenEXR format. The default is 0.
- splash - load custom splash screen if required. The default is 0 (no custom splash screen).
- quadbuffer - NVidia QuadBuffer feature. Available for Sim SDK only. The default is 0.
- geodetic - Geodetic feature (support for 3D geoid model). Available for Sim SDK only. The default is 0.
Protection Options
- password - encrypt the build. The <UnigineSDK>/source/engine/password.resource file should be created by using the Resource tool before rebuilding.
Building Components
SCons allows building specific UNIGINE components, such as plugins, samples, and so on. The following components are available:
- engine - UNIGINE engine (both the binary executable and the library).
- main - main C++ application.
- main_sdl - SDL main application.
- csharp - C# libraries and main application.
- main_csharp - main C# application.
- samples - C++ API samples.
- cs_samples - C# API samples.
- plugins - all plugins. In the evaluation version of UNIGINE SDK, some plugins cannot be rebuilt.
- tools - all standalone tools.
For example:
- The debug version of plugins will be built by using the Visual Studio 2013 toolset.
scons vs=2013 debug=1 plugins
- The 32-bit C++ API samples will be built:
scons bits=32 samples
You can also build the specific sample, plugin or tool by passing its name. The name is case-insensitive. You can specify any number of components to build. For example:
scons Steam NodeTrigger usc