This library is self-contained and uses Git submodules for its two
dependencies (msgpack-c and tsl::robin_map), so no system-wide package
manager (and no Boost) is required.
- Git — to clone the repository and fetch the submodules
(
msgpack-c,tsl::robin_map). Without it,third_party/stays empty and the build fails. - CMake 3.14 or newer.
- A C++17 compiler:
- Windows — Visual Studio 2019 or newer, with the "Desktop development
with C++" workload (this also bundles a compatible CMake, which the
.batscript can find automatically — see below). - Linux — GCC 7+ or Clang 5+ (e.g. the
build-essentialpackage). - macOS — Xcode Command Line Tools (
xcode-select --install).
- Windows — Visual Studio 2019 or newer, with the "Desktop development
with C++" workload (this also bundles a compatible CMake, which the
git clone --recursive https://github.com/stubcpp/MessageFrame.git
cd MessageFrameIf you already cloned without --recursive, fetch the submodules separately:
git submodule update --init --recursiveIf you just cloned the repository and want to verify performance
immediately without running multiple commands, use the built-in helper
scripts: run_benchmark.bat (Windows) or run_benchmark.sh (Linux/macOS).
These scripts handle the entire setup sequence:
- Submodule verification — runs
git submodule update --init --recursiveifthird_party/is empty. - Environment configuration — locates a valid toolchain and sets up a clean build directory.
- Release build — compiles the project in Release mode using all available CPU cores.
- Execution — runs the compiled binary and forwards any command-line arguments to it.
Windows (Visual Studio / MSVC):
run_benchmark.bat --params 4 --iterations 50000Linux / macOS (GCC / Clang):
chmod +x run_benchmark.sh
./run_benchmark.sh --params 4 --iterations 50000If you prefer full control over your compilation flags, or need to build manually without the helper scripts, make sure you pull the dependencies first:
git submodule update --init --recursiveAlways compile in Release mode. A Debug build introduces heavy STL iterator validation and extra bounds checking that noticeably skews performance measurements.
Windows (Visual Studio / MSVC) — from a terminal or Developer Command Prompt for VS:
cmake -B build
cmake --build build --config ReleaseLinux / macOS (GCC / Clang):
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -- -j$(nproc)By default the build produces the library plus examples, benchmarks, and tests:
# Linux / macOS
./build/messageframe_example
./build/messageframe_extended_example
./build/messageframe_benchmark --iterations 50000 --params 4
./build/test_hybrid_map
./build/test_message_frame
./build/test_flat_key
./build/test_messageframe_parameter_api
# Windows
.\build\Release\messageframe_example.exe
.\build\Release\messageframe_extended_example.exe
.\build\Release\messageframe_benchmark.exe --iterations 50000 --params 4
.\build\Release\test_hybrid_map.exe
.\build\Release\test_message_frame.exe
.\build\Release\test_flat_key.exe
.\build\Release\test_messageframe_parameter_api.exeThere's no single combined test binary — each test file in tests/
builds its own executable so ctest can report failures per module. Run
them all at once with ctest --test-dir build (or just ctest from
inside build/).
Examples, benchmarks, and tests are each optional and can be disabled at
configure time, e.g. cmake -B build -DMSGFRAME_BUILD_TESTS=OFF
(see MSGFRAME_BUILD_EXAMPLES / MSGFRAME_BUILD_BENCHMARKS /
MSGFRAME_BUILD_TESTS in CMakeLists.txt).
To pull MessageFrame directly into your own project at configure-time, add
this to your top-level CMakeLists.txt:
include(FetchContent)
FetchContent_Declare(
MessageFrame
GIT_REPOSITORY https://github.com/stubcpp/MessageFrame
GIT_TAG master # Replace with a specific release tag or commit hash for stability
)
# Ensure vendored submodule dependencies are fetched too
FetchContent_GetProperties(MessageFrame)
if(NOT messageframe_POPULATED)
FetchContent_Populate(MessageFrame)
execute_process(
COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${messageframe_SOURCE_DIR}
)
add_subdirectory(${messageframe_SOURCE_DIR} ${messageframe_BINARY_DIR})
endif()
# The library target defined by CMakeLists.txt is `msg_frame`, not
# `MessageFrame` (that's just the project() name).
target_link_libraries(your_project_target PRIVATE msg_frame)The repository's CMakeLists.txt doesn't currently export an installed
package config (its install()/export() block is commented out), so
find_package(MessageFrame) isn't available yet — add_subdirectory is
the supported integration path for now.
Because MessageFrame is standard, portable C++17 code, you can bypass external build tools entirely and embed the source directly into your tree.
- Clone the repository recursively to fetch the vendor headers:
git clone --recursive https://github.com/stubcpp/MessageFrame
- Copy the folders into your project structure:
- Copy
include/messageframe/into your project's header directory. - Copy the implementation files from
src/(Header.cpp,Value.cpp,HybridMessageMap.cpp,MessageFrame.cpp) into your source tree. - Copy
third_party/msgpackandthird_party/robin_mapinto your internal vendor paths.
- Copy
- Update your build configuration to point at the copied directories and
compile the four
.cppfiles.
Custom CMake:
target_include_directories(your_project_target PRIVATE
path/to/include
path/to/third_party/msgpack/include
path/to/third_party/robin_map/include
)
target_sources(your_project_target PRIVATE
path/to/src/Header.cpp
path/to/src/Value.cpp
path/to/src/HybridMessageMap.cpp
path/to/src/MessageFrame.cpp
)Visual Studio IDE:
- Project -> Properties -> C/C++ -> General -> Additional Include
Directories: add paths to your copied
include/,third_party/msgpack/include/, andthird_party/robin_map/include/. - Solution Explorer -> Add -> Existing Item... -> select the four
.cppfiles fromsrc/.