diff --git a/kstyle/CMakeLists.txt b/kstyle/CMakeLists.txt index cfcb2c39..ae1d43b2 100644 --- a/kstyle/CMakeLists.txt +++ b/kstyle/CMakeLists.txt @@ -4,20 +4,25 @@ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) include(WriteBasicConfigVersionFile) include(FeatureSummary) -find_package(ECM 0.0.9 REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) - -################# Qt5/KF5 ################# -find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets) -find_package(KF5 REQUIRED COMPONENTS - I18n - Config - GuiAddons - WidgetsAddons - Service - Completion - FrameworkIntegration - WindowSystem) +if( USE_KDE4 ) + + ############ Language and toolchain features + ############ copied from ECM + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND NOT WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + endif() + + add_definitions( -DUSE_KDE4=1 ) + +else() + + find_package(ECM 0.0.9 REQUIRED NO_MODULE) + set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) + add_definitions( -DUSE_KDE4=0 ) + +endif() ################# X11 ################# find_package(X11) @@ -29,18 +34,49 @@ set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries" add_definitions( -DHAVE_X11=${X11_FOUND} ) -if(X11_FOUND) - find_package(XCB REQUIRED COMPONENTS XCB) - set_package_properties(XCB PROPERTIES TYPE REQUIRED) +################# Qt/KDE ################# +if( USE_KDE4 ) + + find_package(KDE4 REQUIRED) + include(KDE4Defaults) + include(MacroLibrary) + + add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) + include_directories(${KDE4_INCLUDES}) + + if( X11_FOUND ) + ### XCB + find_package(PkgConfig REQUIRED) + pkg_check_modules( XCB REQUIRED xcb x11-xcb) + endif() + +else() + + find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets) + find_package(KF5 REQUIRED COMPONENTS + I18n + Config + GuiAddons + WidgetsAddons + Service + Completion + FrameworkIntegration + WindowSystem) + + if(X11_FOUND) + ### XCB + find_package(XCB REQUIRED COMPONENTS XCB) + find_package(Qt5 REQUIRED CONFIG COMPONENTS X11Extras) + endif() + + ### includes + include(KDEInstallDirs) + include(KDECMakeSettings) + include(KDECompilerSettings) + include(GenerateExportHeader) - find_package(Qt5 REQUIRED CONFIG COMPONENTS X11Extras) endif() -include(KDEInstallDirs) -include(KDECMakeSettings) -include(KDECompilerSettings) -include(GenerateExportHeader) - ################# includes ################# include_directories( animations ) @@ -83,21 +119,35 @@ set(breeze_PART_SRCS breezewindowmanager.cpp ) -kconfig_add_kcfg_files(breeze_PART_SRCS breezestyleconfigdata.kcfgc) +if( USE_KDE4 ) -add_library(breeze MODULE ${breeze_PART_SRCS}) + kde4_add_kcfg_files(breeze_PART_SRCS breezestyleconfigdata.kcfgc) + kde4_add_plugin(breeze ${breeze_PART_SRCS}) + target_link_libraries(breeze ${KDE4_KDEUI_LIBS} ) -target_link_libraries(breeze ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS}) + if( X11_FOUND ) + target_link_libraries( breeze ${X11_X11_LIB} ) + target_link_libraries( breeze ${X11_XCB_LIBRARIES} ) + target_link_libraries( breeze ${XCB_LIBRARIES} ) + endif() -target_link_libraries(breeze Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) -target_link_libraries(breeze KF5::ConfigCore KF5::ConfigWidgets KF5::GuiAddons KF5::Style KF5::WindowSystem) + install(TARGETS breeze DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/styles/ ) -if(X11_FOUND) - target_link_libraries(breeze ${XCB_LIBRARIES}) - target_link_libraries(breeze Qt5::X11Extras) -endif() +else() + + kconfig_add_kcfg_files(breeze_PART_SRCS breezestyleconfigdata.kcfgc) + add_library(breeze MODULE ${breeze_PART_SRCS}) + target_link_libraries(breeze Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) + target_link_libraries(breeze KF5::ConfigCore KF5::ConfigWidgets KF5::GuiAddons KF5::Style KF5::WindowSystem) -install(TARGETS breeze DESTINATION ${QT_PLUGIN_INSTALL_DIR}/styles/ ) + if(X11_FOUND) + target_link_libraries(breeze ${XCB_LIBRARIES}) + target_link_libraries(breeze Qt5::X11Extras) + endif() + + install(TARGETS breeze DESTINATION ${QT_PLUGIN_INSTALL_DIR}/styles/ ) + +endif() ########### install files ############### install( FILES breeze.themerc DESTINATION ${DATA_INSTALL_DIR}/kstyle/themes ) diff --git a/kstyle/breezehelper.cpp b/kstyle/breezehelper.cpp index abc83449..10116e60 100644 --- a/kstyle/breezehelper.cpp +++ b/kstyle/breezehelper.cpp @@ -43,7 +43,7 @@ namespace Breeze { init(); } //____________________________________________________________________ - #if QT_VERSION < 0x050000 + #if USE_KDE4 Helper::Helper( const QByteArray& name ): _componentData( name, 0, KComponentData::SkipMainComponentRegistration ), _config( _componentData.config() ) diff --git a/kstyle/breezehelper.h b/kstyle/breezehelper.h index e9c7c109..f036620a 100644 --- a/kstyle/breezehelper.h +++ b/kstyle/breezehelper.h @@ -25,7 +25,7 @@ #include #include -#if QT_VERSION < 0x050000 +#if USE_KDE4 #include #endif @@ -49,7 +49,7 @@ namespace Breeze //! constructor explicit Helper( KSharedConfig::Ptr ); - #if QT_VERSION < 0x050000 + #if USE_KDE4 //! constructor explicit Helper( const QByteArray& ); #endif @@ -254,7 +254,7 @@ namespace Breeze private: - #if QT_VERSION < 0x050000 + #if USE_KDE4 //! component data KComponentData _componentData; #endif diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp index ffa03d1e..cb45df78 100644 --- a/kstyle/breezestyle.cpp +++ b/kstyle/breezestyle.cpp @@ -104,24 +104,24 @@ namespace Breeze //______________________________________________________________ Style::Style( void ): - _addLineButtons( SingleButton ), - _subLineButtons( SingleButton ), + _addLineButtons( SingleButton ) + , _subLineButtons( SingleButton ) - #if QT_VERSION >= 0x050000 - _helper( new Helper( StyleConfigData::self()->sharedConfig() ) ), + #if USE_KDE4 + , _helper( new Helper( "breeze" ) ) #else - _helper( new Helper( "breeze" ) ), + , _helper( new Helper( StyleConfigData::self()->sharedConfig() ) ) #endif - _shadowHelper( new ShadowHelper( this, *_helper ) ), - _animations( new Animations( this ) ), - _mnemonics( new Mnemonics( this ) ), - _windowManager( new WindowManager( this ) ), - _frameShadowFactory( new FrameShadowFactory( this ) ), - _mdiWindowShadowFactory( new MdiWindowShadowFactory( this ) ), - _splitterFactory( new SplitterFactory( this ) ), - _tabBarData( new BreezePrivate::TabBarData( this ) ) - #if QT_VERSION >= 0x050000 + , _shadowHelper( new ShadowHelper( this, *_helper ) ) + , _animations( new Animations( this ) ) + , _mnemonics( new Mnemonics( this ) ) + , _windowManager( new WindowManager( this ) ) + , _frameShadowFactory( new FrameShadowFactory( this ) ) + , _mdiWindowShadowFactory( new MdiWindowShadowFactory( this ) ) + , _splitterFactory( new SplitterFactory( this ) ) + , _tabBarData( new BreezePrivate::TabBarData( this ) ) + #if !USE_KDE4 , SH_ArgbDndWindow( newStyleHint( QStringLiteral( "SH_ArgbDndWindow" ) ) ) #endif { diff --git a/kstyle/breezestyle.h b/kstyle/breezestyle.h index 4d1764c0..5c5ed9e5 100644 --- a/kstyle/breezestyle.h +++ b/kstyle/breezestyle.h @@ -54,10 +54,10 @@ namespace Breeze class WindowManager; //! convenience typedef for base class - #if QT_VERSION >= 0x050000 - using ParentStyleClass = KStyle; - #else + #if USE_KDE4 using ParentStyleClass = QCommonStyle; + #else + using ParentStyleClass = KStyle; #endif //! base class for breeze style diff --git a/kstyle/config/CMakeLists.txt b/kstyle/config/CMakeLists.txt index 0f46f613..b7fe10cc 100644 --- a/kstyle/config/CMakeLists.txt +++ b/kstyle/config/CMakeLists.txt @@ -1,18 +1,30 @@ +### configuration plugin add_definitions(-DTRANSLATION_DOMAIN=\"breeze_style_config\") set(kstyle_breeze_config_PART_SRCS breezestyleconfig.cpp ) -kconfig_add_kcfg_files(kstyle_breeze_config_PART_SRCS ../breezestyleconfigdata.kcfgc) +if( USE_KDE4 ) -set( kstyle_breeze_config_PART_FORMS ui/breezestyleconfig.ui ) + kde4_add_kcfg_files(kstyle_breeze_config_PART_SRCS ../breezestyleconfigdata.kcfgc) + kde4_add_ui_files(kstyle_breeze_config_PART_SRCS ui/breezestyleconfig.ui ) + kde4_add_plugin(kstyle_breeze_config ${kstyle_breeze_config_PART_SRCS}) -ki18n_wrap_ui(kstyle_breeze_config_PART_FORMS_HEADERS ${kstyle_breeze_config_PART_FORMS}) + target_link_libraries( kstyle_breeze_config ${KDE4_KDEUI_LIBS} ) + install(TARGETS kstyle_breeze_config DESTINATION ${PLUGIN_INSTALL_DIR} ) -add_library(kstyle_breeze_config MODULE +else() + + kconfig_add_kcfg_files(kstyle_breeze_config_PART_SRCS ../breezestyleconfigdata.kcfgc) + set( kstyle_breeze_config_PART_FORMS ui/breezestyleconfig.ui ) + ki18n_wrap_ui(kstyle_breeze_config_PART_FORMS_HEADERS ${kstyle_breeze_config_PART_FORMS}) + + add_library(kstyle_breeze_config MODULE ${kstyle_breeze_config_PART_SRCS} ${kstyle_breeze_config_PART_FORMS_HEADERS} -) + ) + + target_link_libraries(kstyle_breeze_config Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) + target_link_libraries(kstyle_breeze_config KF5::ConfigCore KF5::ConfigWidgets KF5::Completion KF5::I18n) + install(TARGETS kstyle_breeze_config DESTINATION ${QT_PLUGIN_INSTALL_DIR} ) -target_link_libraries(kstyle_breeze_config Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) -target_link_libraries(kstyle_breeze_config KF5::ConfigCore KF5::ConfigWidgets KF5::Completion KF5::I18n) +endif() -install(TARGETS kstyle_breeze_config DESTINATION ${QT_PLUGIN_INSTALL_DIR} )