Add features bluetooth and nfc

* qtconnectivity contains two independent implementations.
* With this change additional features are added to enable
  fine-grained configuration for an efficient build when
  only one implementation is needed.

Fixes: QTBUG-132465
Pick-to: 6.9
Change-Id: I7b5af716746855a4675ca939d2bde3aac2da8530
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Lars Schmertmann 2025-02-06 19:13:47 +01:00
parent 6b011b61f3
commit 42cb59dcde
7 changed files with 68 additions and 11 deletions

View File

@ -11,14 +11,9 @@ project(QtConnectivity
LANGUAGES CXX C
)
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core Network)
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core)
find_package(Qt6 ${PROJECT_VERSION} QUIET CONFIG OPTIONAL_COMPONENTS
DBus Gui Widgets Quick QuickControls2)
Network DBus Gui Widgets Quick QuickControls2)
qt_internal_project_setup()
if(NOT TARGET Qt::Network)
message(NOTICE "Skipping the build as the condition \"TARGET Qt::Network\" is not met.")
return()
endif()
qt_build_repo()

33
configure.cmake Normal file
View File

@ -0,0 +1,33 @@
# Copyright (C) 2025 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#### Inputs
#### Libraries
#### Tests
#### Features
qt_feature("bluetooth" PUBLIC
LABEL "Qt Bluetooth"
PURPOSE "The Bluetooth API provides connectivity between Bluetooth enabled devices."
CONDITION TARGET Qt::Network
)
qt_feature("nfc" PUBLIC
LABEL "Qt NFC"
PURPOSE "The NFC API provides connectivity between NFC enabled devices."
)
qt_configure_add_summary_section(NAME "Qt Connectivity")
qt_configure_add_summary_entry(ARGS "bluetooth")
qt_configure_add_summary_entry(ARGS "nfc")
qt_configure_end_summary_section() # end of "Qt Connectivity" section

5
qt_cmdline.cmake Normal file
View File

@ -0,0 +1,5 @@
# Copyright (C) 2025 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
qt_commandline_subconfig(src/bluetooth)
qt_commandline_subconfig(src/nfc)

View File

@ -1,8 +1,17 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(bluetooth)
add_subdirectory(nfc)
# Evaluate features to decide what to build.
# The config files will be written in the src/global module.
qt_feature_evaluate_features("${CMAKE_CURRENT_SOURCE_DIR}/../configure.cmake")
add_subdirectory(global)
if(QT_FEATURE_bluetooth)
add_subdirectory(bluetooth)
endif()
if(QT_FEATURE_nfc)
add_subdirectory(nfc)
endif()
if(ANDROID)
add_subdirectory(android)
endif()

View File

@ -58,7 +58,7 @@ qt_feature("winrt_bt" PRIVATE
CONDITION WIN32 AND TEST_winrt_bt
)
qt_configure_add_summary_section(NAME "Qt Bluetooth")
qt_configure_add_summary_section(NAME "Qt Bluetooth details")
qt_configure_add_summary_entry(ARGS bluez)
qt_configure_add_summary_entry(ARGS bluez_le)
qt_configure_add_summary_entry(ARGS linux_crypto_api)

15
src/global/CMakeLists.txt Normal file
View File

@ -0,0 +1,15 @@
# Copyright (C) 2025 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## Tools Module:
#####################################################################
qt_internal_add_module(Connectivity
INTERNAL_MODULE
HEADER_MODULE
CONFIGURE_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../configure.cmake"
MODULE_INTERFACE_NAME Connectivity # Specify the 'Connectivity' name explicitly to avoid
# warning related to the expected name of internal module.
NO_GENERATE_CPP_EXPORTS
)

View File

@ -11,7 +11,7 @@ qt_feature("neard" PUBLIC
LABEL "Use neard to access NFC devices"
CONDITION LINUX AND QT_FEATURE_dbus AND NOT QT_FEATURE_pcsclite)
qt_configure_add_summary_section(NAME "Qt Nfc")
qt_configure_add_summary_section(NAME "Qt Nfc details")
qt_configure_add_summary_entry(ARGS pcslite)
qt_configure_add_summary_entry(ARGS neard)
qt_configure_end_summary_section()