From b7ae75d53ab260a281d6424d566738fc8a3715c5 Mon Sep 17 00:00:00 2001 From: gregory guy Date: Fri, 28 Sep 2018 13:21:36 +0200 Subject: [PATCH] convert to the cmake building system Signed-off-by: gregory guy --- CMakeLists.txt | 75 +++++++++++++++++++++++++++++++++++++ ConfigureChecks.cmake | 29 ++++++++++++++ config.h.cmake | 8 ++++ doc/CMakeLists.txt | 1 + doc/en/CMakeLists.txt | 1 + src/CMakeLists.txt | 52 +++++++++++++++++++++++++ src/DragWidget.cpp | 1 + src/MainWidget.cpp | 2 +- src/VButton.cpp | 2 + src/numpadvbutton.cpp | 2 + src/resizabledragwidget.cpp | 2 +- 11 files changed, 173 insertions(+), 2 deletions(-) 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 src/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6787bb1 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,75 @@ +############################################ +# # +# Improvements and feedbacks are welcome # +# # +# This file is released under GPL >= 3 # +# # +############################################ + + +cmake_minimum_required( VERSION 2.8 ) + + +#### general package setup + +project( kvkbd ) +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} ) + + +##### user requested modules + +option( BUILD_ALL "Build all" ON ) +option( BUILD_DOC "Build documentation" ${BUILD_ALL} ) + + +##### configure checks + +include( ConfigureChecks.cmake ) + + +###### global compiler settings + +add_definitions( -DHAVE_CONFIG_H -UTQT_NO_ASCII_CAST ) + +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( src ) +tde_conditional_add_subdirectory( BUILD_DOC doc ) + + +##### 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..fbc879f --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,29 @@ +########################################### +# # +# 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 ) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..61ede3a --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,8 @@ +#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@ 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/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..ca7a8df --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,52 @@ +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} +) + + +##### kvkbd (executable) + +tde_add_executable( ${PROJECT_NAME} AUTOMOC + + SOURCES + DragWidget.cpp + MainWidget.cpp + VButton.cpp + main.cpp + numpadvbutton.cpp + resizabledragwidget.cpp + resizabledragwidget.h + LINK + tdecore-shared + tdeui-shared + tdeio-shared + Xtst + + DESTINATION ${BIN_INSTALL_DIR} +) + + +##### icons + +tde_install_icons( ${PROJECT_NAME} ) + + +##### other data + +install( + FILES dock.png tray.png + DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/pics +) + +install( + FILES ${PROJECT_NAME}.desktop + DESTINATION ${APPS_INSTALL_DIR}/Utilities +) diff --git a/src/DragWidget.cpp b/src/DragWidget.cpp index 769c1a8..8517b99 100644 --- a/src/DragWidget.cpp +++ b/src/DragWidget.cpp @@ -33,3 +33,4 @@ void DragWidget::mouseMoveEvent(TQMouseEvent *e) } +#include "DragWidget.moc" diff --git a/src/MainWidget.cpp b/src/MainWidget.cpp index cb4f80f..75afa2d 100644 --- a/src/MainWidget.cpp +++ b/src/MainWidget.cpp @@ -1826,7 +1826,7 @@ void KbdTray::mousePressEvent(TQMouseEvent *e) } } - +#include "MainWidget.moc" diff --git a/src/VButton.cpp b/src/VButton.cpp index 92a54f0..48c7cf7 100644 --- a/src/VButton.cpp +++ b/src/VButton.cpp @@ -119,3 +119,5 @@ void VButton::timerEvent(TQTimerEvent *) } sendKey(); } + +#include "VButton.moc" diff --git a/src/numpadvbutton.cpp b/src/numpadvbutton.cpp index 772efcb..3e64fb0 100644 --- a/src/numpadvbutton.cpp +++ b/src/numpadvbutton.cpp @@ -48,3 +48,5 @@ void NumpadVButton::setKeyCode(unsigned int numpad_keycode, unsigned int cursor_ numlock_code = numpad_keycode; VButton::setKeyCode(cursor_code); } + +#include "numpadvbutton.moc" diff --git a/src/resizabledragwidget.cpp b/src/resizabledragwidget.cpp index 609289a..ec48d6e 100644 --- a/src/resizabledragwidget.cpp +++ b/src/resizabledragwidget.cpp @@ -89,4 +89,4 @@ void ResizableDragWidget::paintEvent(TQPaintEvent *) } - +#include "resizabledragwidget.moc"