Created
June 11, 2019 02:33
-
-
Save genedelisa/dc95b49a4361b214035fc5e8dbd96731 to your computer and use it in GitHub Desktop.
VS code tasks for compiling C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// https://code.visualstudio.com/docs/editor/tasks | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
// build and run the current cpp file you're editing. | |
"label": "Build with Clang C++17", | |
"type": "shell", | |
"command": "clang++", | |
"args": [ | |
"-std=c++17", | |
"-stdlib=libc++", | |
"main/src/helloworld.cpp", | |
"-o", | |
"${workspaceRoot}/${fileBasenameNoExtension}", | |
"--debug", | |
"&&", | |
"${workspaceRoot}/${fileBasenameNoExtension}" | |
], | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
}, | |
"problemMatcher": { | |
"owner": "cpp", | |
"fileLocation": [ | |
"relative", | |
"${workspaceRoot}" | |
], | |
"pattern": { | |
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", | |
"file": 1, | |
"line": 2, | |
"column": 3, | |
"severity": 4, | |
"message": 5 | |
} | |
} | |
}, | |
// or just run it from the terminal | |
{ | |
"label": "execute", | |
"type": "process", | |
"command": "${workspaceRoot}/${fileBasenameNoExtension}", | |
"group": "test", | |
"dependsOn": [ | |
"Build with Clang C++17" | |
] | |
}, | |
// tasks for using cmake | |
{ | |
"label": "clean", | |
"type": "shell", | |
"command": "rm -rf ./build", | |
"problemMatcher": [] | |
}, | |
{ | |
"label": "cmake", | |
"type": "shell", | |
"command": "mkdir build && cd build && cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug ..", | |
"dependsOn": [ | |
"clean" | |
], | |
"problemMatcher": [] | |
}, | |
{ | |
"label": "make", | |
"type": "shell", | |
"command": "make", | |
"args": [ | |
"-j", | |
"8" | |
], | |
"options": { | |
"cwd": "${workspaceFolder}/build" | |
}, | |
"problemMatcher": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment