From 50a6108e553d998e568a4c90f57b37f6222a1360 Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Sat, 30 Mar 2024 16:59:39 -0300 Subject: [PATCH 01/18] CMake: Adds C++ as project language --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be08005d..ab7739f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.4) -project(LibVNCServer VERSION 0.9.14 LANGUAGES C) +project(LibVNCServer VERSION 0.9.14 LANGUAGES C CXX) include(CheckFunctionExists) include(CheckSymbolExists) include(CheckIncludeFile) @@ -25,6 +25,8 @@ set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_CXX_STANDARD 17) + if(CMAKE_GENERATOR MATCHES "Unix Makefiles|Ninja") # some LSP servers expect compile_commands.json in the project root add_custom_target( From ea4c2fab0866a3206be16596de5dd363aa23e452 Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Sat, 30 Mar 2024 17:07:14 -0300 Subject: [PATCH 02/18] CMake: Adds WITH_QT option to build Qt client example --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab7739f4..2a3b3cd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,7 @@ option(WITH_SASL "Build with SASL support" ON) option(WITH_XCB "Build with XCB support" ON) option(WITH_EXAMPLES "Build examples" ON) option(WITH_TESTS "Build tests" ON) - +option(WITH_QT "Build the Qt client example" ON) if(WITH_ZLIB) From bb485e54447c9c3c2adc2b87ca06d1a929d6c94b Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Sat, 30 Mar 2024 17:08:09 -0300 Subject: [PATCH 03/18] Examples: Adds qt5client.cpp --- examples/client/qt5client.cpp | 133 ++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 examples/client/qt5client.cpp diff --git a/examples/client/qt5client.cpp b/examples/client/qt5client.cpp new file mode 100644 index 00000000..688d8af4 --- /dev/null +++ b/examples/client/qt5client.cpp @@ -0,0 +1,133 @@ +/* + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include +#include "rfb/rfbclient.h" +#include + +class VncViewer : public QWidget +{ + //if you want to make use of signals/slots, uncomment the line bellow: + //Q_OBJECT +public: + VncViewer(QWidget *parent = nullptr) {}; + virtual ~VncViewer() {}; + void start(); + std::string serverIp; + int serverPort; + std::thread *vncThread() const; + void paintEvent(QPaintEvent *event) override; + +private: + QImage m_image; + rfbClient *cl; + std::thread *m_vncThread; + static void finishedFramebufferUpdateStatic(rfbClient *cl); + void finishedFramebufferUpdate(rfbClient *cl); +}; + +void VncViewer::finishedFramebufferUpdateStatic(rfbClient *cl) +{ + VncViewer *ptr = (VncViewer *) rfbClientGetClientData(cl, nullptr); + ptr->finishedFramebufferUpdate(cl); +} + +void VncViewer::finishedFramebufferUpdate(rfbClient *cl) +{ + m_image = QImage(cl->frameBuffer, cl->width, cl->height, QImage::Format_RGB16); + + update(); +} +void VncViewer::paintEvent(QPaintEvent *event) +{ + event->accept(); + + QPainter painter(this); + painter.drawImage(this->rect(), m_image); +} + +void VncViewer::start() +{ + cl = rfbGetClient(8, 3, 4); + cl->format.depth = 24; + cl->format.depth = 16; + cl->format.bitsPerPixel = 16; + cl->format.redShift = 11; + cl->format.greenShift = 5; + cl->format.blueShift = 0; + cl->format.redMax = 0x1f; + cl->format.greenMax = 0x3f; + cl->format.blueMax = 0x1f; + cl->appData.compressLevel = 9; + cl->appData.qualityLevel = 1; + cl->appData.encodingsString = "tight ultra"; + cl->FinishedFrameBufferUpdate = finishedFramebufferUpdateStatic; + cl->canHandleNewFBSize = TRUE; + cl->serverHost = strdup(serverIp.c_str()); + cl->serverPort = serverPort; + cl->appData.useRemoteCursor = TRUE; + + rfbClientSetClientData(cl, nullptr, this); + + if (rfbInitClient(cl, 0, nullptr)) { + } else { + std::cout << "[INFO] disconnected" << std::endl; + return; + } + + m_vncThread = new std::thread([this]() { + while (true) { + int i = WaitForMessage(cl, 500); + if (i < 0) { + std::cout << "[INFO] disconnected" << std::endl; + rfbClientCleanup(cl); + break; + } + + if (i && !HandleRFBServerMessage(cl)) { + std::cout << "[INFO] disconnected" << std::endl; + rfbClientCleanup(cl); + break; + } + }; + }); +} + +int main(int argc, char *argv[]) +{ + if(argc < 3) { + std::cout << "Usage: " + << argv[0] + << " " + << " " + << "\n"; + return 1; + } + + QApplication a(argc, argv); + VncViewer vncViewer; + vncViewer.serverIp = std::string{argv[1]}; + vncViewer.serverPort = std::atoi(argv[2]); + vncViewer.show(); + vncViewer.start(); + return a.exec(); +} From 054c287fee20dd97c3a2cf493060bb3f301447f9 Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Sat, 30 Mar 2024 17:19:25 -0300 Subject: [PATCH 04/18] CMake: adds specific way of building Qt client example --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a3b3cd0..5404178b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -658,6 +658,13 @@ if(WITH_EXAMPLES) set_target_properties(client_examples_${e} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples/client) target_link_libraries(client_examples_${e} vncclient ${CMAKE_THREAD_LIBS_INIT} ${SDL2_LIBRARY} ${GTK2_LIBRARIES} ${FFMPEG_LIBRARIES} ${LIBSSHTUNNEL_LIBRARY}) endforeach(e ${LIBVNCCLIENT_EXAMPLES}) + + if(Qt5Widgets_FOUND AND WITH_QT) + add_executable(client_examples_qt5client ${LIBVNCCLIEXAMPLE_DIR}/qt5client.cpp ${LIBVNCCLIEXAMPLE_DIR}/${qt5client_EXTRA_SOURCES}) + set_target_properties(client_examples_qt5client PROPERTIES OUTPUT_NAME qt5client) + set_target_properties(client_examples_qt5client PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples/client) + target_link_libraries(client_examples_qt5client vncclient ${CMAKE_THREAD_LIBS_INIT} Qt5::Widgets) + endif(Qt5Widgets_FOUND AND WITH_QT) endif(WITH_EXAMPLES) # From c6e0e5709fee300125c8b6f7afa9b9e95a99c9d5 Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Sat, 30 Mar 2024 17:22:42 -0300 Subject: [PATCH 05/18] CMake: try to find Qt if needed --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5404178b..4ff21a27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,6 +149,10 @@ if(WITH_GTK) find_package(GTK2) endif(WITH_GTK) +if(WITH_QT) + find_package(Qt5 COMPONENTS Core Widgets REQUIRED) +endif(WITH_QT) + if(WITH_LIBSSHTUNNEL) find_path(LIBSSHTUNNEL_INCLUDE_DIR libsshtunnel.h) find_library(LIBSSHTUNNEL_LIBRARY sshtunnel) From 490fab2eaff54835688899c2cc6ed7a77a7568ac Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Sat, 30 Mar 2024 17:37:12 -0300 Subject: [PATCH 06/18] CMake: makes Qt not required, quiet if not found --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ff21a27..d419fbce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,7 +150,7 @@ if(WITH_GTK) endif(WITH_GTK) if(WITH_QT) - find_package(Qt5 COMPONENTS Core Widgets REQUIRED) + find_package(Qt5 COMPONENTS Core Widgets QUIET) endif(WITH_QT) if(WITH_LIBSSHTUNNEL) From 5e93082ca1284b2ef43e737e216c25e756b89fbb Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Sat, 30 Mar 2024 17:57:09 -0300 Subject: [PATCH 07/18] CMake: removes CXX as language --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d419fbce..722d944e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.4) -project(LibVNCServer VERSION 0.9.14 LANGUAGES C CXX) +project(LibVNCServer VERSION 0.9.14 LANGUAGES C) include(CheckFunctionExists) include(CheckSymbolExists) include(CheckIncludeFile) @@ -25,7 +25,6 @@ set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -set(CMAKE_CXX_STANDARD 17) if(CMAKE_GENERATOR MATCHES "Unix Makefiles|Ninja") # some LSP servers expect compile_commands.json in the project root From efa5cd9840e9f956b229d90953a9ac13849bf7be Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Sat, 30 Mar 2024 17:57:51 -0300 Subject: [PATCH 08/18] CMake: checks if we have C++ compiler before setting standard --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 722d944e..01518aa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,9 @@ set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +if(${CMAKE_CXX_COMPILER} NOT STREQUAL "") + set(CMAKE_CXX_STANDARD 17) +endif(${CMAKE_CXX_COMPILER} NOT STREQUAL "") if(CMAKE_GENERATOR MATCHES "Unix Makefiles|Ninja") # some LSP servers expect compile_commands.json in the project root From ec852730ec3db94a18807a22db5b0de37354d1ad Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Sat, 30 Mar 2024 18:22:05 -0300 Subject: [PATCH 09/18] CMake: checks C++ compiler before setting project languages I could not find a better solution. It seems like the languages must be set before almost everything. --- CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01518aa0..3c60429b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,13 @@ cmake_minimum_required(VERSION 3.4) -project(LibVNCServer VERSION 0.9.14 LANGUAGES C) +set(PROJECT_LANGUAGES C) + +if(NOT ${CMAKE_CXX_COMPILER} STREQUAL "") + set(CMAKE_CXX_STANDARD 17) + set(PROJECT_LANGUAGES C CXX) +endif(NOT ${CMAKE_CXX_COMPILER} STREQUAL "") + +project(LibVNCServer VERSION 0.9.14 LANGUAGES ${PROJECT_LANGUAGES}) include(CheckFunctionExists) include(CheckSymbolExists) include(CheckIncludeFile) @@ -25,9 +32,6 @@ set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -if(${CMAKE_CXX_COMPILER} NOT STREQUAL "") - set(CMAKE_CXX_STANDARD 17) -endif(${CMAKE_CXX_COMPILER} NOT STREQUAL "") if(CMAKE_GENERATOR MATCHES "Unix Makefiles|Ninja") # some LSP servers expect compile_commands.json in the project root From abe34620f6b6571526c400b345a4067fe65edca4 Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Tue, 2 Apr 2024 10:48:44 -0300 Subject: [PATCH 10/18] CMake: check if C++ compiler defined instead of string comparison --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c60429b..919f8134 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.4) set(PROJECT_LANGUAGES C) -if(NOT ${CMAKE_CXX_COMPILER} STREQUAL "") +if(DEFINED CMAKE_CXX_COMPILER) set(CMAKE_CXX_STANDARD 17) set(PROJECT_LANGUAGES C CXX) -endif(NOT ${CMAKE_CXX_COMPILER} STREQUAL "") +endif(DEFINED CMAKE_CXX_COMPILER) project(LibVNCServer VERSION 0.9.14 LANGUAGES ${PROJECT_LANGUAGES}) include(CheckFunctionExists) From ddd71aae20dcb4093e3453d59bcc00332e6f944f Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Tue, 2 Apr 2024 10:50:00 -0300 Subject: [PATCH 11/18] CMake: appends CXX to languages, in a better syntax As suggested by dantti --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 919f8134..718b96c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ set(PROJECT_LANGUAGES C) if(DEFINED CMAKE_CXX_COMPILER) set(CMAKE_CXX_STANDARD 17) - set(PROJECT_LANGUAGES C CXX) + list(APPEND PROJECT_LANGUAGES CXX) endif(DEFINED CMAKE_CXX_COMPILER) project(LibVNCServer VERSION 0.9.14 LANGUAGES ${PROJECT_LANGUAGES}) From 4137cab13e56cc9e186f7850e59beac780206918 Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Tue, 2 Apr 2024 10:52:37 -0300 Subject: [PATCH 12/18] Examples: changes to static_cast in Qt5 client example As suggested by @dantti --- examples/client/qt5client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/client/qt5client.cpp b/examples/client/qt5client.cpp index 688d8af4..ca67fd6a 100644 --- a/examples/client/qt5client.cpp +++ b/examples/client/qt5client.cpp @@ -47,7 +47,7 @@ class VncViewer : public QWidget void VncViewer::finishedFramebufferUpdateStatic(rfbClient *cl) { - VncViewer *ptr = (VncViewer *) rfbClientGetClientData(cl, nullptr); + VncViewer *ptr = static_cast(rfbClientGetClientData(cl, nullptr)); ptr->finishedFramebufferUpdate(cl); } From c4c26ece1c469bd45dcbbc4aa7cbb1a7270a3afb Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Tue, 2 Apr 2024 19:01:41 -0300 Subject: [PATCH 13/18] Examples: adds description to Qt example --- examples/client/qt5client.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/examples/client/qt5client.cpp b/examples/client/qt5client.cpp index ca67fd6a..77da00c6 100644 --- a/examples/client/qt5client.cpp +++ b/examples/client/qt5client.cpp @@ -16,6 +16,17 @@ * Boston, MA 02111-1307, USA. */ + /* + * This is an example on how to make a simple VNC client with + * Qt5 Widgets. It suitable for desktop apps, but may not be + * good for mobile. + * It does not implement any form of cryptography, + * authentication support, client-side cursors or framebuffer + * resizing. If you want to make this a part of your + * application, please notice that you may need to change + * the while(true) loop to disconnect the client. + */ + #include #include #include From c013736cd9d648301c641b15896ad17e493044e3 Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Tue, 2 Apr 2024 19:02:36 -0300 Subject: [PATCH 14/18] Examples: Qt example can't handle new fb size --- examples/client/qt5client.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/client/qt5client.cpp b/examples/client/qt5client.cpp index 77da00c6..078f42ac 100644 --- a/examples/client/qt5client.cpp +++ b/examples/client/qt5client.cpp @@ -92,7 +92,6 @@ void VncViewer::start() cl->appData.qualityLevel = 1; cl->appData.encodingsString = "tight ultra"; cl->FinishedFrameBufferUpdate = finishedFramebufferUpdateStatic; - cl->canHandleNewFBSize = TRUE; cl->serverHost = strdup(serverIp.c_str()); cl->serverPort = serverPort; cl->appData.useRemoteCursor = TRUE; From 02c836393b06cb95de6a6208aa9fa5fa472ed2fd Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Tue, 2 Apr 2024 19:24:15 -0300 Subject: [PATCH 15/18] Examples: adds additional condition to build Qt example This is need to remove the following message: 'CMake Error: Cannot determine link language for target' --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 718b96c5..b6161638 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -669,12 +669,12 @@ if(WITH_EXAMPLES) target_link_libraries(client_examples_${e} vncclient ${CMAKE_THREAD_LIBS_INIT} ${SDL2_LIBRARY} ${GTK2_LIBRARIES} ${FFMPEG_LIBRARIES} ${LIBSSHTUNNEL_LIBRARY}) endforeach(e ${LIBVNCCLIENT_EXAMPLES}) - if(Qt5Widgets_FOUND AND WITH_QT) + if(Qt5Widgets_FOUND AND WITH_QT AND DEFINED CMAKE_CXX_COMPILER) add_executable(client_examples_qt5client ${LIBVNCCLIEXAMPLE_DIR}/qt5client.cpp ${LIBVNCCLIEXAMPLE_DIR}/${qt5client_EXTRA_SOURCES}) set_target_properties(client_examples_qt5client PROPERTIES OUTPUT_NAME qt5client) set_target_properties(client_examples_qt5client PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples/client) target_link_libraries(client_examples_qt5client vncclient ${CMAKE_THREAD_LIBS_INIT} Qt5::Widgets) - endif(Qt5Widgets_FOUND AND WITH_QT) + endif(Qt5Widgets_FOUND AND WITH_QT AND DEFINED CMAKE_CXX_COMPILER) endif(WITH_EXAMPLES) # From d7ae2265f8c68ca5b43d238d56af9dda1d1e2062 Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Wed, 3 Apr 2024 09:28:10 -0300 Subject: [PATCH 16/18] CMake: adds comment about C++ example (Qt client) --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b6161638..5f8c3e39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -669,6 +669,10 @@ if(WITH_EXAMPLES) target_link_libraries(client_examples_${e} vncclient ${CMAKE_THREAD_LIBS_INIT} ${SDL2_LIBRARY} ${GTK2_LIBRARIES} ${FFMPEG_LIBRARIES} ${LIBSSHTUNNEL_LIBRARY}) endforeach(e ${LIBVNCCLIENT_EXAMPLES}) + #This example must have its own building instructions, + #apart from the other examples because it is written in + #C++, so it has a distinct file extension and depends on + #a C++ compiler if(Qt5Widgets_FOUND AND WITH_QT AND DEFINED CMAKE_CXX_COMPILER) add_executable(client_examples_qt5client ${LIBVNCCLIEXAMPLE_DIR}/qt5client.cpp ${LIBVNCCLIEXAMPLE_DIR}/${qt5client_EXTRA_SOURCES}) set_target_properties(client_examples_qt5client PROPERTIES OUTPUT_NAME qt5client) From fa6a25bb4cbcb3edfdbc0e75810824dd6248f28f Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Wed, 3 Apr 2024 09:35:00 -0300 Subject: [PATCH 17/18] Examples: adds CMake remarks to Qt client example --- examples/client/qt5client.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/client/qt5client.cpp b/examples/client/qt5client.cpp index 078f42ac..6dfaf4f9 100644 --- a/examples/client/qt5client.cpp +++ b/examples/client/qt5client.cpp @@ -25,6 +25,12 @@ * resizing. If you want to make this a part of your * application, please notice that you may need to change * the while(true) loop to disconnect the client. + * + * To build this example with all the other components of + * libvncserver, you may need to explicitly define a C++ + * compiler and the path to Qt libs when calling CMake. + * e.g. cmake -DCMAKE_PREFIX_PATH=~/Qt/5.15.2/gcc_64 + * -DCMAKE_CXX_COMPILER=g++ */ #include From 9a208856142223fcf0f96c5a708fbae7658fa84c Mon Sep 17 00:00:00 2001 From: Nicolas Morais Date: Wed, 3 Apr 2024 09:36:43 -0300 Subject: [PATCH 18/18] CMake: changes Qt5::Widgets to Qt5Widgets_LIBRARIES Just for standardization --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f8c3e39..9c453d02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -677,7 +677,7 @@ if(WITH_EXAMPLES) add_executable(client_examples_qt5client ${LIBVNCCLIEXAMPLE_DIR}/qt5client.cpp ${LIBVNCCLIEXAMPLE_DIR}/${qt5client_EXTRA_SOURCES}) set_target_properties(client_examples_qt5client PROPERTIES OUTPUT_NAME qt5client) set_target_properties(client_examples_qt5client PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/examples/client) - target_link_libraries(client_examples_qt5client vncclient ${CMAKE_THREAD_LIBS_INIT} Qt5::Widgets) + target_link_libraries(client_examples_qt5client vncclient ${CMAKE_THREAD_LIBS_INIT} ${Qt5Widgets_LIBRARIES}) endif(Qt5Widgets_FOUND AND WITH_QT AND DEFINED CMAKE_CXX_COMPILER) endif(WITH_EXAMPLES)