diff --git a/.gitignore b/.gitignore index 0c4fae104..a071dd7d5 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,9 @@ deskflow-config.toml /*.user *.ui.autosave +# generated vcpkg file +vcpkg.json + #Generic linux files **/*.directory diff --git a/CMakeLists.txt b/CMakeLists.txt index 04c8a4dea..34aa389a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,15 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git) endif() endif() +#generate vcpkg file if needed +if(WIN32) + option (VCPKG_QT "Use Qt from VCPKG" OFF) + if(VCPKG_QT) + set(QT_LIBS ", \"qttranslations\", \"qtsvg\"") + endif() + configure_file(cmake/vcpkg.json.in ${CMAKE_SOURCE_DIR}/vcpkg.json @ONLY) +endif() + #Define our project project( deskflow diff --git a/REUSE.toml b/REUSE.toml index 5a037f4d3..085718e4a 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -54,18 +54,6 @@ precedence = "override" SPDX-FileCopyrightText = "Deskflow Developers" SPDX-License-Identifier = "MIT" -[[annotations]] -path = "vcpkg.json" -precedence = "override" -SPDX-FileCopyrightText = "Deskflow Developers" -SPDX-License-Identifier = "MIT" - -[[annotations]] -path = "vcpkg-configuration.json" -precedence = "override" -SPDX-FileCopyrightText = "Deskflow Developers" -SPDX-License-Identifier = "MIT" - [[annotations]] path = "doc/**" precedence = "override" diff --git a/cmake/Libraries.cmake b/cmake/Libraries.cmake index 18f952a96..f76da2417 100644 --- a/cmake/Libraries.cmake +++ b/cmake/Libraries.cmake @@ -26,7 +26,7 @@ macro(configure_libs) # Define the location of Qt deployment tool if(WIN32) - if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND NOT VCPKG_INSTALL_DIR STREQUAL "") + if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND VCPKG_QT) find_program(DEPLOYQT windeployqt.debug.bat) else() find_program(DEPLOYQT windeployqt) diff --git a/cmake/vcpkg.json.in b/cmake/vcpkg.json.in new file mode 100644 index 000000000..d2615de26 --- /dev/null +++ b/cmake/vcpkg.json.in @@ -0,0 +1,12 @@ +{ + "$comment": "Generated file do not hand edit", + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "deskflow", + "version": "@DESKFLOW_VERSION_MAJOR@.@DESKFLOW_VERSION_MINOR@.@DESKFLOW_VERSION_PATCH@.@DESKFLOW_VERSION_TWEAK@", + "builtin-baseline": "d5ec528843d29e3a52d745a64b469f810b2cedbf", + "dependencies": [ + "gtest", + "openssl" + @QT_LIBS@ + ] +} diff --git a/doc/dev/build.md b/doc/dev/build.md index 3362cb52a..15e89af27 100644 --- a/doc/dev/build.md +++ b/doc/dev/build.md @@ -33,15 +33,32 @@ CMake options: | BUILD_UNIFIED | Build unified binary (client+server) | OFF | | | ENABLE_COVERAGE | Enable test coverage | OFF | `gcov` | | SKIP_BUILD_TESTS | Skip running of tests at build time | OFF | | +| VCPKG_QT | Build Qt w/ vcpkg (windows only) | OFF | | Example cmake configuration. `cmake -S. -Bbuild -DCMAKE_INSTALL_PREFIX=` ### Windows Configuration - It is recommended to use vcpkg to get the dependencies to install. The first configuration will build all depends while configuing the project. If you do not want to instal qt via vcpkg you should remove the qt packages from vcpkg.json in the of the project BEFORE attempting to configure the project. + It is recommended to use vcpkg to install the dependencies. The first time you configure Deskflow, all dependencies other than Qt will be built. If you don't want to use vcpkg, you must manually setup the dependencies. However, that will not be covered by this document. +#### Windows and Qt + There are two ways you can install [Qt] on Windows (vcpkg or Qt online installer). The default configuration expects you to use the Qt online installer. You should not install Qt in both ways, as having both can cause some weird things to happen, like Qt getting libs from one install and plugins from the other. When switching between them, remove the previous install first. + +##### System Qt + + 1. Download and install the [Qt] online installer from their website. + 2. Add the path of Qt's cmake files to your system path. (Skipping this may require you provide this path to cmake via `Qt6_DIR` at configure time) + - Often `C:\Qt\\\lib\cmake` + 3. Add the path of Qt's binary tools to your system path. + - Often `C:\Qt\\\bin` + +##### Vcpkg managed Qt + 1. Add the option `-DVCPKG_QT=ON` to your cmake configuration command (i.e `cmake -S. -Bbuild -DVCPKG_QT=ON ...`) or if using an IDE, look for the option where you configure the project, have the IDE run cmake again. + 2. Once the configuration starts, you should see a lot more packages vcpkg will build. Building Qt takes a long time (potentially hours), so go find something else to do for a while. + 3. If you want to use the system Qt again, you must delete the `vcpkg.json` generated in the project root and the `build` folder and reconfigure the project from scratch. + ## Build -After Configuring you should be able to run make to build all targets. +After configuring you should be able to run make to build all targets. `cmake --build build` diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json deleted file mode 100644 index c6f490f59..000000000 --- a/vcpkg-configuration.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "default-registry": { - "kind": "git", - "baseline": "d5ec528843d29e3a52d745a64b469f810b2cedbf", - "repository": "https://github.com/microsoft/vcpkg" - }, - "registries": [ - { - "kind": "artifact", - "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", - "name": "microsoft" - } - ] -} diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index be88d997a..000000000 --- a/vcpkg.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "dependencies": [ - "qttranslations", - "qtsvg", - "gtest", - "openssl" - ] -}