C++ on Windows (NuGet)
NuGet install path for the SmartSpectra C++ SDK on Windows — suitable for Visual Studio and MSBuild projects.
[!NOTE] Alternative install path. The recommended C++ install on Windows is the ZIP distribution. NuGet is an alternative for
.vcxproj-based Visual Studio projects where MSBuild integration is preferred. For C# / .NET 8, see the .NET on Windows page instead.
Add the SDK via NuGet
NuGet is suitable for Visual Studio and MSBuild projects. The package sets
include directories and linker inputs automatically via SmartSpectra.props,
and copies the required DLLs to your build output via SmartSpectra.targets.
The command-line examples below require nuget.exe. If it is not already on
your PATH, install it first:
winget install --id Microsoft.NuGetAdd the SmartSpectra NuGet feed as a package source (one-time):
nuget sources add -Name SmartSpectra `
-Source https://packages.presagetech.com/nuget/index.jsonFor release candidate builds, also add the RC feed:
nuget sources add -Name SmartSpectra-RC `
-Source https://packages.presagetech.com/nuget-rc/index.jsonInstall the package:
# Stable
nuget install SmartSpectra -Version <version>
# RC
nuget install SmartSpectra -Version <version>-rc.<n>Or declare it in your project file:
<!-- Stable release -->
<PackageReference Include="SmartSpectra" Version="<version>" />
<!-- RC build (requires SmartSpectra-RC source) -->
<PackageReference Include="SmartSpectra" Version="<version>-rc.<n>" />No further include, lib, or DLL configuration is required for MSBuild projects using the NuGet package. The SmartSpectra NuGet package is self-contained — you do not need to install OpenCV, protobuf, or other SDK runtime libraries separately.
CMake project against the NuGet package
If you installed via NuGet, use VS_PACKAGE_REFERENCES instead of the
find_package flow used by the ZIP example. Two properties are required —
and target_link_libraries must still be called explicitly:
cmake_minimum_required(VERSION 3.22.1)
project(HelloVitals CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(hello_vitals hello_vitals.cpp)
# Required: tells NuGet this is a native C++ target.
set_property(TARGET hello_vitals PROPERTY
VS_GLOBAL_NuGetTargetMoniker "native,Version=v0.0")
set_property(TARGET hello_vitals PROPERTY
VS_PACKAGE_REFERENCES "SmartSpectra_<version>")
# Required: CMake's Visual Studio generator writes per-config
# <AdditionalDependencies> entries without a %(AdditionalDependencies)
# continuation, which clobbers the smartspectra.lib;smartspectra_capi.lib
# injection from SmartSpectra.props. Linking the libs through CMake's own
# Link.AdditionalDependencies path restores them.
target_link_libraries(hello_vitals PRIVATE smartspectra smartspectra_capi)[!NOTE] Why the extra
target_link_libraries? Without this line, any consumer code that actually references a SmartSpectra symbol fails withLNK2019at build time. Directly authored.vcxprojprojects do not need it — the clobber is specific to CMake'sVS_PACKAGE_REFERENCESconsumption pattern.
Configure and build from an x64 Native Tools Command Prompt for VS 2022:
cmake -G "Visual Studio 17 2022" -A x64 -B build
cmake --build build --config ReleaseCMakeSettings.json is only needed for the ZIP option — skip it when you are
using NuGet.
Package layout
build/native/
include/ # headers (injected via SmartSpectra.props)
lib/x64/ # import libs + capi static lib (injected via SmartSpectra.props)
SmartSpectra.props # sets AdditionalIncludeDirectories + AdditionalDependencies
SmartSpectra.targets # copies DLLs to output directory at build time
runtimes/win-x64/native/
smartspectra.dll
opencv_world4100.dll