VR-Engage  2.3
Loading...
Searching...
No Matches
Environment Setup & Build Guide

This page describes the installed toolkit examples build, not the developer-tree build. Use the scripts and CMake files supplied with the matching toolkit.

Prerequisites

Development environment requirements

Use Visual Studio 2022 with the C++ desktop workload, MSVC v143, and x64 support. The maintained solution-generation script selects the "Visual Studio 17 2022" generator; that generator uses v143 by default. CMake must be available on the command-line PATH.

Use CMake 3.21 or newer for this Visual Studio generator, as documented in the CMake Visual Studio 2022 generator reference. The example scripts' older CMake 3.16 prerequisite comment does not account for the selected generator. The examples CMake project selects C++14 and the RelWithDebInfo configuration. The root developer-tree CMake project has its own requirements; do not substitute this examples workflow for it.

Required and optional toolkits

Install compatible VR-Engage, VR-Forces, VR-Link, MAK RTI, and Qt development packages. Headers alone are insufficient: the examples also use toolkit libraries and runtime dependencies. Keep SDK versions and architecture consistent with the VR-Engage installation being extended.

The CIGI toolkit is optional for the general examples solution, but is needed when building the CIGI Host Extension example. The generator enables/disables that group through BUILD_CIGI_EXAMPLES.

Required environment variables

The solution-generation script validates MAK_VRFDIR, MAK_VRLDIR, MAK_RTIDIR, and QTDIR. MAK_CIGIDIR is optional; its availability controls the CIGI examples option. examples/CMakeLists.txt computes MAK_VREDIR from the parent of the examples directory.

Edit examples/setupEnv.bat for the actual compatible installations. Its shipped paths are template values, not recommended versions for every VR-Engage release. The generation script calls that file when present; otherwise it uses the existing environment. CMake caches the dependency paths, so review the cache when changing installations.

Variable Purpose
MAK_VRFDIR VR-Forces development installation
MAK_VRLDIR VR-Link development installation
MAK_RTIDIR MAK RTI development installation
QTDIR Qt development installation used by the examples
MAK_CIGIDIR Optional CIGI development installation
MAK_VREDIR Computed by the examples CMake from its parent directory

Run batch commands from a Windows command prompt, preferably a Visual Studio developer command prompt. The solution generator calls setupEnv.bat in its own command environment. Calling a batch file from PowerShell does not import its environment changes back into the PowerShell session.

Understanding plugin types and installation

Plugin types

Frontend plugins add Player Station components, UI, and input handling. Examples include notification, playerStateAttribute, and vehicleBlinkerFrontend. Simulation plugins add backend actuators, sensors, or other entity behavior. Examples include vehicleBlinkerSim and customProjectile. Shared libraries hold common messages or utilities used by their consumers. customPdu/commentMessage and entityDetection/entityDetectionShared show this pattern.

Frontend plugins normally install beneath plugins64/vrEngage/release. Simulation plugins normally install beneath plugins64/vrForces/release. Shared runtime libraries install to bin64. The exact output filename comes from each target's OUTPUT_NAME.

For example, the notification target produces exampleNotification, and the shared Comment target produces exampleCommentMessage. Do not look for unprefixed notification.dll or commentMessage.dll based only on the CMake target name. See Plugin Architecture for loader configuration and exports.

Installation directory structure

The maintained example output names and destinations include:

Installed path, relative to the VR-Engage root Contents
bin64/exampleCommentMessage.dll Shared Comment message library
plugins64/vrEngage/release/exampleNotification.dll Notification frontend module
plugins64/vrEngage/release/exampleVehicleBlinkerFrontend.dll Blinker frontend module
plugins64/vrForces/release/exampleVehicleBlinkerSim.dll Blinker simulation module
plugins64/vrForces/release/exampleCustomProjectile.dll Custom Projectile simulation module
appData/plugins/ Enabled simulation plugin records
data/simulationModelSets/examples/ Example model sets, roles, and input data

These filenames come from the corresponding maintained target CMake files. A target name, output filename, and runtime plugin record are distinct things. The install destination does not automatically append the release subdirectory. VR-Vantage/network plugins can have additional protocol-specific destinations; use their project's own rules.

