Sample code for VizionSDK
  • 02 May 2025
  • 1 Minute to read
  • Dark
    Light
  • PDF

Sample code for VizionSDK

  • Dark
    Light
  • PDF

Article summary

Introduction

This article will explain how to build the sample code for VizionSDK.
You can download the sample code here.

Prerequisites

Before building and running this project, ensure you have the following installed.

1. CMake (version 3.0 or newer)

  • Windows / Embedded Linux:

    Download from the official CMake website, extract or install it, and make sure it's added to your system PATH.

    export PATH=/path/to/cmake/bin:$PATH
  • Linux (Ubuntu/Debian):

    sudo apt update
    sudo apt install cmake

2. C++ Compiler (supporting C++11 standard):

  • Windows: Install Visual Studio (with "Desktop development with C++") or MinGW.

  • Linux (Ubuntu/Debian):

    sudo apt install build-essential
  • Embedded: Use cross-compilation on your host machine.

Building Windows / Linux

Open Terminal

  • Windows: Use Command Prompt or PowerShell

  • Linux: Use your preferred terminal

Navigate to the sample directory

cd path/to/sample1-hello_vizionsdk  # Or sample2-camera_capture / sample3-camera_control

Create and enter a build directory

mkdir build && cd build

Generate build files with CMake

cmake ..

Make sure CMakeLists.txt is configured to link against the local SDK path. Example configuration is shown below.

Build the project

cmake --build .

Configuring CMakeLists.txt

When Using System-Installed SDK (.exe or .deb Installed)

If you've installed VizionSDK using the installer (e.g., .exe on Windows or .deb on Linux), you can simply use find_package:

# Find the SDK package
find_package(vizionsdk REQUIRED)

# Link libraries
target_link_libraries(${PROJECT_NAME}
  PRIVATE
  vizionsdk::VizionSDK
)

Using Extracted SDK Archive

If you're using the SDK directly from the extracted folder (without system installation), update the path manually:

# Set include and lib paths
# NOTE: Adjust the path to match your actual SDK location
target_include_directories(${PROJECT_NAME}
  PRIVATE
  <YOUR_SDK_PATH>/include/vizionsdk
)

target_link_directories(${PROJECT_NAME}
  PRIVATE
  <YOUR_SDK_PATH>/lib
)

# Link libraries
target_link_libraries(${PROJECT_NAME}
  PRIVATE
  VizionSDK
)

Make sure to match the ${PROJECT_NAME} with your actual CMake add_executable() name (e.g., hello_vizionsdk, camera_capture, etc.).

Running the Samples

The executable will be located in the build directory.

Windows

.\hello_vizionsdk.exe

Linux

./hello_vizionsdk

Replace hello_vizionsdk with the actual sample name if you're working with camera_capture or camera_control.


Was this article helpful?

What's Next