From c2fa0d35da782a768d8d9fc4fe0c032ee8d763f5 Mon Sep 17 00:00:00 2001 From: Barzan Hayati Date: Sat, 2 Aug 2025 20:27:11 +0000 Subject: [PATCH] Configure vscode --- .devcontainer/devcontainer.json | 63 +++++++++++++++++++++++++++++++++ .vscode/c_cpp_properties.json | 24 +++++++++++++ .vscode/launch.json | 25 +++++++++++++ .vscode/settings.json | 8 +++++ .vscode/tasks.json | 30 ++++++++++++++++ CMakeLists.txt | 4 +++ 6 files changed, 154 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..51c3288 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,63 @@ +{ + "name": "DeepStream Dev Container", //Defines the display name of the dev container in the VS Code UI + + //"context": "..", + // Specifies the build context for the container β€” i.e., the directory from which the Docker build command is run. + // Use "." if your .devcontainer directory is at the root of the Docker context. + // Use ".." if your .devcontainer/ folder is inside the project and the Dockerfile is in the parent folder. + // If you are using a Docker image instead of building a Dockerfile, this field can be omitted. + + // "dockerFile": "../Dockerfile", // path relative to .devcontainer + // The "dockerFile" key tells VS Code which Dockerfile to use when building your development container. + // Without this, VS Code won’t know how to construct the container environment β€” unless you're using + // a prebuilt "image" instead. + // You set it as a path relative to the .devcontainer/ folder. + // Your .devcontainer/devcontainer.json is in: /path/to/project/.devcontainer/devcontainer.json + // Your Dockerfile is in: /path/to/project/Dockerfile + // If you use dockerFile, you must specify context, since Docker needs to know the build context. + // πŸ” Alternative: Use a prebuilt image + // If you don't have a Dockerfile and want to base your dev container on an existing + // image (e.g., NVIDIA's DeepStream container), use: + // "image": "nvcr.io/nvidia/deepstream:6.4-triton-devel" + // And omit the dockerFile/context fields entirely. + + + "workspaceFolder": "/root/temp_code/rtsp_in_rtsp_out", // your actual project path inside container + // Sets the default working directory inside the container β€” this is where VS Code opens your workspace. + // This should match the path inside the container where your source code is mounted. + // It must exist after mounting. + // Make sure this path matches the mount point + subfolder. + + "mounts": [ + "source=/root/temp_code,target=/rtsp_in_rtsp_out,type=bind" + ], + // Mounts files/directories from your host system into the container. Useful when your codebase or data is + // outside of the default workspace path. + // source: path on the host + // target: path inside the container + // type=bind: bind mount (like a symbolic link across environments) + // Make sure this path works correctly and isn't conflicting with workspaceMount. + + "customizations": { + "vscode": { + "settings": { + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + "C_Cpp.default.compileCommands": "build/compile_commands.json" + }, + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cmake-tools" + ] + } + }, + // Allows you to define VS Code-specific settings, extensions, or UI changes for the container. + + //"settings": { + // "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", + // "C_Cpp.default.compileCommands": "build/compile_commands.json" + //}, + + "postCreateCommand": "echo Dev container ready" // "postCreateCommand": "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -B build -S ." + // Runs a shell command after the container is created and ready (but before opening VS Code in it). + // Use it to run cmake, install dependencies, or print a message. +} \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..f126419 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,24 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**", + "/usr/include", + "/usr/local/include", + "/usr/local/cuda/include", + "/usr/lib/x86_64-linux-gnu/glib-2.0/include", + "/opt/nvidia/deepstream/deepstream-7.1/sources/includes", + "/usr/include/gstreamer-1.0", + "/usr/include/nlohmann", + "/usr/include/glib-2.0" + ], + "defines": [], + "compilerPath": "/usr/bin/g++", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "linux-gcc-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..62ddca2 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug BodyPipeline", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/BodyPipeline", // your output binary + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..abf842f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +// auto-completion +{ + "C_Cpp.default.compileCommands": "/home/user2/temp_code/build/compile_commands.json", + "C_Cpp.default.intelliSenseMode": "linux-gcc-x64", + "C_Cpp.default.cppStandard": "c++17", + "C_Cpp.intelliSenseEngine": "default", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..f737e6e --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,30 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "CMake Configure", + "type": "shell", + "command": "cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON", + "options": { + "cwd": "${workspaceFolder}/build" + }, + "problemMatcher": [] + }, + { + "label": "CMake Build", + "type": "shell", + "command": "cmake --build . --config Release", + "options": { + "cwd": "${workspaceFolder}/build" + }, + "problemMatcher": ["$gcc"], + "dependsOn": ["CMake Configure"], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} +// "label": "Build", +// "command": "cmake --build build", \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 642faea..2663501 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,8 +29,12 @@ endif() find_package(PkgConfig REQUIRED) # find_package(CUDA REQUIRED) find_package(prometheus-cpp REQUIRED) +pkg_check_modules(GST REQUIRED gstreamer-1.0) +include_directories(${GST_INCLUDE_DIRS}) pkg_check_modules(GLIB REQUIRED glib-2.0 gobject-2.0 nlohmann_json gstreamer-base-1.0 gstreamer-rtsp-server-1.0 gstreamer-rtsp-1.0 gstreamer-1.0 gstreamer-video-1.0) + +add_definitions(${GST_CFLAGS_OTHER}) if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") message("embed_platform on")