Visual Studio Code is a powerful text editor that can be extended into a full-featured IDE using plugins. This guide walks you through setting up debugging for OpenGeoSys (OGS) on macOS and Linux.
On macOS:
xcode-select --install
On Linux:
sudo apt update
sudo apt install build-essential cmake gdb lldb ninja-build
git clone https://gitlab.opengeosys.org/ogs/ogs.git
cd ogs
cmake --preset debug
ninja -C build/debug ogs
This creates a debug build in build/debug/
.
Download from https://code.visualstudio.com
In the Extensions view (Ctrl+Shift+X
on Linux, Cmd+Shift+X
on macOS), install:
Open the source code ogs/
folder in VS Code.
To build OGS from within VS Code:
mkdir -p .vscode
cat > .vscode/tasks.json <<EOF
{
"version": "2.0.0",
"tasks": [
{
"label": "Build OGS (CMake debug)",
"type": "shell",
"command": "cmake --preset debug && ninja -C ../build/debug ogs",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
EOF
To run the build task, press Shift + Command + B
on macOS or Ctrl+Shift+B
on Linux.
Create .vscode/launch.json
:
[ "${PWD##*/}" = ".vscode" ] || cd .vscode
cat > launch.json <<EOF
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug with LLDB",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/../build/debug/bin/ogs",
"args": [
"${workspaceFolder}/Tests/Data/LIE/Mechanics/coulomb_load_path.prj"
],
"cwd": "${workspaceFolder}/../build/debug",
"stopOnEntry": false,
"externalConsole": false
}
]
}
EOF
Applications/CLI/ogs.cpp
.main()
function.
F5
(Linux) / Fn + F5
(macOS).launch.json
(e.g., Debug with LLDB
).
This article was written by Mostafa Mollaali, Lars Bilke. If you are missing something or you find an error please let us know.
Generated with Hugo 0.147.9
in CI job 582572
|
Last revision: May 15, 2025
Commit: Debugging OpenGeoSys with VS Code 4570abcd
| Edit this page on