A CMake-packaged native C++ bridge that embeds the .NET runtime, calls the official ThermoFisher RawFileReader libraries through a managed shim, and exposes Thermo RAW scan counting to native consumers.
- Builds a native bridge library and the
thermo_hostCLI with CMake - Publishes a managed bridge with an
UnmanagedCallersOnlyGetScanCountentry point - Packages exported CMake targets for
add_subdirectory/FetchContent andfind_package(... CONFIG)workflows - Runs a small Catch2-based test suite through CTest
- Supports Linux, macOS, and Windows builds
The project does not download the Thermo vendor packages by default.
Place the following files in vendor/thermo-feed or point CMake at another directory with -DOPENMS_THERMO_BRIDGE_VENDOR_DIR=/absolute/path:
ThermoFisher.CommonCore.BackgroundSubtraction.8.0.6.nupkgThermoFisher.CommonCore.Data.8.0.6.nupkgThermoFisher.CommonCore.MassPrecisionEstimator.8.0.6.nupkgThermoFisher.CommonCore.RandomAccessReaderPlugin.8.0.6.nupkgThermoFisher.CommonCore.RawfileReader.8.0.6.nupkg
Then configure and build:
cmake -S . -B build
cmake --build build --parallelcmake -S . -B build \
-DOPENMS_THERMO_BRIDGE_ENABLE_VENDOR_DOWNLOAD=ON
cmake --build build --parallelPre-built managed artifacts for each platform are published as GitHub Release assets, so CMake does not need to run dotnet publish for ThermoWrapperManaged.csproj.
The final executable still needs the .NET 8 runtime at runtime, and the native bridge build still needs the platform-specific nethost headers and library. In practice those nethost development files usually come from the .NET SDK/host pack rather than a runtime-only install.
Download the zip for your platform from the GitHub Releases page, unpack it, and point CMake at the extracted directory:
cmake -S . -B build \
-DOPENMS_THERMO_BRIDGE_PREBUILT_MANAGED_DIR=/path/to/unpacked/zip
cmake --build build --parallelCMake will fetch and extract the correct platform zip from GitHub Releases automatically:
cmake -S . -B build \
-DOPENMS_THERMO_BRIDGE_DOWNLOAD_PREBUILT_MANAGED=ON
cmake --build build --parallelFor Linux convenience, build_linux.sh configures, builds, and runs the tests with the vendor-download option enabled.
ctest --test-dir build --output-on-failure./build/thermo_host /path/to/file.rawExpected output:
Scan count: <number>
The public ginkgotoxin-ms-positive.raw sample used in CI currently reports:
Scan count: 90
FetchContent_Declare(OpenMSThermoBridge
GIT_REPOSITORY https://github.com/jpfeuffer/openms-thermo-bridge.git
GIT_TAG main)
FetchContent_MakeAvailable(OpenMSThermoBridge)
add_executable(my_tool main.cpp)
target_link_libraries(my_tool PRIVATE OpenMSThermoBridge::openms_thermo_bridge)
openms_thermo_bridge_copy_runtime_files(TARGET my_tool)openms_thermo_bridge_copy_runtime_files() stages everything needed beside the given target's output directory:
managed/ThermoWrapperManaged.dllmanaged/ThermoWrapperManaged.runtimeconfig.json- the dynamic
nethostruntime library on platforms where it is needed
For executables, call it on the final executable target. If your code uses OpenMSThermoBridge from a shared library/plugin, call it on that shared library target instead so the runtime payload lives next to the library that actually ships to users.
find_package(OpenMSThermoBridge CONFIG REQUIRED)
add_executable(my_tool main.cpp)
target_link_libraries(my_tool PRIVATE OpenMSThermoBridge::openms_thermo_bridge)
openms_thermo_bridge_copy_runtime_files(TARGET my_tool)At runtime the bridge first looks for managed/ next to the executable, then next to the loaded openms_thermo_bridge binary, and also supports the installed package layout under openms_thermo_bridge/managed. That means:
- build-tree consumers can stage runtime files next to their executable or shared library with
openms_thermo_bridge_copy_runtime_files() - installed-package consumers can either stage the runtime files the same way or rely on the package's installed
lib/openms_thermo_bridge/managedlayout
If you bypass the helper and pass an explicit managed directory to openms::thermo_bridge::RawFile or get_scan_count(...), then you are responsible for shipping that directory yourself.
- CMake 3.21+
- .NET 8 SDK when CMake builds
ThermoWrapperManaged.csprojlocally withdotnet publish - Platform-specific .NET
nethostheaders and library to build the native bridge; these usually come from the .NET SDK/host pack even when using pre-built managed artifacts - .NET 8 runtime for the final executable at runtime
- A C++17 compiler
- Network access to
api.nuget.organd, when the relevant options are enabled,raw.githubusercontent.com - Pre-built artifact downloads (
OPENMS_THERMO_BRIDGE_DOWNLOAD_PREBUILT_MANAGED=ON) additionally require network access togithub.com
- Linux, macOS, and Windows CMake builds
- Native C++ bridge library and CLI
- Catch2/CTest integration tests
- Exported CMake package config