Building the examples

1. Environment configuration

Locate the installed toolkit's examples directory and edit its setupEnv.bat. Set each variable to the compatible development installation on that machine. Do not copy another developer's paths or assume the template's product-version names match your release.

Before generation, confirm those paths contain the expected include, lib64, and runtime directories. The generator reports unset variables and nonexistent installation paths before invoking CMake. If MAK_CIGIDIR is absent or invalid, the CIGI example group is disabled rather than treated as a required dependency for every example.

2. Generate the example projects and solution

From the installed toolkit's examples directory, run the maintained generator:

buildExampleSolution.bat

Source: examples/buildExampleSolution.bat. The script validates dependency directories, creates/enters build, and runs the Visual Studio CMake generator. The project name in examples/CMakeLists.txt is Examples, so the generated solution is examples\build\Examples.sln, not VR-Engage-Examples.sln.

Generation produces project files; it does not compile the examples. Re-run the script when changing the enabled example groups or adding/removing subdirectories. Keep the script's dependency checks rather than bypassing them with an unrelated developer-tree build.

3. Build and install

  1. Open build\Examples.sln in Visual Studio 2022.
  2. Select the x64 RelWithDebInfo configuration.
  3. Build the solution for the initial enabled example set.
  4. Use the INSTALL project to deploy the resulting runtime files.

The root examples CMake sets CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD, so the default solution build includes the INSTALL project. Installation rules can reference every enabled target; do not assume a full install works when those outputs have never been built.

From the generated examples\build directory, the equivalent CMake commands are:

cmake --build . --config RelWithDebInfo
cmake --install . --config RelWithDebInfo

The first command compiles; the second executes the generated installation rules. Installation must be able to write to the toolkit directories selected by the project. Do not substitute Debug or assume the example solution exposes the developer tree's Unoptimized configuration: its CMAKE_CONFIGURATION_TYPES is explicitly RelWithDebInfo.

Use each target's actual CMake install destinations. For the notification module, the maintained rule is:

# Source: examples/notification/CMakeLists.txt
install(TARGETS notification
RUNTIME DESTINATION ${MAK_VREDIR}/plugins64/vrEngage/release
LIBRARY DESTINATION ${MAK_VREDIR}/plugins64/vrEngage/release
)

Confirm the deployed output matches the target's filename and directory. Frontend discovery uses the configured directory; backend loading also needs a valid enabled plugin record. The loader's current diagnostics use vreUtil/logger.h; do not assume a fixed log filename or directory independent of application logging configuration.

4. Verify installation

Check the target's actual OUTPUT_NAME, destination, and output timestamp. For a frontend module, confirm it is in the effective frontend plugin directory and exports the expected C-linkage hook. For a simulation module, confirm the applicable XML record is enabled and selects the installed DLL for the active configuration. Shared DLLs must be reachable by every consumer process.

Then exercise the example's documented scenario or role:

  1. Launch the intended frontend/backend configuration.
  2. Select the example's model set and required role.
  3. Check component initialization and the relevant input/UI/simulation behavior.
  4. Inspect actual application diagnostics for loading, registration, or configuration failures.

Building and copying a DLL does not by itself install the role, input files, UI assets, or plugin record. The example's README and CMake/data configuration specify those additional prerequisites.

Debugging shortcuts

examples/CMakeLists.txt defines VREngageDebug, VRForcesVREngageDISLocalhost, and VRForcesVREngageHLA. The first launches VR-Engage from its installation. The other targets use generated batch files under examples/batchFiles with matching exercise connection names. They are Visual Studio debugging targets, not DLL plugins.

Shortcut Launch and intended use
VREngageDebug VR-Engage from ${MAK_VREDIR}/bin64; useful for frontend/ownship examples
VRForcesVREngageDISLocalhost VR-Forces launcher and VR-Engage with "DIS (7) localhost"
VRForcesVREngageHLA VR-Forces launcher and VR-Engage with "HLA 1516 Evolved"

