<table><tr><td style="">pino created this revision.<br />Herald added a project: Frameworks.<br />Herald added a subscriber: kde-frameworks-devel.<br />pino requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D17991">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Currently, the bits of information of each device backend (e.g. udev,<br />
upower, etc) are spread in different files:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">their sources in each CMakeLists.txt</li>
<li class="remarkup-list-item">their libraries in the CMakeLists.txt that assembles the devices part of libKF5Solid</li>
<li class="remarkup-list-item">their cmake bits in different places</li>
</ul>
<p>Also, the logic for building the backends in the library, and then<br />
registering them in the DeviceManager, are repeated as cmake, and C++<br />
bits, with small differences between them.</p>
<p>To overcome these limitations, introduce a set of cmake macros, and<br />
functions to deal with the addition of a device backend:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">a single place, in the top-level CMakeLists.txt, determine which backends are built</li>
<li class="remarkup-list-item">the CMakeLists.txt of each backend has just their sources (with no paths), and their libraries needed too</li>
<li class="remarkup-list-item">the cmake bits create a config-backends.h file with the #define's of the enabled backends</li>
<li class="remarkup-list-item">the cmake bits set cmake variables, so other cmake bits can perform other operations depending whether a backend is built</li>
<li class="remarkup-list-item">the backends are registered in the DeviceManager depending solely on the fact that they are built</li>
<li class="remarkup-list-item">there is a new cmake option() variable to disable the build of a backend</li>
<li class="remarkup-list-item">the cmake feature_info stuff is used to show which backends are enabled, in a more visibile way</li>
</ul></div></div><br /><div><strong>TEST PLAN</strong><div><ul class="remarkup-list">
<li class="remarkup-list-item">build solid</li>
<li class="remarkup-list-item">check that the enabled backends are the same as before (see the list in the cmake output for enabled features)</li>
<li class="remarkup-list-item">check that the reported devices are the same as before</li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R245 Solid</div></div></div><br /><div><strong>BRANCH</strong><div><div>cmake-backends-refactor (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D17991">https://phabricator.kde.org/D17991</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>CMakeLists.txt<br />
cmake/SolidBackendsMacros.cmake<br />
src/solid/devices/CMakeLists.txt<br />
src/solid/devices/backends/fakehw/CMakeLists.txt<br />
src/solid/devices/backends/fstab/CMakeLists.txt<br />
src/solid/devices/backends/hal/CMakeLists.txt<br />
src/solid/devices/backends/iokit/CMakeLists.txt<br />
src/solid/devices/backends/udev/CMakeLists.txt<br />
src/solid/devices/backends/udisks2/CMakeLists.txt<br />
src/solid/devices/backends/upower/CMakeLists.txt<br />
src/solid/devices/backends/win/CMakeLists.txt<br />
src/solid/devices/managerbase.cpp</div></div></div><br /><div><strong>To: </strong>pino<br /><strong>Cc: </strong>kde-frameworks-devel, michaelh, ngraham, bruns<br /></div>