1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2024-10-28 08:49:35 +01:00

misc: improve vscode integration

- adds a task to toggle testing configuration
- removes the test run launch configuration (now a task)
- adds macOS support and fixes gtest CMake integration
- removes the IPC launch configuration as it doesn't work correctly without delaying the client

Change-Id: I89e1f3abd0e050e0bcf205f1331596c660dd0d34
This commit is contained in:
Andreas Traczyk 2024-04-10 17:05:00 -04:00 committed by Adrien Béraud
parent 92341b27b6
commit 6105f4f7ce
3 changed files with 91 additions and 66 deletions

83
.vscode/launch.json vendored
View file

@ -2,77 +2,48 @@
"version": "0.2.0",
"configurations": [
{
"name": "Jami-Tests-Run",
"type": "cppdbg",
"request": "launch",
"program": "/usr/bin/ctest",
"args": ["-V", "-R"],
"cwd": "${workspaceFolder}/build/tests",
"externalConsole": false,
"environment": [
{
"name": "HOME",
"value": "/tmp"
}
]
},
{
"name": "Jami-Client",
"name": "Jami-Client-Debug",
"type": "cppdbg",
"request": "launch",
"program": "",
"linux":{
"MIMode": "gdb",
"program": "${workspaceFolder}/build/jami",
"args": [
"-d",
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "cmake-build",
"miDebuggerPath": "/usr/bin/gdb",
},
"osx": {
"MIMode": "lldb",
"program": "${workspaceFolder}/build/Jami.app/Contents/MacOS/Jami",
"environment": [
{
"name": "Jami-Daemon-Debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/daemon/bin/dbus/jamid",
"args": [
"-cdp",
"name": "NO_COLOR",
"value": "true",
}
],
"stopAtEntry": false,
},
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "cmake-build",
"miDebuggerPath": "/usr/bin/gdb",
}
],
"compounds": [
"externalConsole": false, // A macOS dev may want to set this to true.
},
{
// Using this configuration will require manually reconfiguring the project using
// build.py --no-libwrap, otherwise the daemon executable will not be built and the
// client will not be built with ENABLE_LIBWRAP=False.
"name": "Jami-Client-IPC",
"configurations": [
"Jami-Daemon-Debug",
"Jami-Client",
]
"name": "Jami-Daemon-Debug",
"type": "cppdbg",
"request": "launch",
"linux": {
"MIMode": "gdb",
"program": "${workspaceFolder}/daemon/bin/dbus/jamid",
},
"program": "",
"args": [
"-cdp",
],
"cwd": "${workspaceFolder}",
"preLaunchTask": "cmake-build",
}
]
}

43
.vscode/tasks.json vendored
View file

@ -1,6 +1,27 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "run-tests",
"type": "shell",
"command": "ctest",
"options": {
"cwd": "${workspaceFolder}/build/tests",
"env": {
"HOME": "/tmp"
}
},
"args": [
"-V",
"-R"
],
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": [],
"detail": "Run the tests using CTest."
},
{
"label": "cmake-configure",
"type": "shell",
@ -10,7 +31,19 @@
"-B", "build",
"-DCMAKE_BUILD_TYPE=Debug",
"-DCMAKE_PREFIX_PATH=\"/usr/lib64/qt-jami;/usr/lib/libqt-jami\"",
"-DBUILD_TESTING=True"
],
"group": "build",
"problemMatcher": [],
"detail": "Generate the build system files with CMake."
},
{
"label": "cmake-configure-tests",
"type": "shell",
"command": "cmake",
"args": [
"-S", ".",
"-B", "build",
"-DBUILD_TESTING=${input:buildTestingInput}"
],
"group": "build",
"problemMatcher": [],
@ -48,5 +81,13 @@
"problemMatcher": [],
"detail": "Clean the build directory."
}
],
"inputs": [
{
"id": "buildTestingInput",
"type": "pickString",
"description": "Do you want to enable testing?",
"options": ["True", "False"],
}
]
}

View file

@ -22,15 +22,28 @@ if(MSVC)
googletest
URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.zip
)
if(MSVC)
# for Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif()
FetchContent_MakeAvailable(googletest)
elseif(APPLE)
# Use pkg-config to find gtest on macOS
find_package(PkgConfig REQUIRED)
pkg_search_module(GTEST REQUIRED gtest)
list(APPEND EXTRA_TEST_LIBS ${GTEST_LIBRARIES})
list(APPEND EXTRA_TEST_LIB_DIRS ${GTEST_LIBRARY_DIRS})
# Add the link directories to the target
link_directories(${EXTRA_TEST_LIB_DIRS})
list(APPEND EXTRA_TEST_INCLUDES ${GTEST_INCLUDE_DIRS})
else()
find_package(GTest REQUIRED)
list(APPEND EXTRA_TEST_LIBS gtest)
endif()
set(QML_TEST_LIBS ${QT_LIBS} ${LIBCLIENT_NAME} ${QT_TEST_LIBS})
set(TESTS_INCLUDES
${EXTRA_TEST_INCLUDES}
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/tests/qml
${CMAKE_SOURCE_DIR}/tests/unittests)
@ -91,7 +104,7 @@ set(UNIT_TESTS_SOURCE_FILES
set(ALL_TESTS_LIBS
${QML_TEST_LIBS}
gtest
${EXTRA_TEST_LIBS}
${CLIENT_LIBS})
set(ALL_TESTS_INCLUDES