The projects are grouped under Shortcuts in Solution Explorer. Right-click the desired project and select Debug > Start New Instance. They use VS_DEBUGGER_COMMAND and VS_DEBUGGER_WORKING_DIRECTORY; they are not new network configurations created by the plugin. The named exercise connections must exist in the compatible installed settings.

The actual VR-Engage-only target configuration is:

# Source: examples/CMakeLists.txt
add_custom_target(VREngageDebug DEPENDS ALL_BUILD)
set_target_properties(VREngageDebug PROPERTIES
VS_DEBUGGER_COMMAND ${MAK_VREDIR}/bin64/vrEngage.exe
VS_DEBUGGER_WORKING_DIRECTORY ${MAK_VREDIR}/bin64
FOLDER "Shortcuts"
)

The DIS/HLA batch files launch the VR-Forces launcher and VR-Engage with the configured connection names. The names must exist in the installed connection settings.

Iterative development workflow

Initial setup

Build the enabled example set once before relying on the whole INSTALL project. Its installation rules reference outputs from the enabled subprojects, including shared libraries. An unrelated enabled example that has never been built can therefore prevent a whole install from completing.

Working on individual examples

For Visual Studio, build the selected example project, then run INSTALL with the required enabled outputs present. For a command-line iteration from examples\build, use:

cmake --build . --config RelWithDebInfo --target notification
cmake --install . --config RelWithDebInfo

Related targets can be selected together:

cmake --build . --config RelWithDebInfo --target notification inputDevice
cmake --install . --config RelWithDebInfo

The targets in these commands are defined by the maintained examples/CMakeLists.txt. The install command still runs the enabled installation rules; it is not automatically limited to the target named in the preceding build command.

When to regenerate or rebuild

Build the affected example target after source changes, then deploy its current output using the maintained installation workflow. A whole install still needs outputs from all enabled targets. Changing scripts, dependencies, or subdirectories can need CMake regeneration. Keep architecture, SDK versions, compiler toolset, and library configuration consistent.

Regenerate after changing CMake target definitions, dependency paths, or enabled subdirectories. Changing source within an existing target normally needs that target rebuilt rather than a new solution. If public interfaces or a shared library change, rebuild the affected consumers too. Use a clean rebuild when diagnosing stale binaries or incompatible cached configuration, not as a substitute for checking the actual dependency and installation paths.

Development practices

Keep a representative role/scenario for the feature being changed, and deploy the matching data alongside the module. Check the installed DLL rather than only the build-directory copy when the application still appears to run old code. Keep diagnostics useful and bounded; the current LOG_* API is described in Toolkit Fundamentals.

Understanding the build system

CMake structure

The examples root coordinates the individual plugin projects:

Path under examples Role
CMakeLists.txt Root project, dependency variables, subdirectories, and launch shortcuts
utilities.cmake Helper functions used by the subprojects
setupEnv.bat Machine-specific toolkit environment setup
buildExampleSolution.bat Windows solution generation
batchFiles/vrfVreDISLocalhost.bat Generated DIS launch shortcut
batchFiles/vrfVreHLA.bat Generated HLA launch shortcut
notification/CMakeLists.txt Maintained frontend module example
vehicleBlinker/vehicleBlinkerSim/CMakeLists.txt Maintained simulation module example
customPdu/commentMessage/CMakeLists.txt Maintained shared message library example

The root examples/CMakeLists.txt includes examples/utilities.cmake and adds maintained example subdirectories. The utility file provides source collection, include/link-directory helpers, library linking, compiler definitions, message generation, and batch-file generation. It does not define libraries named vrEngageFramework or utilities.

For a new project, start from a maintained project of the same plugin type. Frontend examples include notification, qmlHud, and playerStateAttribute. Backend examples include vehicleBlinker/vehicleBlinkerSim and customProjectile. Shared-message examples include customPdu/commentMessage. Preserve their include roots, export definitions, dependencies, and installation configuration.

Debugging shortcuts implementation

The generated DIS shortcut and its Visual Studio target are configured this way:

