From 99063577d2c6f0b876be4ba772a602728c9740bf Mon Sep 17 00:00:00 2001 From: Ake Hedman Date: Wed, 25 Sep 2024 15:46:04 +0200 Subject: [PATCH] emoved switch --- .vscode/launch.json | 8 ++++++++ .vscode/settings.json | 26 +++++++++++++++++++------- .vscode/tasks.json | 2 +- CMakeLists.txt | 27 +++++++++++++++++++-------- 4 files changed, 47 insertions(+), 16 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 9af76808..e58cef27 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -46,6 +46,14 @@ "preLaunchTask": "g++ build active file", "miDebuggerPath": "/usr/bin/gdb", "visualizerFile": "/home/akhe/.config/Code/User/workspaceStorage/b3a88788bb1e8a32eb6392485a993de5/tonka3000.qtvsctools/qt.natvis.xml" + }, + { + "type": "cmake", + "request": "launch", + "name": "Debug portfile(s)", + "cmakeDebugType": "external", + "pipeName": "\\\\.\\pipe\\vcpkg_ext_portfile_dbg", + "preLaunchTask": "Debug vcpkg commands" } ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index ed7076d1..94c94a97 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -97,12 +97,14 @@ "**/node_modules/*/**": true, "**/.hg/store/**": true }, - "cmake.configureArgs": [ - "-DVCPKG_HOST_TRIPLET=x64-windows-static", - "-DVCPKG_TARGET_TRIPLET=x64-windows-static", - "-DQT_PATH=G:/Qt/", - "-DCMAKE_TOOLCHAIN_FILE=G:/akhe/development/vcpkg/scripts/buildsystems/vcpkg.cmake", - "-DVCPKG_ROOT=G:/akhe/development/vcpkg" + "cmake.configureArgs": [ + "-DVCPKG_HOST_TRIPLET=x64-windows-static", + "-DQT_PATH=G:/Qt/", + "-DCMAKE_TOOLCHAIN_FILE=G:/vcpkg/scripts/buildsystems/vcpkg.cmake", + "-DVCPKG_ROOT=G:/vcpkg", + "-DVCPKG_TARGET_TRIPLET=", + "-DVCPKG_APPLOCAL_DEPS=ON", + "-DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON" ], "cSpell.language": "sv,en", "cSpell.words": [ @@ -111,5 +113,15 @@ "cmake.clearOutputBeforeBuild": false, "cmake.configureEnvironment": { "CMAKE_PREFIX_PATH": "~/Qt/6.7.2/gcc_64" - } + }, + "vcpkg.general.enable": true, + "vcpkg.target.hostTriplet": "x64-windows", + "vcpkg.target.defaultTriplet": "", + "vcpkg.target.useStaticLib": false, + "cmake.configureSettings": { + "CMAKE_TOOLCHAIN_FILE": "G:\\vcpkg/scripts/buildsystems/vcpkg.cmake" + }, + "vcpkg.target.installDependencies": true, + "vcpkg.target.preferSystemLibs": false, + "vcpkg.target.useManifest": false } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 90cf1b5e..323b5e28 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -50,7 +50,7 @@ "command": "cd build; make clean; export CMAKE_PREFIX_PATH=~/Qt/5.15.2/gcc_64:$CMAKE_PREFIX_PATH; cmake -DCMAKE_BUILD_TYPE=Debug .. ; make -j4 -Wall", "args": [], "group": { - "kind": "build", + "kind": "build" }, "problemMatcher": { "owner": "cpp", diff --git a/CMakeLists.txt b/CMakeLists.txt index 31563492..f14be308 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ # # windows # ------- -# cmake .. -G "Visual Studio 17 2022" -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=G:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_PREFIX_PATH=G:\Qt\5.15.2\msvc2019_64\ +# cmake .. -G "Visual Studio 17 2022" -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE=G:\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_PREFIX_PATH=G:\Qt\6.7.2\msvc2019_64\ # cmake --build . --config Debug # set PATH=G:\Qt\Qt-6.6.2\msvc2019_64\bin;%PATH% # @@ -38,12 +38,17 @@ project(vscp-works-qt LANGUAGES CXX C) option(USE_SSL "Use SSL" TRUE) ## --- C++14 build flags --- -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS ON) # Generate position-independent code (-fPIC on UNIX) -set(CMAKE_POSITION_INDEPENDENT_CODE ON) +#set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +set_target_properties(${PROJECT_NAM} PROPERTIES + WIN32_EXECUTABLE ON + MACOSX_BUNDLE ON +) # --- System Libraries --- include(GNUInstallDirs) @@ -60,7 +65,7 @@ file(TO_CMAKE_PATH "$ENV{VSCP_ROOT}" VSCP_PATH) message(STATUS "VSCP path = $ENV{VSCP_ROOT}") file(TO_CMAKE_PATH "$ENV{QT_ROOT_DIR}" QT_PATH) -message(STATUS "Qt path = $ENV{QT_PATH}") +message(STATUS "QT_ROOT_DIR = $ENV{QT_ROOT_DIR}") if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) @@ -607,7 +612,8 @@ if (MSVC) find_path(MOSQUITTO_INCLUDE_DIR mosquitto.h) message(STATUS "Include: ${MOSQUITTO_INCLUDE_DIR}") - include_directories( PUBLIC ./src + include_directories( PUBLIC + ./src ./build ./ui $ENV{VSCP_ROOT}/src/vscp/common/ @@ -621,7 +627,7 @@ if (MSVC) ${PThreads4W_INCLUDE_DIR} ${CMAKE_BINARY_DIR} ${OPENSSL_INCLUDE_DIR} - ${MOSQUITTO_INCLUDE_DIRS} + ${MOSQUITTO_INCLUDE_DIRS}cd bui ${LIBWEBSOCKETS_INCLUDE_DIR} ${EXPAT_INCLUDE_DIRS} ${DLFCN_INCLUDES} @@ -630,7 +636,8 @@ if (MSVC) ${CURL_INCLUDE_DIR} ) else() - include_directories( PUBLIC ./src + include_directories( PUBLIC + ./src ./build ./ui third_party/mqtt @@ -663,7 +670,11 @@ if (MSVC) message(STATUS "lib websockets lib: ${LIBWEBSOCKETS_LIBRARY_DIR} --- ${VCPKG_ROOT}/installed/x64-windows/lib/${LIBWEBSOCKETS_LIBRARIES}") link_directories(${LIBWEBSOCKETS_LIBRARY_DIR}) -target_link_libraries(${PROJECT_NAME} PRIVATE +target_link_libraries(${PROJECT_NAME} PRIVATE + Qt6::Widgets + Qt6::Qml + Qt6::Sql + Qt6::Charts PThreads4W::PThreads4W OpenSSL::SSL OpenSSL::Crypto