Build and Run Samples
Introduction
This guide explains how to build the sample code for VizionSDK. 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 "Desktop development with C++") or MinGW.
- Linux (Ubuntu/Debian):
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/sample1-hello_vizionsdk # Or sample2-camera_capture / sample3-camera_control
-
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
System SDK
find_package(vizionsdk REQUIRED)
target_link_libraries(${PROJECT_NAME}
PRIVATE
vizionsdk::VizionSDK
)
Extracted SDK
# Adjust <YOUR_SDK_PATH> to 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
)
target_link_libraries(${PROJECT_NAME}
PRIVATE
VizionSDK
)
Replace
${PROJECT_NAME}
with your actual CMakeadd_executable()
name (e.g.,hello_vizionsdk
,camera_capture
, etc.).
Run 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 are working withcamera_capture
orcamera_control
.