From 5055b406cde3a6f5495df6d3f7d1f70e8d262968 Mon Sep 17 00:00:00 2001 From: gregory guy Date: Thu, 14 Mar 2019 14:32:57 +0100 Subject: [PATCH] conversion to the cmake building system Signed-off-by: gregory guy --- CMakeLists.txt | 69 ++++++++++++++++++++++++++++++ ConfigureChecks.cmake | 41 ++++++++++++++++++ config.h.cmake | 11 +++++ libkexiv2/CMakeLists.txt | 15 +++++++ libkexiv2/libkexiv2.pc.cmake | 12 ++++++ libkexiv2/libkexiv2/CMakeLists.txt | 43 +++++++++++++++++++ 6 files changed, 191 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 ConfigureChecks.cmake create mode 100644 config.h.cmake create mode 100644 libkexiv2/CMakeLists.txt create mode 100644 libkexiv2/libkexiv2.pc.cmake create mode 100644 libkexiv2/libkexiv2/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d2ee230 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,69 @@ +############################################ +# # +# Improvements and feedbacks are welcome # +# # +# This file is released under GPL >= 3 # +# # +############################################ + + +cmake_minimum_required( VERSION 2.8 ) + + +#### general package setup + +project( libkexiv2 ) +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} ) + + +##### 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} ) + + +##### 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..7c18e99 --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,41 @@ +########################################### +# # +# 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 exiv2 + +pkg_search_module( EXIV2 exiv2 ) +if( NOT EXIV2_FOUND ) + tde_message_fatal( "exiv2 is required, but was not found on your system" ) +endif( NOT EXIV2_FOUND ) + + +##### 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..b26b50a --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,11 @@ +#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 if you have header */ +#cmakedefine KDEMACROS_USABLE 1 diff --git a/libkexiv2/CMakeLists.txt b/libkexiv2/CMakeLists.txt new file mode 100644 index 0000000..4a5b3f9 --- /dev/null +++ b/libkexiv2/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( ${PROJECT_NAME}.pc.cmake ${PROJECT_NAME}.pc @ONLY ) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc + DESTINATION ${PKGCONFIG_INSTALL_DIR} +) diff --git a/libkexiv2/libkexiv2.pc.cmake b/libkexiv2/libkexiv2.pc.cmake new file mode 100644 index 0000000..5f80b6a --- /dev/null +++ b/libkexiv2/libkexiv2.pc.cmake @@ -0,0 +1,12 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@PC_EXEC_PREFIX@ +libdir=@PC_LIB_DIR@ +includedir=@PC_INCLUDE_DIR@ + +Name: @PROJECT_NAME@ +Description: A C++ library to manipulate EXIF/IPTC metadata using Exiv2 library. This library is used by digiKam and kipi-plugins. +URL: http://www.kipi-plugins.org +Requires: +Version: 0.1.9 +Libs: -L${libdir} -lkexiv2 +Cflags: -I${includedir} diff --git a/libkexiv2/libkexiv2/CMakeLists.txt b/libkexiv2/libkexiv2/CMakeLists.txt new file mode 100644 index 0000000..c69fd57 --- /dev/null +++ b/libkexiv2/libkexiv2/CMakeLists.txt @@ -0,0 +1,43 @@ +include_directories( + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} + ${EXIV2_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} + ${EXIV2_LIBRARY_DIRS} +) + + +##### kexiv2 (shared) + +tde_add_library( kexiv2 SHARED AUTOMOC + + SOURCES + kexiv2.cpp + kexiv2private.cpp + LINK + tdecore-shared + ${EXIV2_LIBRARIES} + + VERSION 5.0.0 + + DESTINATION ${LIB_INSTALL_DIR} +) + + +##### headers + +install( + FILES + kexiv2.h + libkexiv2_export.h + version.h + + DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME} +)