Approaches for Building Code Generated from MATLAB Code
You can use a CMake or toolchain approach for building (compiling and linking) code that you generate from MATLAB® code:
CMake—A third-party, open-source tool for build process management, which uses configuration (
CMakeLists.txt) files to generate standard build files for native build environments, for example, makefiles, Ninja files, or Microsoft® Visual Studio® projects. MATLAB ships the CMake executable file. MATLAB Coder™ supports CMake versions from 3.12.0 onwards.
CMake and the associated
CMakeLists.txtfile are widely used for building C++ code and can be directly leveraged by command-line tools and IDEs like Microsoft Visual Studio, Microsoft Visual Studio Code, Xcode, and CLion.
Toolchain—The build process generates makefiles and supports custom toolchains. You can control the build process with toolchain information objects that you define by using MATLAB scripts.
Each build process supports:
Code generation configuration parameters
codebuild(Embedded Coder) function
SIL or PIL execution with Embedded Coder®
codebuild (Embedded Coder)
- Configure CMake Build Process
- Create Custom CMake Toolchain Definition
- Add Custom Toolchains to MATLAB® Coder™ Build Process
- Build 32-bit DLL on 64-bit Windows® Platform Using MSVC Toolchain
- Approaches for Building Code Generated from Simulink Models (Embedded Coder)