Deepstream開發環境設定
Setup Deepstream C development enviornment with CMake and VSCode
2024/07/05更新
安裝C/C++、CMake 、CMake Tools extension
C/C++的IntelliSense直接選compile_commands.json
https://code.visualstudio.com/docs/cpp/configure-intellisense
launch.json
1 | { |
查看char *完整內容
2024/07/05前舊方法
Prequirements
- CMake > 3.25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20sudo apt-get update
sudo apt-get install ca-certificates gpg wget
test -f /usr/share/doc/kitware-archive-keyring/copyright ||
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
# For Ubuntu Jammy Jellyfish (22.04):
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt-get update
# For Ubuntu Focal Fossa (20.04):
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt-get update
test -f /usr/share/doc/kitware-archive-keyring/copyright ||
sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg
sudo apt-get install kitware-archive-keyring
sudo apt-get install cmake - VSCode
- clangd
1
sudo apt-get install clangd-12
- package to run this example
1
2sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \
libgstrtspserver-1.0-dev libx11-dev libjson-glib-dev libyaml-cpp-dev
Setup VSCode for development
install VSCode extension
CodeLLDB、clangd 、CMake 、CMake ToolsNote: Do not install C/C++ extension pack from Microsoft
copy deepstream-test5 to your workspace
deepstream-test5 is a complete example to modify deepstream-app,this will take the advantage of the module design of deepstream-app. You can add probe to customize the app. It have good config parser and error handling, those will save many effort.
Following our workspace is in the copy of deepstream-test5 folder.
1 | cp -r /opt/nvidia/deepstream/deepstream/apps/sample_apps/deepstream-test5/* /path/to/your/workspace |
- create launch.json and task.json
create launch.json and task.json for compile and debug
tasks.json use CMake to build
1 | { |
launch.json call task in task json to build
1 | { |
- Create CMAKELists.txt
Create CMakeLists.txt under the workspace folder, CMake will help you find CUDA and nvcc, no moreCUDA_VER
env variable needed even in jetson.
In this example,we need to compile deepstream-app first and use the object file in our project.So we useExternalProject_Add
to do this.
We need to change the permission for deepstream-app source folder in order to compile the deepstream-app.
1 | sudo chmod -R 777 /opt/nvidia/deepstream/deepstream/sources/apps/ |
1 | cmake_minimum_required(VERSION 3.25) |
build project
click the build button in VSCode and select the gcc compiler.start debug and make a breakpoint
code navigation
example project
https://github.com/jenhaoyang/deepstream-startup
Deepstream開發環境設定