From 4dfb812575ade9e6dbeb10389c58588238c316d8 Mon Sep 17 00:00:00 2001 From: gregory guy Date: Wed, 13 Mar 2019 16:31:34 +0100 Subject: conversion to the cmake building system Signed-off-by: gregory guy --- CMakeLists.txt | 76 ++++++++++++++++++++++++++++ ConfigureChecks.cmake | 33 ++++++++++++ config.h.cmake | 8 +++ libkipi/CMakeLists.txt | 15 ++++++ libkipi/libkipi.pc.cmake | 11 ++++ libkipi/libkipi/CMakeLists.txt | 91 ++++++++++++++++++++++++++++++++++ libkipi/libkipi/libkipi_export.h.cmake | 37 ++++++++++++++ po/CMakeLists.txt | 7 +++ 8 files changed, 278 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 ConfigureChecks.cmake create mode 100644 config.h.cmake create mode 100644 libkipi/CMakeLists.txt create mode 100644 libkipi/libkipi.pc.cmake create mode 100644 libkipi/libkipi/CMakeLists.txt create mode 100644 libkipi/libkipi/libkipi_export.h.cmake create mode 100644 po/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0a56959 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,76 @@ +############################################ +# # +# Improvements and feedbacks are welcome # +# # +# This file is released under GPL >= 3 # +# # +############################################ + + +cmake_minimum_required( VERSION 2.8 ) + + +#### general package setup + +project( libkipi ) +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} ) + + +##### user requested modules + +option( BUILD_ALL "Build all" ON ) +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 "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" ) +set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" ) + + +##### directories + +add_subdirectory( ${PROJECT_NAME} ) +tde_conditional_add_subdirectory( BUILD_TRANSLATIONS po ) + + +##### 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..2029ae6 --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,33 @@ +########################################### +# # +# 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 ) + + +##### check for header + +tde_save( CMAKE_REQUIRED_INCLUDES ) +list( APPEND CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" ) +check_include_file( "kdemacros.h" KDEMACROS_USABLE ) +tde_restore( CMAKE_REQUIRED_INCLUDES ) 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/libkipi/CMakeLists.txt b/libkipi/CMakeLists.txt new file mode 100644 index 0000000..878b564 --- /dev/null +++ b/libkipi/CMakeLists.txt @@ -0,0 +1,15 @@ +add_subdirectory( ${PROJECT_NAME} ) + + +##### other data + +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_EXEC_PREFIX ${EXEC_INSTALL_PREFIX} ) +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_INCLUDE_DIR ${INCLUDE_INSTALL_DIR} ) +string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_LIB_DIR ${LIB_INSTALL_DIR} ) + +configure_file( libkipi.pc.cmake ${PROJECT_NAME}.pc @ONLY ) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc + DESTINATION ${PKGCONFIG_INSTALL_DIR} +) diff --git a/libkipi/libkipi.pc.cmake b/libkipi/libkipi.pc.cmake new file mode 100644 index 0000000..6137846 --- /dev/null +++ b/libkipi/libkipi.pc.cmake @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@PC_EXEC_PREFIX@ +libdir=@PC_LIB_DIR@ +includedir=@PC_INCLUDE_DIR@ + +Name: @PROJECT_NAME@ +Description: TDE library for shared plugins between graphical applications +Requires: +Version: 0.1.5 +Libs: -L${libdir} -lkipi +Cflags: -I${includedir} diff --git a/libkipi/libkipi/CMakeLists.txt b/libkipi/libkipi/CMakeLists.txt new file mode 100644 index 0000000..c26e24a --- /dev/null +++ b/libkipi/libkipi/CMakeLists.txt @@ -0,0 +1,91 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/libkipi + ${CMAKE_BINARY_DIR}/libkipi +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### kipi (shared) + +tde_add_library( kipi SHARED AUTOMOC + + SOURCES + interface.cpp + plugin.cpp + pluginloader.cpp + KDStream.cpp + imageinfo.cpp + imagecollection.cpp + imageinfoshared.cpp + imagecollectionshared.cpp + imagedialog.cpp + uploadwidget.cpp + batchprogressdialog.cpp + imagecollectionselector.cpp + LINK + tdecore-shared + tdeio-shared + tdeui-shared + + VERSION 0.1.1 + + DESTINATION ${LIB_INSTALL_DIR} +) + + +##### headers + +configure_file( libkipi_export.h.cmake libkipi_export.h @ONLY ) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libkipi_export.h + DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME} +) + +install( + FILES + interface.h + plugin.h + pluginloader.h + imageinfo.h + imagecollection.h + imageinfoshared.h + imagecollectionshared.h + imagedialog.h + uploadwidget.h + batchprogressdialog.h + imagecollectionselector.h + version.h + + DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME} +) + + +##### icons + +tde_install_icons( kipi ) + + +##### other data + +install( + FILES + kipi-plugins_logo.png + banner_left.png + + DESTINATION ${DATA_INSTALL_DIR}/kipi/data +) + +install( + FILES kipiplugin.desktop + DESTINATION ${SERVICETYPES_INSTALL_DIR} +) diff --git a/libkipi/libkipi/libkipi_export.h.cmake b/libkipi/libkipi/libkipi_export.h.cmake new file mode 100644 index 0000000..20e1553 --- /dev/null +++ b/libkipi/libkipi/libkipi_export.h.cmake @@ -0,0 +1,37 @@ +/* + This file is part of libkipi project + Copyright (c) 2005 Laurent Montel + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _LIBKIPI_EXPORT_H +#define _LIBKIPI_EXPORT_H + +#cmakedefine KDEMACROS_USABLE @KDEMACROS_USABLE@ + +#ifdef KDEMACROS_USABLE +#include +#endif + +#ifdef KDE_EXPORT +#define LIBKIPI_EXPORT KDE_EXPORT +#else +#define LIBKIPI_EXPORT +#endif + +#endif /* _LIBKIPI_EXPORT_H */ + diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..e3b5278 --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1,7 @@ +file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_NAME}.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.3