# Source: examples/CMakeLists.txt (target excerpt)
GenerateBatchFile(vrfVreDISLocalhost.bat ${BATCH_FILES_DIR} "${disArguments}")
add_custom_target(VRForcesVREngageDISLocalhost DEPENDS ALL_BUILD)
set_target_properties(VRForcesVREngageDISLocalhost PROPERTIES
VS_DEBUGGER_COMMAND ${BATCH_FILES_DIR}/vrfVreDISLocalhost.bat
VS_DEBUGGER_WORKING_DIRECTORY ${MAK_VREDIR}/bin64
FOLDER "Shortcuts"
)

The surrounding file defines BATCH_FILES_DIR and builds disArguments from the VR-Forces and VR-Engage working directories and connection arguments. The HLA target follows the same pattern with its maintained HLA connection name. Retain the working-directory setup when adapting these shortcuts; relative runtime paths depend on it.

Per-example debugging configuration

The notification example supplies actual startup properties:

# Source: examples/notification/CMakeLists.txt
set_target_properties(notification PROPERTIES
OUTPUT_NAME "exampleNotification"
FOLDER "Examples"
VS_DEBUGGER_COMMAND ${MAK_VREDIR}/bin64/vrEngage.exe
VS_DEBUGGER_WORKING_DIRECTORY ${MAK_VREDIR}/bin64
VS_DEBUGGER_COMMAND_ARGUMENTS "-c -n 3 --setting \"playerStationApp.defaultSimulationModelSets = {'${MAK_VREDIR}/data/simulationModelSets/examples/notification.sms'};\""
)

The role/model-set data and registered component must also be installed. Selecting a model set does not guarantee that an arbitrary scenario or component is already available.

This enables Debug > Start New Instance on the example project with its own startup configuration. The actual argument string supplies a console request (-c), notification level (-n 3), and the playerStationApp.defaultSimulationModelSets override. The chosen model set is not an automatic replacement for the example's scenario/role prerequisites.

Use this approach when an example needs its own installed .sms file or application settings. For general debugging without example-specific startup properties, use the maintained shortcut targets. If adapting it, replace the model-set path with the project's actual installed data path.

Creating your own plugin

Start with a project of the same extension type, not an empty generic library list:

Extension Maintained starting point Key consideration
Frontend component notification or playerStateAttribute Creator registration, role data, frontend lifecycle
Simulation component vehicleBlinker/vehicleBlinkerSim Component/descriptor factories, system data, plugin record
Shared message library customPdu/commentMessage Export definitions, generation, consumer links and deployment
Frontend/backend messages entityDetection Shared schemas and both transport consumers

Keep entry points lightweight and keep reusable runtime behavior in the appropriate library. See Plugin Architecture for current signatures, lifecycle, and ownership.

Key CMake conventions

The existing projects provide the following conventions:

  1. Include utilities.cmake from the root examples project.
  2. Create a MODULE target for a plugin, or SHARED for a common runtime library.
  3. Set TARGET where the maintained helper calls use that variable.
  4. Set OUTPUT_NAME, IDE folder, and debugger properties independently of the target name.
  5. Supply the actual toolkit include roots and import-library directories.
  6. Link every library needed by the target's declarations and implementation.
  7. Apply the target's export definitions and platform/protocol definitions.
  8. Install to the complete runtime destination, including the required build subdirectory.

The notification project begins with:

# Source: examples/notification/CMakeLists.txt (target setup excerpt)
add_library(notification MODULE)
set(TARGET notification)
AddAllSource(${TARGET})

Its include roots include ${MAK_VREDIR}/include/framework, ${MAK_VREDIR}/include/utilities, and the role/common-role include areas it uses. These make includes such as vrePlayerStation/playerStationApp.h resolvable. Its actual link list is:

# Source: examples/notification/CMakeLists.txt
AddLibrariesToLinkWith(${TARGET}
vreUtil
vrfmodel
vrfobjcore
vrfobjparam
vrfSimCore
vrfmsgs
vrftasks
vrfutil
readerWriter
vlutil
matrix
vrfMsgTransport
vl
vrvCore
vreMessageManager
vreMessages
vrePlayerStation
vreCommonComponents
vreHumanFrontend
vrvVirtualReality
vrvVirtualRealityController
Qt5Core
Qt5Quick)

