D17991: Refactor the way device backends are built and registered

Pino Toscano noreply at phabricator.kde.org
Sat Jan 5 16:19:21 GMT 2019


pino created this revision.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
pino requested review of this revision.

REVISION SUMMARY
  Currently, the bits of information of each device backend (e.g. udev,
  upower, etc) are spread in different files:
  
  - their sources in each CMakeLists.txt
  - their libraries in the CMakeLists.txt that assembles the devices part of libKF5Solid
  - their cmake bits in different places
  
  Also, the logic for building the backends in the library, and then
  registering them in the DeviceManager, are repeated as cmake, and C++
  bits, with small differences between them.
  
  To overcome these limitations, introduce a set of cmake macros, and
  functions to deal with the addition of a device backend:
  
  - a single place, in the top-level CMakeLists.txt, determine which backends are built
  - the CMakeLists.txt of each backend has just their sources (with no paths), and their libraries needed too
  - the cmake bits create a config-backends.h file with the #define's of the enabled backends
  - the cmake bits set cmake variables, so other cmake bits can perform other operations depending whether a backend is built
  - the backends are registered in the DeviceManager depending solely on the fact that they are built
  - there is a new cmake option() variable to disable the build of a backend
  - the cmake feature_info stuff is used to show which backends are enabled, in a more visibile way

TEST PLAN
  - build solid
  - check that the enabled backends are the same as before (see the list in the cmake output for enabled features)
  - check that the reported devices are the same as before

REPOSITORY
  R245 Solid

BRANCH
  cmake-backends-refactor (branched from master)

REVISION DETAIL
  https://phabricator.kde.org/D17991

AFFECTED FILES
  CMakeLists.txt
  cmake/SolidBackendsMacros.cmake
  src/solid/devices/CMakeLists.txt
  src/solid/devices/backends/fakehw/CMakeLists.txt
  src/solid/devices/backends/fstab/CMakeLists.txt
  src/solid/devices/backends/hal/CMakeLists.txt
  src/solid/devices/backends/iokit/CMakeLists.txt
  src/solid/devices/backends/udev/CMakeLists.txt
  src/solid/devices/backends/udisks2/CMakeLists.txt
  src/solid/devices/backends/upower/CMakeLists.txt
  src/solid/devices/backends/win/CMakeLists.txt
  src/solid/devices/managerbase.cpp

To: pino
Cc: kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190105/380b32b1/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list