{
"version": "2.0.0",
"tasks": [
{
"label": "build tandem",
"type": "shell",
"command": "bash",
"args": [
"-c",
"mkdir -p build-2d-p6 && cd build-2d-p6 && cmake /home/pkarki/tandem_project/tandem -DCMAKE_CXX_COMPILER=mpicxx -DCMAKE_C_COMPILER=mpicc -DCMAKE_PREFIX_PATH=/home/pkarki/bin -DCMAKE_BUILD_TYPE=Debug -DDOMAIN_DIMENSION=2 -DPOLYNOMIAL_DEGREE=6 && cd app && make -j 20"
],
"group": {
"kind": "build",
"isDefault": true
},
"options": {
"cwd": "/home/pkarki/tandem_project" // Should be the working directory but shouldn't matter if you're using absolute paths everywhere
},
"problemMatcher": ["$gcc"]
}
]
}
Main thing to remember is to have a debug compiler flag which is -g but since we aren't directly compiling source files but rather from cmake, we need to specify this with -DCMAKE_BUILD_TYPE=Debug.
With this, you can step into the code and debug for the cpp files.
It might be useful for someone trying to do this in the future or even to me in case of academic amnesia.
Caveat: I use VScode as my IDE so this is only for the particular setup. You could of course adopt this for your usage with modifications.
So what you need is, inside the .vscode folder, you need launh and tasks json file. Currently they look like this:
launch.json
tasks.json
Main thing to remember is to have a debug compiler flag which is
-g
but since we aren't directly compiling source files but rather from cmake, we need to specify this with-DCMAKE_BUILD_TYPE=Debug
.With this, you can step into the code and debug for the cpp files.