Use the full maintained file when adapting the target; these excerpts are not a complete build definition. The helper names are CMake functions, not libraries to link as utilities or vrEngageFramework.

Adding your plugin to the build

Create its subdirectory and CMake file, then add it to the root examples project's subdirectory list. The maintained root already includes:

# Source: examples/CMakeLists.txt (subdirectory excerpt)
add_subdirectory(notification)
add_subdirectory(playerStateAttribute)
add_subdirectory(qmlHud)

Add the equivalent entry for the actual new directory and re-run the generator. Keep private additions separate from the stock examples when maintaining a customer project. Do not re-enable retired examples merely because their source directory remains in the repository.

Message code generation

generateMessages() is defined in examples/utilities.cmake. Its six required parameters are target, schema directory, namespace, export macro, export header, and generated-header include prefix. Optional arguments choose header/source output directories. Use the existing helper; do not manually edit generated message headers.

The maintained Comment library invokes it as follows:

# Source: examples/customPdu/commentMessage/CMakeLists.txt
generateMessages(${TARGET} ${CMAKE_CURRENT_SOURCE_DIR} makVre EXAMPLEMESSAGE_DLL "${CMAKE_CURRENT_SOURCE_DIR}/export.h" ${CMAKE_CURRENT_SOURCE_DIR})

The same CMake file creates target commentMessage, sets output name exampleCommentMessage, collects generated/source files, and applies COMMENTMESSAGE_EXPORTS.

Required and optional parameters

Parameter Meaning
target Target whose source list receives the generated files
path Directory searched for message-schema .lua files
namespace Generated C++ namespace, makVre in the maintained examples
exportMacro Macro applied to generated public declarations
exportInclude Header defining that export/import macro
headerIncPath Include prefix passed to the code generator
Optional headerPath Generated-header output directory; defaults to path
Optional sourcePath Generated-source output directory; defaults to path

The helper checks MESSAGE_CODE_GEN and the schema directory's files. It discovers generated outputs and supplies a regeneration command for the schema dependencies. Inspect its warnings when the generator is missing or fails; a skipped generation step is not proof that the expected message header exists.

Complete shared message build example

The following is the maintained Comment target, with only comments and a status print removed. It retains source collection, include/link roots, dependencies, export definitions, and installation:

