Added Cland/GCC builds and Analyzers tasks for vscode
This commit is contained in:
parent
5942f366f9
commit
8aecc897d7
3 changed files with 244 additions and 33 deletions
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
@ -11,7 +11,7 @@
|
|||
"program": "${workspaceFolder}/build/examples/output/connect",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"preLaunchTask": "Build Debug GCC"
|
||||
"preLaunchTask": "GCC: Build"
|
||||
}
|
||||
]
|
||||
}
|
241
.vscode/tasks.json
vendored
241
.vscode/tasks.json
vendored
|
@ -3,6 +3,33 @@
|
|||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
//
|
||||
// Checkers/Analyzers tasks
|
||||
//
|
||||
{
|
||||
"label": "Checker: clang-format dry-run",
|
||||
"type": "shell",
|
||||
"command": "for FILE in $(find . -type f \\( -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \\) ! -path '*build*'); do clang-format -i $FILE --dry-run --Werror; done"
|
||||
},
|
||||
{
|
||||
"label": "Checker: clang-format fix errors",
|
||||
"type": "shell",
|
||||
"command": "for FILE in $(find . -type f \\( -name '*.c' -o -name '*.cpp' -o -name '*.h' -o -name '*.hpp' \\) ! -path '*build*'); do clang-format -i $FILE --Werror; done"
|
||||
},
|
||||
{
|
||||
// https://clang.llvm.org/extra/clang-tidy/
|
||||
"label": "Checker: clang-tidy dry-run",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"python /home/tools/run-clang-tidy.py -exclude-header-filter .*build.* -use-color -header-filter .hpp -p ${workspaceFolder}/build_clang/ -config-file ${workspaceFolder}/.clang-tidy ",
|
||||
" ${workspaceFolder}/examples ",
|
||||
" ${workspaceFolder}/library/ ",
|
||||
" ${workspaceFolder}/src/"
|
||||
]
|
||||
},
|
||||
//
|
||||
// Ejabberd tasks
|
||||
//
|
||||
{
|
||||
"label": "Ejabberd: show logs",
|
||||
"type": "shell",
|
||||
|
@ -11,54 +38,238 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"label": "Ejabberd: open shell",
|
||||
"label": "Ejabberd: show localhost registered users",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"sudo docker exec -it ejabberd sh"
|
||||
"sudo docker exec -it ejabberd ejabberdctl registered_users localhost"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Build Debug GCC",
|
||||
"label": "Ejabberd: open shell",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"printf 'Example cmd: ejabberdctl registered_users localhost\n\n';",
|
||||
"sudo docker exec -it ejabberd sh"
|
||||
]
|
||||
},
|
||||
//
|
||||
// GCC build related tasks
|
||||
//
|
||||
{
|
||||
"label": "GCC: Clean build folder",
|
||||
"type": "shell",
|
||||
"command": "if [ -n \"$(ls -A ${workspaceFolder}/build)\" ]; then rm -rf ${workspaceFolder}/build/*; fi",
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"label": "GCC: Configure Debug",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"cd ${workspaceFolder} &&",
|
||||
"mkdir -p build && cd build &&",
|
||||
"cmake -Wno-dev -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON .. &&",
|
||||
"cmake --build . --parallel `nproc`",
|
||||
"|| ( printf '\n\n\t\\e[31mERROR: Build failed!\\e[0m\n\n\n' && exit 1 )"
|
||||
"cmake -Wno-dev ",
|
||||
" -DCMAKE_CXX_FLAGS=\"-Wno-non-template-friend\"",
|
||||
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON .."
|
||||
],
|
||||
"options": {
|
||||
"env": {}
|
||||
"env": {
|
||||
"CC": "/usr/sbin/gcc",
|
||||
"CXX": "/usr/sbin/g++"
|
||||
}
|
||||
},
|
||||
"presentation": {
|
||||
"clear": true
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"label": "GCC: Build",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"cd ${workspaceFolder}/build &&",
|
||||
"cmake --build . --parallel `nproc`",
|
||||
"|| ( printf '\n\n\t\\e[31mERROR: Build failed!\\e[0m\n\n\n' && exit 1 )"
|
||||
],
|
||||
"presentation": {
|
||||
"clear": true
|
||||
},
|
||||
"hide": true,
|
||||
"group": {
|
||||
"kind": "build"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "GCC: Configure and build Debug",
|
||||
"type": "shell",
|
||||
"command": "echo Finished!",
|
||||
"presentation": {
|
||||
"clear": true
|
||||
},
|
||||
"dependsOrder": "sequence",
|
||||
"dependsOn":[
|
||||
"GCC: Clean build folder",
|
||||
"GCC: Configure Debug",
|
||||
"GCC: Build"
|
||||
],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
//
|
||||
// Clang build related tasks
|
||||
//
|
||||
{
|
||||
"label": "Build Debug Clang",
|
||||
"label": "Clang: Configure Debug",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"cd ${workspaceFolder} &&",
|
||||
"mkdir -p build_clang && cd build_clang &&",
|
||||
"cmake -Wno-dev -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON .. &&",
|
||||
"cmake --build . --parallel `nproc`",
|
||||
"|| ( printf '\n\n\t\\e[31mERROR: Build failed!\\e[0m\n\n\n' && exit 1 )"
|
||||
"cmake -Wno-dev ",
|
||||
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON ",
|
||||
" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++\"",
|
||||
" -DCMAKE_EXE_LINKER_FLAGS=\"-L/usr/lib/x86_64-linux-gnu -lstdc++\" .."
|
||||
],
|
||||
"options": {
|
||||
"env": {
|
||||
"CC": "/usr/sbin/clang",
|
||||
"CXX": "/usr/sbin/clang++"
|
||||
"CC": "/home/LLVM-19.1.0/bin/clang",
|
||||
"CXX": "/home/LLVM-19.1.0/bin/clang++"
|
||||
}
|
||||
},
|
||||
"presentation": {
|
||||
"clear": true
|
||||
},
|
||||
"problemMatcher": []
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"label": "Clang: Configure Debug with -fsanitize=address",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"cd ${workspaceFolder} &&",
|
||||
"mkdir -p build_clang && cd build_clang &&",
|
||||
"cmake -Wno-dev ",
|
||||
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON ",
|
||||
" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr\"",
|
||||
" -DCMAKE_EXE_LINKER_FLAGS=\"-L/usr/lib/x86_64-linux-gnu -lstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr\" ..",
|
||||
],
|
||||
"options": {
|
||||
"env": {
|
||||
"CC": "/home/LLVM-19.1.0/bin/clang",
|
||||
"CXX": "/home/LLVM-19.1.0/bin/clang++"
|
||||
}
|
||||
},
|
||||
"presentation": {
|
||||
"clear": true
|
||||
},
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
//
|
||||
// Useful links:
|
||||
// - https://github.com/google/sanitizers/wiki/addresssanitizerflags
|
||||
// - https://clang.llvm.org/docs/AddressSanitizer.html
|
||||
//
|
||||
"label": "Clang: Exec gtest with -fsanitize=address",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"cd ${workspaceFolder} &&",
|
||||
"mkdir -p build_clang && cd build_clang &&",
|
||||
"ASAN_SYMBOLIZER_PATH=/home/LLVM-19.1.0/bin/llvm-symbolizer ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=1:detect_leaks=1:atexit=1:abort_on_error=1 ./larra_xmpp_tests ; echo \"exit code: $?\"",
|
||||
],
|
||||
"presentation": {
|
||||
"clear": true
|
||||
},
|
||||
"dependsOrder": "sequence",
|
||||
"dependsOn":[
|
||||
"Clang: Clean build folder",
|
||||
"Clang: Configure Debug with -fsanitize=address",
|
||||
"Clang: Build"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Clang: Configure Debug with -fsanitize=memory",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"cd ${workspaceFolder} &&",
|
||||
"mkdir -p build_clang && cd build_clang &&",
|
||||
"cmake -Wno-dev ",
|
||||
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON ",
|
||||
" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++ -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fsanitize=memory\"",
|
||||
" -DCMAKE_EXE_LINKER_FLAGS=\"-L/usr/lib/x86_64-linux-gnu -lstdc++ -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fsanitize=memory\" ..",
|
||||
],
|
||||
"options": {
|
||||
"env": {
|
||||
"CC": "/home/LLVM-19.1.0/bin/clang",
|
||||
"CXX": "/home/LLVM-19.1.0/bin/clang++"
|
||||
}
|
||||
},
|
||||
"presentation": {
|
||||
"clear": true
|
||||
},
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
//
|
||||
// Useful links:
|
||||
// - https://github.com/google/sanitizers/wiki/MemorySanitizer
|
||||
// - https://clang.llvm.org/docs/MemorySanitizer.html
|
||||
//
|
||||
"label": "Clang: Exec gtest with -fsanitize=memory",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"cd ${workspaceFolder} &&",
|
||||
"mkdir -p build_clang && cd build_clang &&",
|
||||
"MSAN_SYMBOLIZER_PATH=/home/LLVM-19.1.0/bin/llvm-symbolizer MSAN_OPTIONS=abort_on_error=1 ./larra_xmpp_tests ; echo \"exit code: $?\"",
|
||||
],
|
||||
"presentation": {
|
||||
"clear": true
|
||||
},
|
||||
"dependsOrder": "sequence",
|
||||
"dependsOn":[
|
||||
"Clang: Clean build folder",
|
||||
"Clang: Configure Debug with -fsanitize=memory",
|
||||
"Clang: Build"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Clang: Build",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"cd ${workspaceFolder}/build_clang &&",
|
||||
"cmake --build . --parallel `nproc`",
|
||||
"|| ( printf '\n\n\t\\e[31mERROR: Build failed!\\e[0m\n\n\n' && exit 1 )"
|
||||
],
|
||||
"presentation": {
|
||||
"clear": true
|
||||
},
|
||||
"group": {
|
||||
"kind": "build"
|
||||
},
|
||||
"hide": true
|
||||
},
|
||||
{
|
||||
"label": "Clang: Configure and build Debug",
|
||||
"type": "shell",
|
||||
"command": [
|
||||
"cd ${workspaceFolder} &&",
|
||||
"mkdir -p build_clang && cd build_clang &&",
|
||||
"MSAN_SYMBOLIZER_PATH=/home/LLVM-19.1.0/bin/llvm-symbolizer MSAN_OPTIONS=abort_on_error=1 ./larra_xmpp_tests ; echo \"exit code: $?\"",
|
||||
],
|
||||
"presentation": {
|
||||
"clear": true
|
||||
},
|
||||
"dependsOrder": "sequence",
|
||||
"dependsOn":[
|
||||
"Clang: Clean build folder",
|
||||
"Clang: Configure Debug",
|
||||
"Clang: Build"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Clang: Clean build folder",
|
||||
"type": "shell",
|
||||
"command": "if [ -n \"$(ls -A ${workspaceFolder}/build_clang)\" ]; then rm -rf ${workspaceFolder}/build_clang/*; fi",
|
||||
"hide": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -164,7 +164,7 @@ add_library(larra::larra_xmpp ALIAS larra_xmpp)
|
|||
target_compile_features(larra_xmpp PUBLIC cxx_std_23)
|
||||
|
||||
|
||||
target_compile_options(larra_xmpp PUBLIC -Wno-changes-meaning)
|
||||
target_compile_options(larra_xmpp PUBLIC "$<$<CXX_COMPILER_ID:GNU>:-Wno-changes-meaning>")
|
||||
|
||||
target_include_directories(larra_xmpp PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/library/include>
|
||||
|
|
Loading…
Reference in a new issue