From 84e3f9e06ba1b6a050e838ca55970f018e81b749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Andriot?= Date: Tue, 7 Oct 2014 01:00:47 +0200 Subject: Allow conditional build of tdehwlib --- CMakeLists.txt | 7 ++++++- tdecore/CMakeLists.txt | 13 +++++++++---- tdecore/kdemacros.h.cmake | 1 + tdecore/kinstance.cpp | 14 ++++++++++++++ tdecore/kinstance.h | 12 +++++++++--- tdecore/tdeglobal.cpp | 4 ++++ 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac8d02304..45f161b0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,8 @@ OPTION( WITH_PCRE "Enable pcre regex support for kjs" ON ) OPTION( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} ) OPTION( WITH_INOTIFY "Enable inotify support for tdeio" ON ) OPTION( WITH_GAMIN "Enable FAM/GAMIN support" ${WITH_ALL_OPTIONS} ) -option( WITH_TDEHWLIB_DAEMONS "Enable daemons for TDE hwlib" ${WITH_ALL_OPTIONS} ) +option( WITH_TDEHWLIB "Enable TDE hwlib globally" ON ) +option( WITH_TDEHWLIB_DAEMONS "Enable daemons for TDE hwlib" ${WITH_TDEHWLIB} ) option( WITH_HAL "Enable HAL support" OFF ) option( WITH_DEVKITPOWER "Enable DeviceKit Power support" OFF ) option( WITH_LOGINDPOWER "Enable Logind/Systemd Power support" OFF ) @@ -506,6 +507,10 @@ set( LTDL_OBJDIR \".\" ) set( KDELIBSUFF "${LIB_SUFFIX}" ) set( kde_socklen_t socklen_t ) +if( WITH_TDEHWLIB ) + set( __TDE_HAVE_TDEHWLIB 1 ) +endif( WITH_TDEHWLIB ) + ##### check for libdl ########################### diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt index 508ca855b..85f5c99df 100644 --- a/tdecore/CMakeLists.txt +++ b/tdecore/CMakeLists.txt @@ -12,7 +12,12 @@ add_subdirectory( malloc ) add_subdirectory( network ) add_subdirectory( tdeconfig_compiler ) -add_subdirectory( tdehw ) + +if( WITH_TDEHWLIB ) + add_subdirectory( tdehw ) + set( TDEHW_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tdehw ) + set( TDEHW_LIB tdehw-static ) +endif( WITH_TDEHWLIB ) if( WITH_LIBART ) add_subdirectory( svgicons ) @@ -25,7 +30,7 @@ include_directories( ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/network - ${CMAKE_CURRENT_SOURCE_DIR}/tdehw + ${TDEHW_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/dcop ${CMAKE_SOURCE_DIR}/libltdl ${CMAKE_SOURCE_DIR}/tdefx @@ -128,10 +133,10 @@ set( ${target}_SRCS tde_add_library( ${target} SHARED AUTOMOC SOURCES ${${target}_SRCS} VERSION 14.0.0 - EMBED tdecorenetwork-static tdehw-static + EMBED tdecorenetwork-static ${TDEHW_LIB} LINK ltdlc-static ${KDESVGICONS} DCOP-shared tdefx-shared ${ZLIB_LIBRARIES} ${LIBIDN_LIBRARIES} ${XCOMPOSITE_LIBRARIES} ICE SM ${GAMIN_LIBRARIES} - ${LIBBFD_LIBRARIES} util + ${LIBBFD_LIBRARIES} ${LIB_UTIL} DEPENDENCIES dcopidl dcopidl2cpp DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/tdecore/kdemacros.h.cmake b/tdecore/kdemacros.h.cmake index 766ca622a..083cc8c8d 100644 --- a/tdecore/kdemacros.h.cmake +++ b/tdecore/kdemacros.h.cmake @@ -21,6 +21,7 @@ #define _KDE_MACROS_H_ /* Set by configure */ +#cmakedefine __TDE_HAVE_TDEHWLIB 1 #cmakedefine __KDE_HAVE_GCC_VISIBILITY 1 /** diff --git a/tdecore/kinstance.cpp b/tdecore/kinstance.cpp index 6760c95a0..cbdf86783 100644 --- a/tdecore/kinstance.cpp +++ b/tdecore/kinstance.cpp @@ -24,8 +24,10 @@ #include "tdelocale.h" #include "kcharsets.h" #include "kiconloader.h" +#ifdef __TDE_HAVE_TDEHWLIB #include "tdehardwaredevices.h" #include "tdenetworkconnections.h" +#endif #include "tdeaboutdata.h" #include "kstandarddirs.h" #include "kdebug.h" @@ -72,8 +74,10 @@ TDEInstance::TDEInstance( const TQCString& name) : _dirs (0L), _config (0L), _iconLoader (0L), +#ifdef __TDE_HAVE_TDEHWLIB _hardwaredevices (0L), _networkmanager (0L), +#endif _name( name ), _aboutData( new TDEAboutData( name, "", 0 ) ), m_configReadOnly(false) { DEBUG_ADD @@ -92,8 +96,10 @@ TDEInstance::TDEInstance( const TDEAboutData * aboutData ) : _dirs (0L), _config (0L), _iconLoader (0L), +#ifdef __TDE_HAVE_TDEHWLIB _hardwaredevices (0L), _networkmanager (0L), +#endif _name( aboutData->appName() ), _aboutData( aboutData ), m_configReadOnly(false) { DEBUG_ADD @@ -113,8 +119,10 @@ TDEInstance::TDEInstance( TDEInstance* src ) : _dirs ( src->_dirs ), _config ( src->_config ), _iconLoader ( src->_iconLoader ), +#ifdef __TDE_HAVE_TDEHWLIB _hardwaredevices ( src->_hardwaredevices ), _networkmanager ( src->_networkmanager ), +#endif _name( src->_name ), _aboutData( src->_aboutData ), m_configReadOnly(false) { DEBUG_ADD @@ -133,8 +141,10 @@ TDEInstance::TDEInstance( TDEInstance* src ) src->_dirs = 0L; src->_config = 0L; src->_iconLoader = 0L; +#ifdef __TDE_HAVE_TDEHWLIB src->_hardwaredevices = 0L; src->_networkmanager = 0L; +#endif src->_aboutData = 0L; delete src; } @@ -153,11 +163,13 @@ TDEInstance::~TDEInstance() delete _iconLoader; _iconLoader = 0; +#ifdef __TDE_HAVE_TDEHWLIB delete _hardwaredevices; _hardwaredevices = 0; delete _networkmanager; _networkmanager = 0; +#endif // delete _config; // Do not delete, stored in d->sharedConfig _config = 0; @@ -270,6 +282,7 @@ TDEIconLoader *TDEInstance::iconLoader() const return _iconLoader; } +#ifdef __TDE_HAVE_TDEHWLIB TDEHardwareDevices *TDEInstance::hardwareDevices() const { DEBUG_CHECK_ALIVE @@ -289,6 +302,7 @@ TDEGlobalNetworkManager *TDEInstance::networkManager() const return _networkmanager; } +#endif void TDEInstance::newIconLoader() const { diff --git a/tdecore/kinstance.h b/tdecore/kinstance.h index be60c943c..e0fdf73de 100644 --- a/tdecore/kinstance.h +++ b/tdecore/kinstance.h @@ -18,6 +18,9 @@ #ifndef _KINSTANCE_H #define _KINSTANCE_H +#include +#include "tdelibs_export.h" + class TDEStandardDirs; class TDEAboutData; class TDEConfig; @@ -27,11 +30,10 @@ class TQFont; class TDEInstancePrivate; class KMimeSourceFactory; class TDESharedConfig; +#ifdef __TDE_HAVE_TDEHWLIB class TDEHardwareDevices; class TDEGlobalNetworkManager; - -#include -#include "tdelibs_export.h" +#endif /** @@ -110,6 +112,7 @@ class TDECORE_EXPORT TDEInstance */ TDEIconLoader *iconLoader() const; +#ifdef __TDE_HAVE_TDEHWLIB /** * Returns a TDEHardwareDevices object. * @return the hardwaredevices object. @@ -121,6 +124,7 @@ class TDECORE_EXPORT TDEInstance * @return the networkmanager object. */ TDEGlobalNetworkManager *networkManager() const; +#endif /** * Re-allocate the global iconloader. @@ -168,8 +172,10 @@ private: mutable TDEConfig *_config; mutable TDEIconLoader *_iconLoader; +#ifdef __TDE_HAVE_TDEHWLIB mutable TDEHardwareDevices *_hardwaredevices; mutable TDEGlobalNetworkManager *_networkmanager; +#endif mutable void *_placeholder; TQCString _name; diff --git a/tdecore/tdeglobal.cpp b/tdecore/tdeglobal.cpp index f8639d526..8ef5f59db 100644 --- a/tdecore/tdeglobal.cpp +++ b/tdecore/tdeglobal.cpp @@ -34,8 +34,10 @@ #include #include #include +#ifdef __TDE_HAVE_TDEHWLIB #include #include +#endif #include #include #include "kstaticdeleter.h" @@ -81,6 +83,7 @@ TDEIconLoader *TDEGlobal::iconLoader() return _instance->iconLoader(); } +#ifdef __TDE_HAVE_TDEHWLIB TDEHardwareDevices *TDEGlobal::hardwareDevices() { MYASSERT(_instance); @@ -94,6 +97,7 @@ TDEGlobalNetworkManager *TDEGlobal::networkManager() return _instance->networkManager(); } +#endif TDEInstance *TDEGlobal::instance() { -- cgit v1.2.3