# Source: examples/customPdu/commentMessage/CMakeLists.txt
add_library(commentMessage SHARED)
set(TARGET commentMessage)
set_target_properties(commentMessage PROPERTIES
OUTPUT_NAME "exampleCommentMessage"
FOLDER "Examples/CustomPdu"
)
AddIncludeDirectories(${TARGET}
${CMAKE_CURRENT_SOURCE_DIR}
${MAK_VRFDIR}/include
${MAK_VRLDIR}/include
${MAK_VREDIR}/include
${MAK_VREDIR}/include/framework
${MAK_VREDIR}/include/utilities
${CMAKE_SOURCE_DIR}/examples/customPdu
)
AddLinkDirectories(${TARGET}
${MAK_VRLDIR}/lib64
${MAK_VREDIR}/lib64
${MAK_VRFDIR}/lib64
)
generateMessages(${TARGET} ${CMAKE_CURRENT_SOURCE_DIR} makVre EXAMPLEMESSAGE_DLL "${CMAKE_CURRENT_SOURCE_DIR}/export.h" ${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/*.cxx
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/*.h
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp
)
file(GLOB LUA_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.lua)
set_source_files_properties(${LUA_SOURCES} PROPERTIES HEADER_FILE_ONLY TRUE)
if(SOURCES)
target_sources(${TARGET} PRIVATE ${SOURCES})
endif()
if(LUA_SOURCES)
target_sources(${TARGET} PRIVATE ${LUA_SOURCES})
source_group("LUA Files" FILES ${LUA_SOURCES})
endif()
AddLibrariesToLinkWith(${TARGET}
vl
readerWriter
matrix
vlutil
mtl
vrvCore
vrvUtil
vreUtil
vreMessageManager
)
AddCompilerDefinitions(${TARGET} ${BOOST_COMPILER_DEFINITIONS} -DWIN32 -D_WINDOWS -D_WIN32_WINNT=0x0601 -DNOMINMAX -DDT_DLL_BUILD -DDT_USE_DLL -DCOMMENTMESSAGE_EXPORTS)
install(TARGETS commentMessage
RUNTIME DESTINATION ${MAK_VREDIR}/bin64
LIBRARY DESTINATION ${MAK_VREDIR}/lib64
)

Its export header supplies the matching macro:

// Source: examples/customPdu/commentMessage/export.h
#pragma once
#ifdef _WIN32
#ifdef COMMENTMESSAGE_EXPORTS
#define EXAMPLEMESSAGE_DLL __declspec(dllexport)
#else
#define EXAMPLEMESSAGE_DLL __declspec(dllimport)
#endif
#else
#define EXAMPLEMESSAGE_DLL
#endif

Generated output

Each schema's fileName identifies its generated header and C++ source. For comment.lua, those files are commentMessage.h and commentMessage.cpp; its className produces makVre::CommentMessage. Generated messages provide create(), typed field accessors, serialization/deserialization, and message-factory registration. The standard generated interface also exposes theType(), theId(), createFromData(), and getData().

Consumers include the generated header and link the message library. For example, the Comment network connector uses the generated sender, receiver, and comment accessors when converting a message to a VR-Link Comment interaction. The shared schema does not automatically send that interaction; the connector supplies the transport.

If a generated header is absent in a clean source tree, verify the generator and schema step before adding handwritten replacements. The generated definitions are derived files; change the Lua schema and regenerate rather than editing an accessor or serialized layout in its .h/.cpp.

See Custom PDU for the message library and network consumer, and Entity Detection for a shared library with frontend/backend consumers.

The root examples CMake searches compatible toolkit bin64 directories for messageCodeGen-cxx. The helper reports missing generator/schema files. Generation is performed by the configured workflow, not by declaring a class in guide prose. See Inter-Process Communication for the real Lua schema.

Environment variables used by CMake

The root examples project reads and caches the toolkit variables listed under prerequisites. MAK_VREDIR is computed from the examples location; the others come from the environment. Review the cached values when switching toolkit installations.

The Visual Studio generator is multi-configuration. The project forces CMAKE_CONFIGURATION_TYPES to RelWithDebInfo; setting CMAKE_BUILD_TYPE in the shell is not a substitute for selecting that Visual Studio configuration or supplying --config RelWithDebInfo.

Troubleshooting common issues

Environment variable problems

Check validated dependency directories and cached paths when CMake cannot find headers/libraries. The generator's preflight checks distinguish an unset variable from a directory that does not exist. Check the setupEnv.bat beside the generator, then the CMake cache populated from that environment. Correcting the shell variable alone may leave the old cached path in use.

Compiler toolset issues

Check SDK/toolset/configuration compatibility for compilation/link failures. Install the Visual Studio C++ workload and confirm the generator can find the intended VS 2022 instance. Use an x64 build with compatible toolkit libraries. Do not mix a dependency from an unrelated toolkit installation merely because its filename is similar.

Library linking problems

An unresolved symbol can indicate a missing link dependency, incorrect import-library path, export definition mismatch, or incompatible library version. Check the maintained project's AddLibrariesToLinkWith() and export header before adding arbitrary libraries. Successful compilation proves the headers were found; it does not prove the required implementation was linked.

Plugin loading issues

For a DLL that does not load, check its output name, install destination, exports, dependencies, and applicable backend plugin record. Use actual diagnostics from the configured application; example log transcripts are not prescribed output. Check the installed binary's timestamp and actual dependencies when a rebuilt project still appears unchanged. For a frontend module, check the export declarations and configured frontend directory. For a simulation module, check the record's application/platform/build/transport selectors and myLoad. For a shared message library, check both consumer deployment locations when the processes use different roots.

See also