[qtconnectivity] make bluez mandatory on Linux#51919
Conversation
| "default-features": [ | ||
| { | ||
| "name": "bluez", | ||
| "platform": "linux" | ||
| } | ||
| ], |
There was a problem hiding this comment.
| "default-features": [ | |
| { | |
| "name": "bluez", | |
| "platform": "linux" | |
| } | |
| ], |
The default feature changes behavior to depend on a system-installed dependency.
There was a problem hiding this comment.
@vicroms I see qtbase[xcb] is the default feature on linux which requires system-installed xcb related dependencies, https://github.com/miyanyan/vcpkg/blob/22d9c655dc24ad24c6cac27607005e619ce46740/ports/qtbase/portfile.cmake#L55-L60
and bluez is also required by qtconnectivity on linux by default, I think it's ok to make bluez the default feature
Since Qt 6.5 the Linux peripheral support has two backend alternatives: BlueZ DBus and Bluetooth Kernel API. The DBus backend is the default backend since Qt 6.7.
There was a problem hiding this comment.
The name default features is unfortunately misguiding, they aren't intended to model upstream defaults. They are only intended to be used when otherwise a library would be non-functional (read more in our documentation).
Default features are hard for downstream consumers to disable, they must ensure that all upstream consumers of a library declare default-features: false in their vcpkg.json files, otherwise the default features get re-enabled.
If a feature is completely required, then it should be forcefully enabled in the portfile.cmake. If it's truly optional then it doesn't need to be a default feature.
set(ADDITIONAL_OPTIONS)
if (VCPKG_TARGET_IS_LINUX)
message(WARNING "qtconnectivity[bluez] requires the BlueZ development headers from the system package manager. "
"They can be installed on Debian/Ubuntu systems via sudo apt install libbluetooth-dev.")
list(APPEND ADDITIONAL_OPTIONS FEATURE_bluez)
endif()
vcpkg_cmake_configure(
OPTIONS
${FEATURE_OPTIONS}
${ADDITIONAL_OPTIONS}
)
|
|
||
| vcpkg_check_features(OUT_FEATURE_OPTIONS feature_options | ||
| INVERTED_FEATURES | ||
| bluez CMAKE_DISABLE_FIND_PACKAGE_BlueZ |
There was a problem hiding this comment.
you also need CMAKE_REQUIRE_FIND_PACKAGE in the case the feature is activated
There was a problem hiding this comment.
you als need to control the FEATURE_ cmake flag qt uses for it
There was a problem hiding this comment.
you also need CMAKE_REQUIRE_FIND_PACKAGE in the case the feature is activated
BlueZ is a system package that only provides pkg-config (.pc) files — it has no CMake config. So find_package(BlueZ REQUIRED) always fails, even when libbluetooth-dev is installed.
Qt's build system handles this correctly: qt_find_package(BlueZ PROVIDED_TARGETS PkgConfig::BLUEZ) first tries find_package(BlueZ) without REQUIRED, and when it returns NOTFOUND, falls back to pkg-config lookup which succeeds. Setting CMAKE_REQUIRE_FIND_PACKAGE_BlueZ=ON breaks this fallback by turning a non-fatal NOTFOUND into a hard error before pkg-config ever runs.
There was a problem hiding this comment.
You'll still need the FEATURE_ flag though. Otherwise it is a gamble if the feature is active or not.
There was a problem hiding this comment.
@Neumann-A I removed CMAKE_DISABLE_FIND_PACKAGE_BlueZ, only use FEATURE_bluez
I checked the qt source code, there's a public feature bluez https://github.com/qt/qtconnectivity/blob/76613d577fd094258e1dc09746f39f92047faf79/src/bluetooth/configure.cmake#L44-L47
|
IIUC bluez becomes mandatory on Linux now. Please update the PR title so that it better describes the current changes. |
Co-authored-by: Kai Pastor <dg0yt@darc.de>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
./vcpkg x-add-version --alland committing the result.Fixes #51888
ref: https://doc.qt.io/qt-6/qtbluetooth-index.html