From a63b9b15ca806337081c1e2126559be21fc3b7fe Mon Sep 17 00:00:00 2001 From: gregory guy Date: Sat, 20 Oct 2018 16:37:27 +0200 Subject: converios to the cmake building system Signed-off-by: gregory guy --- CMakeLists.txt | 93 +++++++++++++++++++++++++++++++++++++++ ConfigureChecks.cmake | 56 +++++++++++++++++++++++ config.h.cmake | 16 +++++++ doc/CMakeLists.txt | 1 + doc/en/CMakeLists.txt | 1 + kkbswitch.upd/CMakeLists.txt | 8 ++++ kkbswitch/CMakeLists.txt | 71 ++++++++++++++++++++++++++++++ kkbswitch/kbconfigdlg.cpp | 2 + kkbswitch/kbpickicondlg.cpp | 2 + kkbswitch/kbswitchapp.cpp | 2 + kkbswitch/kbswitchintf.cpp | 2 + kkbswitch/kbswitchtrayicon.cpp | 2 + kkbswitch/singlewindowwatcher.cpp | 2 + kkbswitch/windowclasswatcher.cpp | 1 + kkbswitch/windowwatcher.cpp | 1 + kkbswitch/xkeyboard.cpp | 2 + po/CMakeLists.txt | 1 + 17 files changed, 263 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 ConfigureChecks.cmake create mode 100644 config.h.cmake create mode 100644 doc/CMakeLists.txt create mode 100644 doc/en/CMakeLists.txt create mode 100644 kkbswitch.upd/CMakeLists.txt create mode 100644 kkbswitch/CMakeLists.txt create mode 100644 po/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d0da767 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,93 @@ +############################################ +# # +# Improvements and feedbacks are welcome # +# # +# This file is released under GPL >= 3 # +# # +############################################ + + +cmake_minimum_required( VERSION 2.8 ) + + +#### general package setup + +project( kkbswitch ) +set( VERSION R14.1.0 ) + + +#### include essential cmake modules + +include( FindPkgConfig ) +include( CheckFunctionExists ) +include( CheckIncludeFile ) +include( CheckLibraryExists ) +include( CheckCSourceCompiles ) +include( CheckCXXSourceCompiles ) + + +#### include our cmake modules + +set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) +include( TDEMacros ) + + +##### setup install paths + +include( TDESetupPaths ) +tde_setup_paths( ) + + +##### optional stuff + +option( WITH_ALL_OPTIONS "Enable all optional support" OFF ) +option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} ) +option( WITH_RU_UA_LAYOUT "Add Russian and Ukrainian keyboard" ${WITH_ALL_OPTIONS} ) + + +##### user requested modules + +option( BUILD_ALL "Build all" ON ) +option( BUILD_DOC "Build documentation" ${BUILD_ALL} ) +option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} ) + + +##### configure checks + +include( ConfigureChecks.cmake ) + + +###### global compiler settings + +add_definitions( -DHAVE_CONFIG_H ) + +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" ) +set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" ) +set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" ) + + +##### directories + +add_subdirectory( ${PROJECT_NAME} ) +add_subdirectory( ${PROJECT_NAME}.upd ) +tde_conditional_add_subdirectory( BUILD_DOC doc ) +tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po ) + + +##### man page + +INSTALL( + FILES ${PROJECT_NAME}.1 + DESTINATION ${MAN_INSTALL_DIR}/man1 + COMPONENT doc +) + + +##### icons + +tde_install_icons( ${PROJECT_NAME} ) + + +##### write configure files + +configure_file( config.h.cmake config.h @ONLY ) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake new file mode 100644 index 0000000..dc500da --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,56 @@ +########################################### +# # +# Improvements and feedback are welcome # +# # +# This file is released under GPL >= 3 # +# # +########################################### + + +# required stuff +find_package( TQt ) +find_package( TDE ) + +tde_setup_architecture_flags( ) + +include(TestBigEndian) +test_big_endian(WORDS_BIGENDIAN) + + +##### check for gcc visibility support + +if( WITH_GCC_VISIBILITY ) + if( NOT UNIX ) + tde_message_fatal( "gcc visibility support was requested, but your system is not *NIX" ) + endif( NOT UNIX ) + set( __KDE_HAVE_GCC_VISIBILITY 1 ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") +endif( WITH_GCC_VISIBILITY ) + + +#### check for libxkbfile + +pkg_search_module( XKBFILE xkbfile ) +if( NOT XKBFILE_FOUND ) + tde_message_fatal( "xkbfile is required , but was not found on your system" ) + else ( ) + set( HAVE_X11_EXTENSIONS_XKBRULES_H 1 ) + set( HAVE_LIBXKBFILE 1 ) +endif() + + +##### gettext + +if( BUILD_TRANSLATIONS ) + include( FindGettext ) + if( GETTEXT_FOUND ) + set( MSGFMT_EXECUTABLE ${GETTEXT_MSGFMT_EXECUTABLE} + CACHE FILEPATH "path to msgfmt executable" ) + endif( GETTEXT_FOUND ) + + if( NOT MSGFMT_EXECUTABLE ) + tde_message_fatal( "msgfmt is required but was not found on your system." ) + endif( NOT MSGFMT_EXECUTABLE ) +endif( BUILD_TRANSLATIONS ) + diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..0b3fbcf --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,16 @@ +#define VERSION "@VERSION@" + +// Defined if you have fvisibility and fvisibility-inlines-hidden support. +#cmakedefine __KDE_HAVE_GCC_VISIBILITY 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@ + + +// Defined to 1 if we have libxkbfile library +#cmakedefine HAVE_LIBXKBFILE 1 + + +// Defined to 1 if we have libxkbfile headers +#cmakedefine HAVE_X11_EXTENSIONS_XKBRULES_H 1 diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..c938175 --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory( en ) diff --git a/doc/en/CMakeLists.txt b/doc/en/CMakeLists.txt new file mode 100644 index 0000000..ba3ef3e --- /dev/null +++ b/doc/en/CMakeLists.txt @@ -0,0 +1 @@ +tde_create_handbook( DESTINATION ${PROJECT_NAME} ) diff --git a/kkbswitch.upd/CMakeLists.txt b/kkbswitch.upd/CMakeLists.txt new file mode 100644 index 0000000..fd7b35b --- /dev/null +++ b/kkbswitch.upd/CMakeLists.txt @@ -0,0 +1,8 @@ +install( + FILES + ${PROJECT_NAME}.upd + kkbswitch_update_14_icons + kkbswitch_update_14_options + + DESTINATION ${DATA_INSTALL_DIR}/tdeconf_update +) diff --git a/kkbswitch/CMakeLists.txt b/kkbswitch/CMakeLists.txt new file mode 100644 index 0000000..d6db9b5 --- /dev/null +++ b/kkbswitch/CMakeLists.txt @@ -0,0 +1,71 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### kkbswitch (executable) + +tde_add_executable( ${PROJECT_NAME} AUTOMOC + + SOURCES + boldlistboxitem.cpp + boldmenuitem.cpp + kbconfig.cpp + kbconfigdlg.cpp + kbgroup.cpp + kbpickicondlg.cpp + kbswitchapp.cpp + kbswitchintf.cpp + kbswitchtrayicon.cpp + main.cpp + pathlistboxitem.cpp + xkeyboard.cpp + windowwatcher.cpp + singlewindowwatcher.cpp + windowclasswatcher.cpp + kbswitchintf.skel + LINK + tdeio-shared + tdeui-shared + tdecore-shared + ${XKBFILE_LIBRARIES} + + DESTINATION ${BIN_INSTALL_DIR} +) + + +##### other data + +install( + FILES ${PROJECT_NAME}.desktop + DESTINATION ${AUTOSTART_INSTALL_DIR} +) + +install( + FILES ${PROJECT_NAME}.desktop + DESTINATION ${APPS_INSTALL_DIR}/Utilities +) + +install( + FILES group_names + DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME} +) + + +##### Russian - Ukrainian Layout + +if( WITH_RU_UA_LAYOUT ) +install( + FILES ru_ua + DESTINATION ${SHARE_INSTALL_PREFIX}/X11/xkb/symbols +) +endif( WITH_RU_UA_LAYOUT ) diff --git a/kkbswitch/kbconfigdlg.cpp b/kkbswitch/kbconfigdlg.cpp index e299aea..6b1c73d 100644 --- a/kkbswitch/kbconfigdlg.cpp +++ b/kkbswitch/kbconfigdlg.cpp @@ -406,3 +406,5 @@ void KBConfigDlg::checkIconDefault(int index) btnSetDefaultIcon->setEnabled(!conf->readEntry(m_kbconf->getGroup(index)->getName()/*KBConfig::entryForGroup(index)*/).isNull()); } } + +#include "kbconfigdlg.moc" diff --git a/kkbswitch/kbpickicondlg.cpp b/kkbswitch/kbpickicondlg.cpp index b3821ef..a8a0e05 100644 --- a/kkbswitch/kbpickicondlg.cpp +++ b/kkbswitch/kbpickicondlg.cpp @@ -201,3 +201,5 @@ void KBPickIconDlg::showCurrentPath(const TQString ¤tPath, lbIcons->ensureCurrentVisible(); lbIcons->setHScrollBarMode(TQScrollView::Auto); } + +#include "kbpickicondlg.moc" diff --git a/kkbswitch/kbswitchapp.cpp b/kkbswitch/kbswitchapp.cpp index 50ce80a..5e53487 100644 --- a/kkbswitch/kbswitchapp.cpp +++ b/kkbswitch/kbswitchapp.cpp @@ -377,3 +377,5 @@ void KBSwitchApp::setGroups(int group, int next_group) m_next_groupno = next_group; forceSetGroup(group); } + +#include "kbswitchapp.moc" diff --git a/kkbswitch/kbswitchintf.cpp b/kkbswitch/kbswitchintf.cpp index f7e8098..a3f1d4d 100644 --- a/kkbswitch/kbswitchintf.cpp +++ b/kkbswitch/kbswitchintf.cpp @@ -49,3 +49,5 @@ TQStringList KBSwitchIntf::getGroupNames() result.append(m_kbconf->getGroup(i)->getName()); return result; } + +#include "kbswitchintf.moc" diff --git a/kkbswitch/kbswitchtrayicon.cpp b/kkbswitch/kbswitchtrayicon.cpp index 335f906..df04cd2 100644 --- a/kkbswitch/kbswitchtrayicon.cpp +++ b/kkbswitch/kbswitchtrayicon.cpp @@ -198,3 +198,5 @@ void KBSwitchTrayIcon::slotUpdateIcons(){ void KBSwitchTrayIcon::slotHelp(){ kapp->invokeHelp(); } + +#include "kbswitchtrayicon.moc" diff --git a/kkbswitch/singlewindowwatcher.cpp b/kkbswitch/singlewindowwatcher.cpp index 8080dc0..a3a4b29 100644 --- a/kkbswitch/singlewindowwatcher.cpp +++ b/kkbswitch/singlewindowwatcher.cpp @@ -71,3 +71,5 @@ void SingleWindowWatcher::reset() addWindowToMap(active_window); else m_active_window = m_window_map.end(); } + +#include "singlewindowwatcher.moc" diff --git a/kkbswitch/windowclasswatcher.cpp b/kkbswitch/windowclasswatcher.cpp index 74e82ef..4fbd195 100644 --- a/kkbswitch/windowclasswatcher.cpp +++ b/kkbswitch/windowclasswatcher.cpp @@ -104,3 +104,4 @@ void WindowClassWatcher::reset() else m_active_class = m_class_group_map.end(); } +#include "windowclasswatcher.moc" diff --git a/kkbswitch/windowwatcher.cpp b/kkbswitch/windowwatcher.cpp index 63371dd..96dbcc0 100644 --- a/kkbswitch/windowwatcher.cpp +++ b/kkbswitch/windowwatcher.cpp @@ -35,3 +35,4 @@ WindowWatcher::~WindowWatcher() { } +#include "windowwatcher.moc" diff --git a/kkbswitch/xkeyboard.cpp b/kkbswitch/xkeyboard.cpp index de78bc4..148cc2d 100644 --- a/kkbswitch/xkeyboard.cpp +++ b/kkbswitch/xkeyboard.cpp @@ -244,3 +244,5 @@ void XKeyboard::XklLogAppender(const char file[], const char function[], delete[] str; } #endif + +#include "xkeyboard.moc" diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..f5a2e1b --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1 @@ +tde_create_translation( LANG auto OUTPUT_NAME ${PROJECT_NAME} ) -- cgit v1.2.3