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
- Download from the official CMake website, extract or install it, and add it to your system PATH:
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
-
Open Terminal
- Windows: Command Prompt or PowerShell
- Linux: Any terminal
-
Go to sample directory:
cd path/to/sample
-
Create build directory:
mkdir build && cd build
-
Run CMake:
cmake ..
Ensure your
CMakeLists.txt
is configured to link against the correct SDK path. See configuration examples below. -
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 CMakeadd_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.