summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2021-05-09 14:24:50 +0200
committerSlávek Banko <slavek.banko@axis.cz>2021-05-09 14:24:50 +0200
commitdc16d7e588328888160b904d71213c26dea0ac0c (patch)
tree0688fe249229c71d1393c35a77c770442290654c
parentd7fce8ee6a5c227241788727096f7a3a54eb9e21 (diff)
downloadkima-dc16d7e5.tar.gz
kima-dc16d7e5.zip
Updated to use new standalone tdehw library.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--CMakeLists.txt1
-rw-r--r--ConfigureChecks.cmake20
-rw-r--r--config.h.cmake3
-rw-r--r--src/sources/CMakeLists.txt1
-rw-r--r--src/sources/batterysrc.cpp8
-rw-r--r--src/sources/batterysrc.h2
6 files changed, 30 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c3c53eb..3fecd46 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,7 @@ tde_setup_paths( )
option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
+option( WITH_TDEHWLIB "Enable TDE hardware library support" ${WITH_ALL_OPTIONS} )
option( WITH_NVCONTROL "Build with NVidia control support" ${WITH_ALL_OPTIONS} )
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index ab62c41..de59523 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -25,6 +25,26 @@ if( WITH_GCC_VISIBILITY )
endif( WITH_GCC_VISIBILITY )
+##### check for tdehwlib
+
+if( WITH_TDEHWLIB )
+ tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" )
+ check_cxx_source_compiles( "
+ #include <kdemacros.h>
+ #ifndef __TDE_HAVE_TDEHWLIB
+ #error tdecore is not build with tdehwlib
+ #endif
+ int main() { return 0; } "
+ HAVE_TDEHWLIB
+ )
+ tde_restore( CMAKE_REQUIRED_INCLUDES )
+ if( NOT HAVE_TDEHWLIB )
+ tde_message_fatal( "tdehwlib is required, but not built in tdecore" )
+ endif( NOT HAVE_TDEHWLIB )
+ set( TDEHW_LIBRARIES "tdehw-shared" )
+endif( )
+
+
##### check for NVidia support
if( WITH_NVCONTROL )
diff --git a/config.h.cmake b/config.h.cmake
index 52071eb..5396929 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -7,5 +7,8 @@
significant byte first (like Motorola and SPARC, unlike Intel). */
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
+/* Defined if tdelibs are built with tdehw library */
+#cmakedefine HAVE_TDEHWLIB @HAVE_TDEHWLIB@
+
/* Defined if you have <NVCtrlLib.h> header */
#cmakedefine HAVE_NVCONTROL @HAVE_NVCONTROL@
diff --git a/src/sources/CMakeLists.txt b/src/sources/CMakeLists.txt
index b83baea..f881602 100644
--- a/src/sources/CMakeLists.txt
+++ b/src/sources/CMakeLists.txt
@@ -42,6 +42,7 @@ tde_add_library( sources STATIC_PIC AUTOMOC
uptimesrc.cpp
LINK
tdecore-shared
+ ${TDEHW_LIBRARIES}
${NVCONTROL_LIBRARIES}
${XEXT_LIBRARIES}
)
diff --git a/src/sources/batterysrc.cpp b/src/sources/batterysrc.cpp
index 32a2d77..42f056a 100644
--- a/src/sources/batterysrc.cpp
+++ b/src/sources/batterysrc.cpp
@@ -22,7 +22,7 @@
#include <tdelocale.h>
#include <kdebug.h>
-#ifdef __TDE_HAVE_TDEHWLIB
+#ifdef HAVE_TDEWHLIB
#include <tdehardwaredevices.h>
#endif
@@ -31,7 +31,7 @@ BatterySrc::BatterySrc(TQWidget* inParent, TQString inUDI):
mTrigger(this, 5000),
mUDI(inUDI),
mHardwareDevices(NULL){
-#ifdef __TDE_HAVE_TDEHWLIB
+#ifdef HAVE_TDEHWLIB
mHardwareDevices = TDEGlobal::hardwareDevices();
TDEGenericDevice* hwdevice = mHardwareDevices->findByUniqueID(inUDI);
@@ -52,7 +52,7 @@ BatterySrc::~BatterySrc(){
std::list<Source*>BatterySrc::createInstances(TQWidget* inParent){
std::list<Source*> list;
-#ifdef __TDE_HAVE_TDEHWLIB
+#ifdef HAVE_TDEHWLIB
TDEHardwareDevices* hardwareDevices = TDEGlobal::hardwareDevices();
TDEGenericHardwareList hwlist = hardwareDevices->listAllPhysicalDevices();
TDEGenericDevice *hwdevice;
@@ -67,7 +67,7 @@ std::list<Source*>BatterySrc::createInstances(TQWidget* inParent){
TQString BatterySrc::fetchValue() {
TQString s = "n/a";
-#ifdef __TDE_HAVE_TDEHWLIB
+#ifdef HAVE_TDEHWLIB
if (mHardwareDevices != NULL) {
TDEGenericDevice* hwdevice = mHardwareDevices->findByUniqueID(mUDI);
if (hwdevice->type() != TDEGenericDeviceType::Battery) {
diff --git a/src/sources/batterysrc.h b/src/sources/batterysrc.h
index bcd805f..5ff3268 100644
--- a/src/sources/batterysrc.h
+++ b/src/sources/batterysrc.h
@@ -26,7 +26,7 @@
#include <tqstring.h>
#include <list>
-#ifdef __TDE_HAVE_TDEHWLIB
+#ifdef HAVE_TDEHWLIB
class TDEHardwareDevices;
#else
#define TDEHardwareDevices void