Conversion to the cmake building system.

Signed-off-by: gregory guy <gregory-tde@laposte.net>

some fixes and improvements.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/2/head
gregory guy 3 years ago
parent c995c0ed60
commit 2e4e81b25e
No known key found for this signature in database
GPG Key ID: 2CC84A1CC6823AF8

@ -0,0 +1,81 @@
############################################
# #
# Improvements and feedbacks are welcome #
# #
# This file is released under GPL >= 3 #
# #
############################################
cmake_minimum_required( VERSION 2.8.12 )
#### general package setup
project( libkdcraw )
set( VERSION R14.1.0 )
#### include essential cmake modules
include( FindPkgConfig )
include( CheckFunctionExists )
include( CheckSymbolExists )
include( CheckIncludeFile )
include( CheckIncludeFileCXX )
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_LCMS "Enable lcms support" ${WITH_ALL_OPTIONS} )
option( WITH_OPENMP "Enable OpenMP support" ${WITH_ALL_OPTIONS} )
##### user requested modules
option( BUILD_ALL "Build all" ON )
option( BUILD_KDCRAW "Build kdcraw program" OFF )
option( BUILD_TESTS "Build test programs" OFF )
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 )

@ -0,0 +1,80 @@
###########################################
# #
# 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 lcms
if( WITH_LCMS )
check_include_file( lcms2.h HAVE_LCMS2_H )
if( HAVE_LCMS2_H )
pkg_search_module( LCMS lcms2 )
set( LCMS_HEADER lcms2.h )
else()
check_include_file( lcms.h HAVE_LCMS_H )
if( HAVE_LCMS_H )
pkg_search_module( LCMS lcms )
set( LCMS_HEADER lcms.h )
else()
tde_message_fatal( "lcms is requested, but was not found on your system" )
endif()
endif()
set( USE_LCMS 1 )
endif( WITH_LCMS )
##### check for OpenMP
if( WITH_OPENMP )
if( CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
find_package( OpenMP )
if( OPENMP_FOUND )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
else()
tde_message_fatal( "OpenMP is requested, but was not found on your system" )
endif()
else()
tde_message_fatal( "OpenMP build is available for the GNU GCC compiler only" )
endif()
endif( WITH_OPENMP )
##### check for jpeg
if( BUILD_KDCRAW )
find_package( JPEG )
if( JPEG_FOUND )
set( HAVE_JPEG 1 )
else()
tde_message_fatal( "jpeg library is required, but was not found on your system" )
endif()
##### check for the math libc
find_library( MATH_LIBC m )
endif( BUILD_KDCRAW )

@ -0,0 +1,17 @@
#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@
/* Define lcms header */
#cmakedefine LCMS_HEADER <@LCMS_HEADER@>
/* Defined for lcms support */
#cmakedefine USE_LCMS 1
/* Defined if you have jpeg library */
#cmakedefine HAVE_JPEG 1

@ -0,0 +1,20 @@
add_subdirectory( libraw )
add_subdirectory( libkdcraw )
add_subdirectory( icons )
tde_conditional_add_subdirectory( BUILD_TESTS test )
tde_conditional_add_subdirectory( BUILD_KDCRAW dcraw )
##### 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}
)

@ -0,0 +1,38 @@
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
${LCMS_INCLUDE_DIRS}
${JPEG_INCLUDE_DIR}
)
link_directories(
${TQT_LIBRARY_DIRS}
${TDE_LIB_DIR}
)
##### kdcraw (executable)
tde_add_executable( kdcraw
SOURCES
dcraw.c
LINK
${LCMS_LIBRARIES}
${JPEG_LIBRARIES}
${MATH_LIBC}
DESTINATION ${BIN_INSTALL_DIR}
)
##### other data
INSTALL(
FILES kdcraw.1
DESTINATION ${MAN_INSTALL_DIR}/man1
COMPONENT doc
)

