Installation
CppModel is a hybrid cloud service. The client-side library runs your simulations locally and syncs their results to your workspace. None of your code is sent to the cloud: all code and its execution stay on your machine.
The library (the CppModel SDK) is one self-contained shared library per operating system and architecture. Download the archive for your platform from the Download menu in CppModel Workspace. Nothing else needs installing: OpenSSL, zlib and the C++ runtime are built into the library.
This documentation describes CppModel 0.9 and later.
Writing simulations in Python or JavaScript? Install the cppmodel package from PyPI or npm instead. It contains the library for every supported platform. See Python and Node.js.
Supported platforms
| OS | Architecture | Archive | Your compiler |
|---|---|---|---|
| Linux | x86_64 | Linux x86_64 (.tar.gz) | GCC, Clang (glibc 2.28 or later) |
| Linux | aarch64 | Linux aarch64 (.tar.gz) | GCC, Clang (glibc 2.28 or later) |
| Windows | x64 | Windows x64 (.zip) | MSVC, clang-cl, MinGW (MSYS2) |
| Windows | ARM64 | Windows ARM64 (.zip) | MSVC, clang-cl |
| macOS | arm64 + x86_64 | macOS universal (.tar.gz) | Apple Clang (macOS 11 or later) |
The library's binary interface is plain C, so the same archive works with any of the listed compilers, standard libraries, runtimes and build types (Debug or Release).
Prerequisites
- A C compiler, and a C++ compiler if you write simulations in C++ (C++17 or later).
- CMake 3.21 or later (recommended; all examples in this documentation use it).
What's in the archive
| Folder | Contents |
|---|---|
include/cppmodel/ | CModel.h (C API), cppmodel.hpp (C++ API) and cppmodel.h (the low-level C interface both are built on) |
include/nlohmann/ | json.hpp, used by the C++ API |
lib/, bin/ | The shared library (on Windows cppmodel.dll with its import library cppmodel.lib) and the cppmodel-tool command-line tool |
lib/cmake/cppmodel/ | The CMake package, for find_package(cppmodel) |
share/cppmodel/example/ | A minimal C and C++ simulation with its CMakeLists.txt |
licenses/ | Licenses of the bundled third-party components |
A common layout is to extract the archive into a dependencies folder in your project. The examples in this documentation assume that layout.
Extract the library
- Log in to CppModel Workspace.
- Open the
Downloadmenu and select the archive for your platform. - Extract it into a
dependenciesfolder in your project.
On Linux and macOS:
mkdir -p dependencies
tar -xzf CppModel-x.x.x-Linux-x86_64.tar.gz -C dependencies --strip-components=1
On Windows, extract the .zip and move the contents of its top-level CppModel-x.x.x-Windows-x64 folder into dependencies.
The latest release is also available at a fixed address, which is convenient in CI scripts:
https://download.cppmodel.com/CppModel-latest-Linux-x86_64.tar.gz
https://download.cppmodel.com/CppModel-latest-Linux-aarch64.tar.gz
https://download.cppmodel.com/CppModel-latest-Windows-x64.zip
https://download.cppmodel.com/CppModel-latest-Windows-ARM64.zip
https://download.cppmodel.com/CppModel-latest-macOS-universal.tar.gz
Use it from CMake
Point CMake at the extracted folder, link cppmodel::cppmodel and call cppmodel_deploy_runtime():
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/dependencies")
find_package(cppmodel REQUIRED)
add_executable(MySimulation MySimulation.c)
target_link_libraries(MySimulation PRIVATE cppmodel::cppmodel)
cppmodel_deploy_runtime(MySimulation)
cppmodel_deploy_runtime() copies the shared library next to the executable after every build and makes the executable look for it there. The build folder runs as it is, and you can copy it to another machine.
To try the SDK on its own, build the example it ships with:
cmake -S dependencies/share/cppmodel/example -B build-example -DCMAKE_PREFIX_PATH=$PWD/dependencies
cmake --build build-example
Without CMake
Add dependencies/include/cppmodel and dependencies/include to the include path, link cppmodel (on Windows cppmodel.lib) from dependencies/lib, and ship the library next to the executable. On Linux, link with -Wl,-rpath,'$ORIGIN'; on macOS, with -Wl,-rpath,@executable_path. For example, on Linux:
gcc -o MySimulation MySimulation.c -Idependencies/include/cppmodel -Idependencies/include \
-Ldependencies/lib -lcppmodel -lm -Wl,-rpath,'$ORIGIN'
cp dependencies/lib/libcppmodel.so.1 .
A pure C simulation is linked as C: the library has a C interface, so the C++ linker is not needed.
CODESYS
A CODESYS library is on its way. Want to give feedback or suggestions? Book a demo or email us at [email protected].
Keeping the library up to date
If you use Claude Code, the cppmodel:update-dependencies skill of the CppModel Claude Code plugin updates the library for you. It downloads the right build for your platform, flags interface changes, fixes affected call sites and rebuilds your project to verify the update.
Next steps
Continue with Create Simulation to write, build and run your first simulation.