C++ on Windows (NuGet)
NuGet install path for the SmartSpectra C++ SDK on Windows — suitable for Visual Studio and MSBuild projects.
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.
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 and model resources 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.
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)Why the extra target_link_libraries?
Without this line, any consumer code that actually references a SmartSpectra
symbol fails with LNK2019 at build time. Directly authored .vcxproj
projects do not need it — the clobber is specific to CMake's
VS_PACKAGE_REFERENCES consumption 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.