@ -22,10 +22,12 @@
$Revision: 1.399 $
$Date: 2008/03/05 01:29:34 $
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define VERSION "8.83"
#define DCRAW_VERSION "8.83"
#define _GNU_SOURCE
#define _USE_MATH_DEFINES
#include <ctype.h>
#include <errno.h>
@ -39,12 +41,14 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <locale.h>
/*
NO_JPEG disables decoding of compressed Kodak DC120 files.
NO_LCMS disables the "-p" option.
*/
#include "config.h"
#ifndef NO_JPEG
#ifdef HAVE_JPEG
#include <jpeglib.h>
#endif
#ifndef NO_LCMS
@ -100,6 +104,10 @@ typedef unsigned short ushort;
access them are prefixed with "CLASS". Note that a thread-safe
C++ class cannot have non-const static local variables.
*/
void swab(const void *restrict from, void *restrict to, ssize_t n);
void *memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen);
FILE *ifp;
short order;
char *ifname, *meta_data;
@ -2216,7 +2224,7 @@ void CLASS kodak_radc_load_raw()
#undef FORYX
#undef PREDICTOR
#ifdef NO_JPEG
#ifdef HAVE_JPEG
void CLASS kodak_jpeg_load_raw() {}
#else
@ -7641,7 +7649,7 @@ qt_common:
}
dng_skip:
if (!load_raw || height < 22) is_raw = 0;
#ifdef NO_JPEG
#ifdef HAVE_JPEG
if (load_raw == kodak_jpeg_load_raw) {
fprintf (stderr,_("%s: You must link dcraw with libjpeg!!\n"), ifname);
is_raw = 0;
@ -8044,7 +8052,7 @@ void CLASS tiff_head (struct tiff_hdr *th, int full)
strncpy (th->desc, desc, 512);
strncpy (th->make, make, 64);
strncpy (th->model, model, 64);
strcpy (th->soft, "dcraw v"VERSION);
strcpy (th->soft, "dcraw v" DCRAW_VERSION);
t = gmtime (&timestamp);
sprintf (th->date, "%04d:%02d:%02d %02d:%02d:%02d",
t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour,t->tm_min,t->tm_sec);

@ -0,0 +1,3 @@
##### icons
tde_install_icons()

@ -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++ wrapper around LibRaw library to decode RAW pictures. This library is used by digiKam and kipi-plugins.
URL: https://mirror.git.trinitydesktop.org/gitea/TDE/libkdcraw
Requires:
Version: 0.1.9
Libs: -L${libdir} -lkdcraw
Cflags: -I${includedir}

@ -0,0 +1,49 @@
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/libkdcraw/libraw
)
link_directories(
${TQT_LIBRARY_DIRS}
${TDE_LIB_DIR}
)
set( _SRC_ kdcraw.cpp
kdcrawprivate.cpp
dcrawsettingswidget.cpp
rnuminput.cpp
rcombobox.cpp
)
##### kdcraw (shared)
tde_add_library( kdcraw SHARED AUTOMOC
SOURCES
${_SRC_}
LINK
tdeui-shared
tdecore-shared
tdeio-shared
raw-static
VERSION 4.0.3
DESTINATION ${LIB_INSTALL_DIR}
)
##### headers
install(
FILES rawdecodingsettings.h kdcraw.h dcrawsettingswidget.h
rnuminput.h rcombobox.h dcrawinfocontainer.h rawfiles.h
libkdcraw_export.h version.h
DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}
)

@ -28,10 +28,16 @@
#endif
#ifdef KDE_EXPORT
#define LIBKDCRAW_EXPORT KDE_EXPORT
# define LIBKDCRAW_NO_EXPORT KDE_NO_EXPORT
# define LIBKDCRAW_EXPORT KDE_EXPORT
#else
#define LIBKDCRAW_EXPORT
# ifdef __KDE_HAVE_GCC_VISIBILITY
# define LIBKDCRAW_NO_EXPORT __attribute__ ((visibility("hidden")))
# define LIBKDCRAW_EXPORT __attribute__ ((visibility("default")))
# else
# define LIBKDCRAW_NO_EXPORT
# define LIBKDCRAW_EXPORT
# endif
#endif
#endif /* _LIBKDCRAW_EXPORT_H */

@ -0,0 +1,29 @@
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
${LCMS_INCLUDE_DIRS}
)
link_directories(
${TQT_LIBRARY_DIRS}
${TDE_LIB_DIR}
)
##### raw (static)
tde_add_library( raw STATIC_PIC AUTOMOC
SOURCES
src/libraw_cxx.cpp
src/libraw_c_api.cpp
internal/dcraw_common.cpp
internal/dcraw_fileio.cpp
internal/foveon.cpp
LINK
${LCMS_LIBRARIES}
)

