This document describes how to build Real-Sim FIXS from source. For general project information, see README.md.
- Quick Start
- Build System Overview
- Prerequisites
- Release Builds
- Development Builds
- Debug vs Release Configuration
- Build System Architecture
- Troubleshooting
For a complete release build of all components:
dispatch.batThis single command will:
- Build external libraries (yaml-cpp, libevent)
- Build core components (TrafficLayer, VirtualEnvironment)
- Build VISSIM driver model DLLs
- Build CarMaker executables for all detected versions
- Build dSPACE libraries (if dSPACE is installed)
- Build MEX files for MATLAB/Simulink
- Generate BUILD_INFO.txt
- Copy all artifacts to
build/directory
The Real-Sim FIXS build system uses a modular script-based architecture that automatically detects installed tools and versions. Key features:
- Automated tool detection: Automatically finds Visual Studio, MATLAB, dSPACE, and CarMaker installations
- Version management: Central
dependencies.yamlfile defines all tool versions and configurations - Modular scripts: Each subsystem has its own build script for independent development
- Intelligent configuration: Automatically generates CarMaker BuildConfig files based on detected tool versions
- Comprehensive logging: Detailed build logs in
scripts/dispatch/build.logandscripts/dispatch/build_summary.log
-
Visual Studio 2022 (Community, Professional, or Enterprise)
- Required for building all C++ components
- Must have C++ desktop development workload installed
- MSBuild must be in PATH (automatically detected by build scripts)
- C++ Standard: The project uses mixed C++ standards for compatibility:
- TrafficLayer: C++17 (uses
std::filesystemfor runtime library discovery) - All other components: C++14 (VirtualEnvironment, DriverModel, SC_DLL, CarMaker projects)
- C++14 is required for compatibility with CarMaker SDK and dSPACE toolchain
- TrafficLayer: C++17 (uses
-
CMake (version 3.10 or higher)
- Required for building external libraries (yaml-cpp, libevent)
- Must be in PATH
- Download from: https://cmake.org/download/
-
MATLAB/Simulink (version 2024a or compatible)
- Required for MEX file compilation and Simulink integration
- Automatically detected from registry or common installation paths
- Version can be configured in
dependencies.yaml
-
CarMaker (versions 13.1.3, 11.1.2, or compatible)
- Required for XIL/HIL vehicle dynamics integration
- Multiple versions can coexist
- Automatically detected from common installation paths
-
dSPACE ConfigurationDesk (version 2024a or compatible)
- Required for real-time HIL system integration
- Automatically detected from Program Files
- Version can be configured in
dependencies.yaml
The dependencies.yaml file in the root directory defines all tool versions and configurations:
simulators:
carmaker:
version: "13.1.3"
versions:
- "13.1.3"
- "11.1.2"
development_tools:
visual_studio:
version: "2022"
dspace:
version: "2024a"
product: "ConfigurationDesk 2024-A"
release: "24.1"
matlab:
version: "2024a"The build system reads this file to:
- Determine which CarMaker versions to build
- Generate version-specific BuildConfig files
- Locate correct tool installations
- Create version-specific output artifacts
A release build compiles all components and packages them into the build/ directory for distribution.
dispatch.batThe release build process executes the following steps:
-
External Libraries (
1_external_libraries.bat)- yaml-cpp (YAML configuration parser)
- libevent (not currently used, but available)
- Built in both Debug and Release configurations
- Output:
CommonLib/yaml-cpp/build/,CommonLib/libevent/build/
-
Core Components (
2_core_components.bat)TrafficLayer.exe- Main interface executableCoordMerge.exe- Coordinated merge controllerVirtualEnvironment.lib- Shared library for virtual environment integration- Output: Component directories + copied to
build/
-
VISSIM Components (
3_vissim_components.bat)DriverModel_RealSim.dll- VISSIM 2022 driver modelDriverModel_RealSim_v2021.dll- VISSIM 2021 driver model- Output:
ProprietaryFiles/VISSIMserver/+ copied tobuild/
-
CarMaker Components (
4a_carmaker_components.ps1)- Generates BuildConfig Python files for each CarMaker version
CarMaker.win64.exe- CarMaker Office executableslibcarmaker4sl.mexw64- CarMaker for Simulink MEX files- Built for each version in
dependencies.yaml(e.g., CM11, CM13) - Output:
CarMaker/CM*/+ copied tobuild/CarMaker/
-
dSPACE Libraries (
4b_carmaker_dspace.ps1) - OptionallibRealSimDsLib_2024a_CM*.a- Version-specific dSPACE libraries- Only built if dSPACE ConfigurationDesk is detected
- Built for each CarMaker version
- Output:
CommonLib/+ copied tobuild/CarMaker/
-
MEX RealSimSocket (
5_mex_realsim_socket.ps1) - OptionalRealSimSocket.mexw64- MATLAB interface for socket communication- Only built if MATLAB is detected
- Output:
CommonLib/+ copied tobuild/
-
Build Information (
6_build_info.ps1)- Generates
BUILD_INFO.txtwith version information - Lists all built components and their versions
- Output:
build/BUILD_INFO.txt
- Generates
After a successful release build, the build/ directory contains:
build/
├── BUILD_INFO.txt # Build metadata and versions
├── TrafficLayer.exe # Core interface
├── CoordMerge.exe # Controller
├── DriverModel_RealSim.dll # VISSIM 2022 interface
├── DriverModel_RealSim_v2021.dll # VISSIM 2021 interface
├── RealSimSocket.mexw64 # MATLAB MEX file
├── RealSim*.m # MATLAB helper scripts
├── CommonLib/ # Helper libraries and headers
│ ├── *.h # Header files
│ └── *.cpp # Source files (selective)
└── CarMaker/ # CarMaker components
├── CM11/ # CarMaker 11.1.2 build
│ ├── CarMaker.win64.exe
│ └── libcarmaker4sl.mexw64
├── CM13/ # CarMaker 13.1.3 build
│ ├── CarMaker.win64.exe
│ └── libcarmaker4sl.mexw64
└── libRealSimDsLib_*.a # dSPACE libraries (if built)
For active development, you can build individual components without running the full dispatch. This is faster and allows focused debugging.
Each component has its own build script in scripts/dispatch/:
scripts\dispatch\1_external_libraries.batBuilds yaml-cpp and libevent. Only needed once or after clean builds.
scripts\dispatch\2_core_components.batBuilds TrafficLayer.exe, CoordMerge.exe, VirtualEnvironment.lib. Run this when modifying core C++ code.
scripts\dispatch\3_vissim_components.batBuilds VISSIM driver model DLLs. Run this when modifying VISSIM interface code.
powershell -ExecutionPolicy Bypass -File scripts\dispatch\4a_carmaker_components.ps1Builds CarMaker executables. Automatically:
- Reads CarMaker versions from
dependencies.yaml - Generates BuildConfig Python files
- Builds for each detected version
- Run this when modifying CarMaker integration code
powershell -ExecutionPolicy Bypass -File scripts\dispatch\4b_carmaker_dspace.ps1Builds dSPACE libraries for CarMaker HIL integration. Run this when modifying dSPACE interface code.
powershell -ExecutionPolicy Bypass -File scripts\dispatch\5_mex_realsim_socket.ps1Builds MATLAB MEX file for socket communication. Run this when modifying MATLAB interface code.
Scenario 1: Modified TrafficLayer C++ code
scripts\dispatch\2_core_components.batScenario 2: Modified VISSIM driver model
scripts\dispatch\3_vissim_components.batScenario 3: Modified CarMaker User.c or integration
powershell -ExecutionPolicy Bypass -File scripts\dispatch\4a_carmaker_components.ps1Scenario 4: Testing full release package
dispatch.batThe build system supports both Debug and Release configurations.
Release builds are optimized for performance and distribution:
- Compiler optimizations enabled
- Debug symbols minimal or stripped
- Default for
dispatch.bat - Used for distributable builds in
build/directory
Debug builds include full debugging information:
- No compiler optimizations
- Full debug symbols
- Easier to debug with Visual Studio debugger
- Larger executable sizes
Edit scripts/dispatch/dispatch.bat line 17:
set "RS_BUILD_CONFIG=Debug"Each component script checks the RS_BUILD_CONFIG environment variable:
set RS_BUILD_CONFIG=Debug
scripts\dispatch\2_core_components.batOr pass configuration directly to msbuild:
msbuild TrafficLayer\TrafficLayer.sln /p:Configuration=Debug /p:Platform=x64External libraries (yaml-cpp, libevent) are built in both Debug and Release configurations automatically:
- Release:
yaml-cpp.lib,event.lib - Debug:
yaml-cppd.lib,eventd.lib
When building components in Debug mode, make sure to link against Debug libraries (yaml-cppd.lib).
scripts/dispatch/
├── dispatch.bat # Main orchestrator
├── detect_tool_paths.ps1 # Auto-detection of tools
├── yaml_helper.ps1 # Parse dependencies.yaml
├── 1_external_libraries.bat # Build yaml-cpp, libevent
├── 2_core_components.bat # Build TrafficLayer, VirtualEnvironment
├── 3_vissim_components.bat # Build VISSIM DLLs
├── 4a_carmaker_components.ps1 # Build CarMaker executables
├── 4b_carmaker_dspace.ps1 # Build dSPACE libraries
├── 5_mex_realsim_socket.ps1 # Build MATLAB MEX file
└── 6_build_info.ps1 # Generate BUILD_INFO.txt
The detect_tool_paths.ps1 script automatically locates installed tools:
Visual Studio Detection:
- Searches for VS 2022 (Community, Professional, Enterprise)
- Locates MSBuild.exe path
- Validates C++ workload installation
MATLAB Detection:
- Checks Windows registry:
HKLM:\SOFTWARE\MathWorks\MATLAB - Searches common installation paths
- Validates MEX compiler availability
- Prioritizes version from
dependencies.yaml
dSPACE Detection:
- Searches Program Files for ConfigurationDesk
- Locates version matching
dependencies.yaml - Finds DsBuildLibrary.mk for library compilation
CarMaker Detection:
- Searches Program Files for IPG installations
- Identifies available CarMaker versions
- Matches against versions in
dependencies.yaml
CarMaker builds require a BuildConfig Python file that specifies compiler settings, include paths, and library dependencies. The build system automatically generates these:
Process:
4a_carmaker_components.ps1readsdependencies.yaml- For each CarMaker version (e.g., 11.1.2, 13.1.3):
- Detects MATLAB version
- Locates CarMaker installation
- Generates
RS_CM{major}_{minor}_{patch}_BuildConfig_{matlab}.py
- BuildConfig files are created in
CarMaker/directory - CarMaker uses these during compilation
Generated BuildConfig Features:
- Correct MATLAB version paths
- RealSim-specific defines (
RS_DSPACE,RS_DEBUG) - Include paths for VirEnv_Wrapper.h
- Links to libRealSimDsLib_*.a (for dSPACE builds)
- Architecture-specific settings (dsrtlx, dsrt64)
Manual Modifications (Advanced): If you need custom BuildConfig settings, you can:
- Generate BuildConfig using the script
- Manually edit the generated Python file
- Re-run CarMaker build
Note: Re-running 4a_carmaker_components.ps1 will regenerate and overwrite custom changes.
Problem: CMake not found
'cmake' is not recognized as an internal or external command
Solution: Install CMake and add to PATH, or restart command prompt after CMake installation.
Problem: MSBuild not found
'msbuild' is not recognized as an internal or external command
Solution:
- Ensure Visual Studio 2022 is installed with C++ workload
- Build scripts should auto-detect MSBuild
- Manually add to PATH:
%ProgramFiles%\Microsoft Visual Studio\2022\<Edition>\MSBuild\Current\Bin
Problem: yaml-cpp.lib not found during TrafficLayer build
LINK : fatal error LNK1181: cannot open input file 'yaml-cpp.lib'
Solution: Build external libraries first:
scripts\dispatch\1_external_libraries.batProblem: MATLAB MEX build fails
Error: Could not find MATLAB installation
Solution:
- Ensure MATLAB is installed
- Update
dependencies.yamlwith correct MATLAB version - Check MATLAB registry entries exist
- Try specifying MATLAB path manually in
5_mex_realsim_socket.ps1
Problem: CarMaker build fails with missing include files
fatal error C1083: Cannot open include file: 'VirEnv_Wrapper.h'
Solution:
- Ensure VirtualEnvironment.lib was built:
scripts\dispatch\2_core_components.bat - Check that
CommonLib/VirEnv_Wrapper.hexists - Verify BuildConfig includes correct paths
Problem: dSPACE library build fails
Error: Could not find dSPACE ConfigurationDesk
Solution:
- This is optional - skip if you don't need dSPACE HIL
- Install dSPACE ConfigurationDesk matching version in
dependencies.yaml - Ensure DsBuildLibrary.mk exists in dSPACE installation
Problem: Debug/Release mismatch errors
LNK2038: mismatch detected for 'RuntimeLibrary'
Solution:
- Ensure all libraries built in same configuration (Debug or Release)
- If building Debug, rebuild external libraries in Debug
- Check that yaml-cppd.lib (Debug) or yaml-cpp.lib (Release) matches your build config
Build logs are located in scripts/dispatch/:
- build.log: Detailed compilation output from all build steps
- build_summary.log: High-level summary of each component's build status
Check these logs for detailed error messages if builds fail.
To verify that tools are correctly detected, run:
powershell -ExecutionPolicy Bypass -File scripts\dispatch\detect_tool_paths.ps1This will print detected paths for Visual Studio, MATLAB, dSPACE, and CarMaker.
To perform a clean build:
- Delete the
build/directory - Delete component-specific output directories:
TrafficLayer/x64/VirtualEnvironment/x64/ProprietaryFiles/VISSIMserver/x64/CarMaker/CM*/src*/CarMaker.win64.exeCarMaker/CM*/src*/libcarmaker4sl.mexw64
- Optionally delete external library builds:
CommonLib/yaml-cpp/build/CommonLib/libevent/build/
- Run
dispatch.bat
Components must be built in this order due to dependencies:
- External libraries (yaml-cpp) - Required by VirtualEnvironment
- VirtualEnvironment.lib - Required by CarMaker
- All other components - Can be built in any order
If you get linker errors, ensure you've built dependencies first.
If you encounter build issues not covered here:
- Check build logs:
scripts/dispatch/build.logandbuild_summary.log - Verify tool versions match
dependencies.yaml - Ensure all prerequisites are installed
- Try a clean build
- Contact: realsimxil@gmail.com