Skip to main content

Build and Run Samples


Introduction

This guide explains how to build the sample code for vizionsdk_c. You can download the sample code from the official repository samples directory.

Prerequisites

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

CMake

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

C Compiler

  • Windows: Install Visual Studio (with the "Desktop development with C++" workload) or use MinGW to obtain the gcc compiler.
  • Linux (Ubuntu/Debian):
    Install the GNU C compiler and essential build tools:
sudo apt install build-essential
  • Embedded: Use cross-compilation on your host machine.

Build Steps

  1. Open Terminal

    • Windows: Command Prompt or PowerShell
    • Linux: Any terminal
  2. Go to sample directory:

    cd path/to/sample
  3. Create build directory:

    mkdir build && cd build
  4. Run CMake:

    cmake ..

    Ensure your CMakeLists.txt is configured to link against the correct SDK path. See configuration examples below.

  5. Build:

    cmake --build .

CMake Config

# Adjust <your_vizionsdk_c_path> to your actual SDK location
set(VIZIONSDK_C_PREFIX <your_vizionsdk_c_path>)

list(APPEND CMAKE_PREFIX_PATH ${VIZIONSDK_C_PREFIX})
find_package(vizionsdk_c REQUIRED)

target_include_directories(${PROJECT_NAME}
PRIVATE
${VIZIONSDK_C_INCLUDE_DIR}
)

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

Replace ${PROJECT_NAME} with your actual CMake add_executable() name.

Run Samples

The executable will be located in the build directory.

  • Windows:
    .\sample.exe
  • Linux:
    ./sample
warning

Make sure vizionsdk_c is located in the same folder as the sample executable, or its path is included in the system PATH environment variable.