From 48dfd726a278af29437e94d4ea2910ad60eef12c Mon Sep 17 00:00:00 2001 From: gregory guy Date: Mon, 22 Apr 2019 13:50:56 +0200 Subject: conversion to the cmake building system Signed-off-by: gregory guy --- CMakeLists.txt | 86 +++++++++++++++++++++++++++++++++ ConfigureChecks.cmake | 39 +++++++++++++++ config.h.cmake | 20 ++++++++ doc/CMakeLists.txt | 1 + doc/en/CMakeLists.txt | 1 + src/CMakeLists.txt | 2 + src/kcm/CMakeLists.txt | 39 +++++++++++++++ src/knemod/CMakeLists.txt | 60 +++++++++++++++++++++++ src/knemod/backends/CMakeLists.txt | 28 +++++++++++ src/knemod/backends/nettoolsbackend.cpp | 1 + src/knemod/interfacestatistics.cpp | 2 +- src/knemod/pics/CMakeLists.txt | 1 + translations/CMakeLists.txt | 7 +++ 13 files changed, 286 insertions(+), 1 deletion(-) 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 create mode 100644 src/kcm/CMakeLists.txt create mode 100644 src/knemod/CMakeLists.txt create mode 100644 src/knemod/backends/CMakeLists.txt create mode 100644 src/knemod/pics/CMakeLists.txt create mode 100644 translations/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..33a9506 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,86 @@ +############################################ +# # +# Improvements and feedbacks are welcome # +# # +# This file is released under GPL >= 3 # +# # +############################################ + + +cmake_minimum_required( VERSION 2.8 ) + + +#### general package setup + +project( knemo ) +set( VERSION R14.1.0 ) + + +#### include essential cmake modules + +include( FindPkgConfig ) +include( CheckFunctionExists ) +include( CheckSymbolExists ) +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_LIBIW "Enable build with libiw" ${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} ) + + +##### user defined options + +set( PATH_IFCONFIG "/sbin/ifconfig" CACHE STRING "Path for the ifconfig program" ) +set( PATH_IWCONFIG "/sbin/iwconfig" CACHE STRING "Path for the iwconfig program" ) +set( PATH_ROUTE "/sbin/route" CACHE STRING "Path for the route program" ) + + +##### 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 "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) +set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" ) + + +##### directories + +add_subdirectory( src ) +tde_conditional_add_subdirectory( BUILD_DOC doc ) +tde_conditional_add_subdirectory( BUILD_TRANSLATIONS translations ) + + +##### 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..71c36d8 --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,39 @@ +########################################### +# # +# 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) + +tde_setup_largefiles( ) + + +##### check for gcc visibility support + +if( WITH_GCC_VISIBILITY ) + tde_setup_gcc_visibility( ) +endif( WITH_GCC_VISIBILITY ) + + +##### support for libiw + +if( WITH_LIBIW ) +check_include_file( "iwlib.h" IW_HEADER ) +find_library( IW_LIBRARIES NAMES iw ) + +if( IW_HEADER AND IW_LIBRARIES ) + set( HAVE_LIBIW 1 ) + else() + tde_message_fatal( "libiw support is requested but was not found on your system" ) +endif( IW_HEADER AND IW_LIBRARIES ) +endif( WITH_LIBIW ) diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..791fded --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,20 @@ +#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@ + +/* Path for the ifconfig program */ +#cmakedefine PATH_IFCONFIG "@PATH_IFCONFIG@" + +/* Path path for the iwconfig program */ +#cmakedefine PATH_IWCONFIG "@PATH_IWCONFIG@" + +/* Path for the route program */ +#cmakedefine PATH_ROUTE "@PATH_ROUTE@" + +/* Defined if you have the header */ +#cmakedefine HAVE_LIBIW @HAVE_LIBIW@ 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..16ccf18 --- /dev/null +++ b/doc/en/CMakeLists.txt @@ -0,0 +1 @@ +tde_create_handbook( DESTINATION kcontrol/${PROJECT_NAME} ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..825e5b4 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory( kcm ) +add_subdirectory( knemod ) diff --git a/src/kcm/CMakeLists.txt b/src/kcm/CMakeLists.txt new file mode 100644 index 0000000..9a039be --- /dev/null +++ b/src/kcm/CMakeLists.txt @@ -0,0 +1,39 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/src/knemod/backends + ${CMAKE_SOURCE_DIR}/src/common +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### kcm_knemo (kpart) + +tde_add_kpart( kcm_knemo AUTOMOC + + SOURCES + configdlg.ui + configdialog.cpp + + LINK + tdecore-shared + tdeui-shared + tdeio-shared + + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### other data + +install( + FILES kcm_knemo.desktop + DESTINATION ${XDG_APPS_INSTALL_DIR} +) diff --git a/src/knemod/CMakeLists.txt b/src/knemod/CMakeLists.txt new file mode 100644 index 0000000..648d40c --- /dev/null +++ b/src/knemod/CMakeLists.txt @@ -0,0 +1,60 @@ +add_subdirectory( pics ) +add_subdirectory( backends ) + +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/src/knemod/backends + ${CMAKE_SOURCE_DIR}/src/common +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### kded_knemod (kpart) + +tde_add_kpart( kded_knemod AUTOMOC + + SOURCES + interfacestatusdlg.ui + interfacestatisticsdlg.ui + knemodaemon.skel + knemodaemon.cpp + interface.cpp + interfaceicon.cpp + interfacetray.cpp + interfacemonitor.cpp + interfacestatusdialog.cpp + interfacetooltip.cpp + signalplotter.cpp + interfacestatistics.cpp + interfacestatisticsdialog.cpp + LINK + tdecore-shared + tdeio-shared + tdeui-shared + tdeutils-shared + tdeinit_kded + knemo_backends-static + + DESTINATION ${PLUGIN_INSTALL_DIR} +) + + +##### other data + +install( + FILES eventsrc + DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME} +) + +install( + FILES knemod.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/kded +) diff --git a/src/knemod/backends/CMakeLists.txt b/src/knemod/backends/CMakeLists.txt new file mode 100644 index 0000000..3e9ef71 --- /dev/null +++ b/src/knemod/backends/CMakeLists.txt @@ -0,0 +1,28 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/src/common + ${CMAKE_SOURCE_DIR}/src/knemod +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### knemo_backends (static) + +tde_add_library( knemo_backends STATIC_PIC AUTOMOC + + SOURCES + backendbase.cpp + nettoolsbackend.cpp + sysbackend.cpp + LINK + tdeio-shared + ${IW_LIBRARIES} +) diff --git a/src/knemod/backends/nettoolsbackend.cpp b/src/knemod/backends/nettoolsbackend.cpp index 014e299..1437e47 100644 --- a/src/knemod/backends/nettoolsbackend.cpp +++ b/src/knemod/backends/nettoolsbackend.cpp @@ -496,3 +496,4 @@ void NetToolsBackend::parseRouteOutput() } } } +#include "nettoolsbackend.moc" diff --git a/src/knemod/interfacestatistics.cpp b/src/knemod/interfacestatistics.cpp index 1d0c5df..11212f3 100644 --- a/src/knemod/interfacestatistics.cpp +++ b/src/knemod/interfacestatistics.cpp @@ -381,4 +381,4 @@ void InterfaceStatistics::updateCurrentYear() mYearStatistics.append( mCurrentYear ); // TODO: insert at correct position emit yearStatisticsChanged(); } - +#include "interfacestatistics.moc" diff --git a/src/knemod/pics/CMakeLists.txt b/src/knemod/pics/CMakeLists.txt new file mode 100644 index 0000000..63f765b --- /dev/null +++ b/src/knemod/pics/CMakeLists.txt @@ -0,0 +1 @@ +tde_install_icons( ) diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt new file mode 100644 index 0000000..dd31c67 --- /dev/null +++ b/translations/CMakeLists.txt @@ -0,0 +1,7 @@ +file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.po ) + +foreach( _po ${po_files} ) + string( REPLACE "/" ";" _path "${_po}" ) + list( GET _path 0 _lang ) + tde_create_translation( FILES ${_po} LANG ${_lang} ) +endforeach( ) -- cgit v1.2.1