build: generate vcpkg.json on windows
do not allow vcpkg.json to be added to the repo provide a new option VCPKG_QT (default is OFF), to build Qt via vcpkg
This commit is contained in:
committed by
Chris Rizzitello
parent
2c55f4fe06
commit
28957a3fa8
3
.gitignore
vendored
3
.gitignore
vendored
@ -25,6 +25,9 @@ deskflow-config.toml
|
||||
/*.user
|
||||
*.ui.autosave
|
||||
|
||||
# generated vcpkg file
|
||||
vcpkg.json
|
||||
|
||||
#Generic linux files
|
||||
**/*.directory
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
12
REUSE.toml
12
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"
|
||||
|
||||
@ -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)
|
||||
|
||||
12
cmake/vcpkg.json.in
Normal file
12
cmake/vcpkg.json.in
Normal file
@ -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@
|
||||
]
|
||||
}
|
||||
@ -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=<INSTALLPREFIX>`
|
||||
|
||||
### 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\<version>\<msvcinfo>\lib\cmake`
|
||||
3. Add the path of Qt's binary tools to your system path.
|
||||
- Often `C:\Qt\<version>\<msvcinfo>\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`
|
||||
|
||||
|
||||
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
{
|
||||
"dependencies": [
|
||||
"qttranslations",
|
||||
"qtsvg",
|
||||
"gtest",
|
||||
"openssl"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user