@ -4,6 +4,9 @@
Look into original file (probably http://cybercom.net/~dcoffin/dcraw/dcraw.c)
for copyright information.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define CLASS LibRaw::
#include "libraw/libraw_types.h"
@ -8190,7 +8193,7 @@ void CLASS tiff_head (struct tiff_hdr *th, int full)
strncpy (th->t_desc, desc, 512);
strncpy (th->t_make, make, 64);
strncpy (th->t_model, model, 64);
strcpy (th->soft, "dcraw v" VERSION);
strcpy (th->soft, "dcraw v" DCRAW_VERSION);
t = gmtime (&timestamp);
sprintf (th->date, "%04d:%02d:%02d %02d:%02d:%02d",
t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour,t->tm_min,t->tm_sec);

@ -4,12 +4,14 @@
Look into original file (probably http://cybercom.net/~dcoffin/dcraw/dcraw.c)
for copyright information.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define NO_JPEG
#define VERSION "8.93"
#define _GNU_SOURCE
#define DCRAW_VERSION "8.93"
#define _USE_MATH_DEFINES
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
@ -22,6 +24,7 @@
#include <string.h>
#include <time.h>
#include <sys/types.h>
#ifdef _OPENMP
#include <omp.h>
#endif
@ -29,7 +32,6 @@
NO_JPEG disables decoding of compressed Kodak DC120 files.
NO_LCMS disables the "-p" option.
*/
#include "config.h"
#ifndef NO_JPEG
#include <jpeglib.h>
#endif

@ -24,6 +24,10 @@
#ifndef _LIBRAW_CLASS_H
#define _LIBRAW_CLASS_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <limits.h>
#include <memory.h>
#include <stdio.h>

@ -24,6 +24,10 @@
#ifndef _LIBRAW_TYPES_H
#define _LIBRAW_TYPES_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef WIN32
#include <sys/time.h>
#endif

@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -37,6 +41,9 @@
#define snprintf _snprintf
#endif
#ifdef _OPENMP
#include <omp.h>
#endif
void usage(const char *prog)
{

@ -0,0 +1,66 @@
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/libkdcraw/libraw
${CMAKE_SOURCE_DIR}/libkdcraw/libkdcraw
)
##### test programs
tde_add_executable( raw2png AUTOMOC
SOURCES
raw2png.cpp
LINK
kdcraw-shared
)
tde_add_executable( identify AUTOMOC
SOURCES
../libraw/samples/identify.cpp
LINK
raw-static
)
tde_add_executable( simple_dcraw AUTOMOC
SOURCES
../libraw/samples/simple_dcraw.cpp
LINK
raw-static
)
tde_add_executable( mem_image AUTOMOC
SOURCES
../libraw/samples/mem_image.cpp
LINK
raw-static
)
tde_add_executable( 4channels AUTOMOC
SOURCES
../libraw/samples/4channels.cpp
LINK
raw-static
)
tde_add_executable( unprocessed_raw AUTOMOC
SOURCES
../libraw/samples/unprocessed_raw.cpp
LINK
raw-static
)
tde_add_executable( dcraw_emu AUTOMOC
SOURCES
../libraw/samples/dcraw_emu.cpp
LINK
raw-static
)

@ -28,17 +28,9 @@
// KDE includes.
#include "tdeversion.h"
#if KDE_IS_VERSION(4,0,0)
#include "tqdebug.h"
#define PRINT_DEBUG tqDebug()
#define ENDL
#else
#include "kdebug.h"
#include <kdebug.h>
#define PRINT_DEBUG kdDebug()
#define ENDL << endl
#endif
// Local includes.

@ -0,0 +1,8 @@
file( GLOB_RECURSE po_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ./*/*.po )
foreach( _po ${po_files} )
string( REGEX REPLACE "/.*" "" _lang ${_po} )
if( "${_linguas}" MATCHES "^;*$" OR ";${_linguas};" MATCHES ";${_lang};" )
tde_create_translation( FILES ${_po} LANG ${_lang} )
endif()
endforeach()
Loading…
Cancel
Save