Skip to content

Commit 50effaa

Browse files
committed
Add -DWITH_BUILD_QT CMake option and --build-qt release-tool flags to build Qt6 via vcpkg instead of using binaries from the system
1 parent ff09ff2 commit 50effaa

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
cmake_minimum_required(VERSION 3.16.0)
1818

19-
project(KeePassXC)
20-
set(APP_ID "org.keepassxc.${PROJECT_NAME}")
21-
2219
# Version Number
2320
set(KEEPASSXC_VERSION_MAJOR "2")
2421
set(KEEPASSXC_VERSION_MINOR "8")
@@ -49,6 +46,7 @@ option(WITH_COVERAGE "Use to build with coverage tests (GCC only)." OFF)
4946
option(WITH_APP_BUNDLE "Enable Application Bundle for macOS" ON)
5047
option(WITH_CCACHE "Use ccache for build" OFF)
5148
option(WITH_X11 "Enable building with X11 dependencies" ON)
49+
option(WITH_BUILD_QT "Build Qt6 as a dependency" OFF)
5250

5351
# Advanced Features Control
5452
option(KPXC_MINIMAL "Build KeePassXC with the minimal feature set required for basic usage" OFF)
@@ -89,6 +87,16 @@ add_feature_info("Networking" KPXC_FEATURE_NETWORK "Code that can reach out to e
8987
add_feature_info("Update Checks" KPXC_FEATURE_UPDATES "Periodic update checks can be performed")
9088
add_feature_info("Documentation" KPXC_FEATURE_DOCS "Offline documentation")
9189

90+
# VCPKG features (must come before project())
91+
if(WITH_BUILD_QT)
92+
list(APPEND VCPKG_MANIFEST_FEATURES qt)
93+
unset(ENV{Qt6_DIR})
94+
endif()
95+
96+
# Initialize project
97+
project(KeePassXC)
98+
set(APP_ID "org.keepassxc.${PROJECT_NAME}")
99+
92100
# Retrieve git HEAD revision hash
93101
set(GIT_HEAD_OVERRIDE "" CACHE STRING "Manually set the Git HEAD hash when missing (eg, when no .git folder exists)")
94102
execute_process(COMMAND git rev-parse --short=7 HEAD

release-tool.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ def setup_arg_parser(cls, parser: argparse.ArgumentParser):
645645
parser.add_argument('-y', '--yes', help='Bypass confirmation prompts.', action='store_true')
646646
parser.add_argument('--with-tests', help='Build and run tests.', action='store_true')
647647
parser.add_argument('--minimal', help='Build with minimal feature set.', action='store_true')
648+
parser.add_argument('-q', '--build-qt', help='Build Qt6 dependency.', action='store_true')
648649

649650
if sys.platform == 'darwin':
650651
parser.add_argument('--macos-target', default=12, metavar='MACOSX_DEPLOYMENT_TARGET',
@@ -702,6 +703,8 @@ def run(self, version, src_dir, output_dir, tag_name, snapshot, cmake_generator,
702703

703704
if not kwargs['use_system_deps'] and not kwargs.get('docker_image'):
704705
cmake_opts.append(f'-DCMAKE_TOOLCHAIN_FILE={self._get_vcpkg_toolchain_file()}')
706+
if kwargs['build_qt']:
707+
cmake_opts.append('-DWITH_BUILD_QT=ON')
705708

706709
if snapshot:
707710
logger.info('Building a snapshot from HEAD.')

vcpkg.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,17 @@
2424
"name": "libxkbcommon",
2525
"platform": "linux | freebsd"
2626
}
27-
]
27+
],
28+
"features": {
29+
"qt": {
30+
"description": "Build Qt6 dependency.",
31+
"dependencies": [
32+
{
33+
"name": "qt",
34+
"version>=": "6.11.0",
35+
"default-features": false
36+
}
37+
]
38+
}
39+
}
2840
}

0 commit comments

Comments
 (0)