From bc9bda10c93ebfb9862270576b445d1c2798d66d Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 5 Mar 2024 19:43:11 +0900 Subject: Conversion to cmake building system Signed-off-by: Michele Calgaro --- CMakeLists.txt | 86 ++++++++++++++++++++++++++ ConfigureChecks.cmake | 134 ++++++++++++++++++++++++++++++++++++++++ config.h.cmake | 26 ++++++++ icons/CMakeLists.txt | 4 ++ icons/action/CMakeLists.txt | 1 + icons/app/CMakeLists.txt | 1 + icons/cursor/CMakeLists.txt | 4 ++ icons/thumbnail/CMakeLists.txt | 4 ++ src/CMakeLists.txt | 24 +++++++ src/app/CMakeLists.txt | 56 +++++++++++++++++ src/desktopfiles/CMakeLists.txt | 11 ++++ src/gvcore/CMakeLists.txt | 90 +++++++++++++++++++++++++++ src/gvdirpart/CMakeLists.txt | 31 ++++++++++ src/gvimagepart/CMakeLists.txt | 26 ++++++++ src/imageutils/CMakeLists.txt | 34 ++++++++++ src/imageutils/jpegcontent.cpp | 2 - src/tools/CMakeLists.txt | 6 ++ src/tsthread/CMakeLists.txt | 11 ++++ src/updates/CMakeLists.txt | 11 ++++ 19 files changed, 560 insertions(+), 2 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 ConfigureChecks.cmake create mode 100644 config.h.cmake create mode 100644 icons/CMakeLists.txt create mode 100644 icons/action/CMakeLists.txt create mode 100644 icons/app/CMakeLists.txt create mode 100644 icons/cursor/CMakeLists.txt create mode 100644 icons/thumbnail/CMakeLists.txt create mode 100644 src/CMakeLists.txt create mode 100644 src/app/CMakeLists.txt create mode 100644 src/desktopfiles/CMakeLists.txt create mode 100644 src/gvcore/CMakeLists.txt create mode 100644 src/gvdirpart/CMakeLists.txt create mode 100644 src/gvimagepart/CMakeLists.txt create mode 100644 src/imageutils/CMakeLists.txt create mode 100644 src/tools/CMakeLists.txt create mode 100644 src/tsthread/CMakeLists.txt create mode 100644 src/updates/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e216c60 --- /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 3.5 ) + + +#### general package setup + +project( gwenview ) + + +#### include essential cmake modules + +include( FindPkgConfig ) +include( CheckSymbolExists ) +include( CheckIncludeFile ) +include( CheckLibraryExists ) +include( CheckCSourceCompiles ) +include( CheckCXXSourceCompiles ) +enable_testing() + + +#### include our cmake modules + +include( TDEMacros ) + + +##### set version number ######################## + +tde_set_project_version( ) + + +##### setup install paths + +include( TDESetupPaths ) +tde_setup_paths( ) + + +##### optional stuff + +option( WITH_ALL_OPTIONS "Enable all optional support" OFF ) +option( WITH_KIPI "Enable kipi support" ${WITH_ALL_OPTIONS} ) +option( WITH_MNG "Enable mng support" ${WITH_ALL_OPTIONS} ) +option( WITH_XCURSOR "Enable xcursor support" ${WITH_ALL_OPTIONS} ) + +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 + +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( icons ) +add_subdirectory( src ) + + +##### other data ################################ + +tde_conditional_add_project_docs( BUILD_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..d587bf1 --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,134 @@ +########################################### +# # +# 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( ) + +set( ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}:$ENV{PKG_CONFIG_PATH}:${LIB_INSTALL_DIR}/pkgconfig" ) + + +##### check for gcc visibility support + +if( WITH_GCC_VISIBILITY ) + tde_setup_gcc_visibility( ) +endif( WITH_GCC_VISIBILITY ) + + +##### check for libexiv2 + +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_include_file_cxx( "exiv2/exiv2.hpp" HAVE_EXIV2_EXIV2_HPP ) + + +##### check for libjpeg + +find_package( JPEG ) +if( NOT JPEG_FOUND ) + tde_message_fatal( "jpeg library is required, but was not found on your system" ) +endif() + + +##### checks for libkipi + +if( WITH_KIPI ) + pkg_search_module( LIBKIPI libkipi ) + if( NOT LIBKIPI_FOUND ) + tde_message_fatal( "libkipi was requested but not found on your system." ) + endif( ) + set( GV_HAVE_KIPI 1 ) +endif( ) + + +##### checks for libmng + +if( WITH_MNG ) + find_file( HAVE_LIBMNG_H "libmng.h" ) + if( NOT HAVE_LIBMNG_H ) + tde_message_fatal( "libmng was requested but not found on your system." ) + endif( ) + set( MNG_LIBRARY mng ) + set( HAVE_LIBMNG 1 ) +endif( ) + + +##### check for libpng + +find_package( PNG ) +if( NOT PNG_FOUND ) + tde_message_fatal( "png library is required, but was not found on your system" ) +endif() + + +##### check for libxcursor +if( WITH_XCURSOR ) + pkg_search_module( XCURSOR xcursor ) + if( XCURSOR_FOUND ) + set( GV_HAVE_XCURSOR 1 ) + else( ) + tde_message_fatal( "xcursor library is required, but was not found on your system" ) + endif( ) +endif() + + +##### check for lround function + +tde_save_and_set( CMAKE_REQUIRED_LIBRARIES "m" ) +check_symbol_exists ( lround "math.h" HAVE_LROUND ) +tde_restore( CMAKE_REQUIRED_LIBRARIES ) +if( NOT HAVE_LROUND ) + set( HAVE_LROUND 0 ) +endif( NOT HAVE_LROUND ) + + +##### check architecture + +if( NOT CMAKE_ARCHITECTURE ) + execute_process( + COMMAND ${CMAKE_C_COMPILER} -dumpmachine + OUTPUT_VARIABLE CMAKE_ARCHITECTURE + ERROR_VARIABLE CMAKE_ARCHITECTURE + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE ) + set( CMAKE_ARCHITECTURE "${CMAKE_ARCHITECTURE}" CACHE INTERNAL "" FORCE ) + message( STATUS "Detected ${CMAKE_ARCHITECTURE} target architecture" ) +endif( ) + + +##### check specific architecture dependant support + +if( ${CMAKE_ARCHITECTURE} MATCHES "i.86" ) + + # MMX support + message( STATUS "Performing MMX support test" ) + check_c_source_compiles( " + int main() { + #if defined(__GNUC__) + __asm__(\"pxor %mm0, %mm0\"); + #else + #error Not gcc on x86/x86_64 + #endif + return 0; + }" + HAVE_X86_MMX + ) + +endif( ) + diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..53f9a48 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,26 @@ +#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 exiv2/exiv2.hpp header +#cmakedefine HAVE_EXIV2_EXIV2_HPP 1 + +// Defined if you have libkipi install +#cmakedefine GV_HAVE_KIPI 1 + +// Defined if you have libmn install +#cmakedefine HAVE_LIBMNG 1 + +// Defined if you have libxcurso install +#cmakedefine GV_HAVE_XCURSOR 1 + +// Defined if you have lround function +#cmakedefine HAVE_LROUND 1 + +// Defined if you have MMX support +#cmakedefine HAVE_X86_MMX 1 diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt new file mode 100644 index 0000000..06285c8 --- /dev/null +++ b/icons/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory( action ) +add_subdirectory( app ) +add_subdirectory( cursor ) +add_subdirectory( thumbnail ) diff --git a/icons/action/CMakeLists.txt b/icons/action/CMakeLists.txt new file mode 100644 index 0000000..529659a --- /dev/null +++ b/icons/action/CMakeLists.txt @@ -0,0 +1 @@ +tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/gwenview/icons ) diff --git a/icons/app/CMakeLists.txt b/icons/app/CMakeLists.txt new file mode 100644 index 0000000..63f765b --- /dev/null +++ b/icons/app/CMakeLists.txt @@ -0,0 +1 @@ +tde_install_icons( ) diff --git a/icons/cursor/CMakeLists.txt b/icons/cursor/CMakeLists.txt new file mode 100644 index 0000000..033bb12 --- /dev/null +++ b/icons/cursor/CMakeLists.txt @@ -0,0 +1,4 @@ +install( + FILES zoom.png + DESTINATION ${DATA_INSTALL_DIR}/gwenview/cursors +) diff --git a/icons/thumbnail/CMakeLists.txt b/icons/thumbnail/CMakeLists.txt new file mode 100644 index 0000000..0d6754d --- /dev/null +++ b/icons/thumbnail/CMakeLists.txt @@ -0,0 +1,4 @@ +install( + FILES wait.png + DESTINATION ${DATA_INSTALL_DIR}/gwenview/thumbnail +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..3f4dd63 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,24 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${TQT_INCLUDE_DIRS} + ${TDE_INCLUDE_DIR} +) + +link_directories( + ${TQT_LIBRARY_DIRS} + ${TDE_LIB_DIR} +) + + +##### subfolders + +add_subdirectory( app ) +add_subdirectory( desktopfiles ) +add_subdirectory( gvcore ) +add_subdirectory( gvdirpart ) +add_subdirectory( gvimagepart ) +add_subdirectory( imageutils ) +add_subdirectory( tools ) +add_subdirectory( tsthread ) +add_subdirectory( updates ) diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt new file mode 100644 index 0000000..4fc06d9 --- /dev/null +++ b/src/app/CMakeLists.txt @@ -0,0 +1,56 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) + + +##### libgwenshared (static) + +tde_add_library( gwenshared STATIC_PIC AUTOMOC + SOURCES vtabwidget.cpp +) + + +##### gwenview (shared) + +set( gwenview_SRCS + bookmarkowner.cpp + bookmarkviewcontroller.cpp + bookmarkdialogbase.ui + bookmarkdialog.cpp + configfileoperationspage.ui + configfullscreenpage.ui + configimagelistpage.ui + configimageviewpage.ui + configmiscpage.ui + configslideshowpage.ui + kipiinterface.cpp + mainwindow.cpp + metaedit.cpp + treeview.cpp + dirviewcontroller.cpp + configdialog.cpp + history.cpp + main.cpp +) + +tde_add_tdeinit_executable( gwenview AUTOMOC + SOURCES ${gwenview_SRCS} + LINK + gwenshared-static gwenviewcore-shared + tdeutils-shared ${LIBKIPI_LIBRARIES} + DESTINATION ${LIB_INSTALL_DIR}/trinity +) + + +##### other files + +install( + FILES gwenviewui.rc + DESTINATION ${DATA_INSTALL_DIR}/gwenview +) + +install( + FILES gwenview.xpm + DESTINATION ${SHARE_INSTALL_PREFIX}/pixmaps +) diff --git a/src/desktopfiles/CMakeLists.txt b/src/desktopfiles/CMakeLists.txt new file mode 100644 index 0000000..5352cbd --- /dev/null +++ b/src/desktopfiles/CMakeLists.txt @@ -0,0 +1,11 @@ +##### desktop files + +tde_create_translated_desktop( + SOURCE gwenview.desktop + DESTINATION ${XDG_APPS_INSTALL_DIR} +) + +tde_create_translated_desktop( + SOURCE konqgwenview.desktop + DESTINATION ${DATA_INSTALL_DIR}/konqueror/servicemenus +) diff --git a/src/gvcore/CMakeLists.txt b/src/gvcore/CMakeLists.txt new file mode 100644 index 0000000..079d86b --- /dev/null +++ b/src/gvcore/CMakeLists.txt @@ -0,0 +1,90 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) + + +##### gwenviewcore (shared) + +set( gwenviewcore_SRCS + pngformattype.cpp + printdialog.cpp + printdialogpagebase.ui + thumbnailloadjob.cpp + imageview.cpp + imageviewcontroller.cpp + document.cpp + externaltoolmanager.cpp + externaltoolcontext.cpp + externaltoolaction.cpp + externaltooldialogbase.ui + externaltooldialog.cpp + fileviewcontroller.cpp + filethumbnailview.cpp + fileoperation.cpp + fileopobject.cpp + filethumbnailviewitem.cpp + filterbar.ui + qxcfi.cpp + archive.cpp + slideshow.cpp + filedetailview.cpp + filedetailviewitem.cpp + imagesavedialog.cpp + jpegformattype.cpp + mngformattype.cpp + xpm.cpp + documentimpl.cpp + documentloadingimpl.cpp + documentloadedimpl.cpp + documentjpegloadedimpl.cpp + documentanimatedloadedimpl.cpp + documentotherloadedimpl.cpp + busylevelmanager.cpp + cache.cpp + threadgate.cpp + imageviewtools.cpp + fullscreenbar.cpp + imageloader.cpp + cursortracker.cpp + captionformatter.cpp + thumbnaildetailsdialogbase.ui + thumbnaildetailsdialog.cpp + xcursor.cpp + mimetypeutils.cpp + bcgdialog.cpp + bcgdialogbase.ui + timeutils.cpp + clicklineedit.cpp + inputdialog.cpp + deletedialog.cpp + deletedialogbase.ui + miscconfig.kcfgc + slideshowconfig.kcfgc + fileoperationconfig.kcfgc + fullscreenconfig.kcfgc + imageviewconfig.kcfgc + fileviewconfig.kcfgc +) + +tde_add_library( gwenviewcore SHARED AUTOMOC + SOURCES ${gwenviewcore_SRCS} + LINK + tsthread-static gvimageutils-static + tdecore-shared tdeio-shared tdemediaplayer-shared + tdeparts-shared tdeprint-shared tdeui-shared + ${EXIV2_LIBRARIES} ${JPEG_LIBRARIES} ${MNG_LIBRARY} + ${PNG_LIBRARIES} ${XCURSOR_LIBRARIES} + VERSION 1.0.0 + DESTINATION ${LIB_INSTALL_DIR} +) + + +##### other files + +install( + FILES + miscconfig.kcfg slideshowconfig.kcfg fileoperationconfig.kcfg + fullscreenconfig.kcfg imageviewconfig.kcfg fileviewconfig.kcfg + DESTINATION ${KCFG_INSTALL_DIR} +) diff --git a/src/gvdirpart/CMakeLists.txt b/src/gvdirpart/CMakeLists.txt new file mode 100644 index 0000000..9837c29 --- /dev/null +++ b/src/gvdirpart/CMakeLists.txt @@ -0,0 +1,31 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) + + +##### gvdirpart (shared) + +tde_add_kpart( libgvdirpart AUTOMOC + SOURCES gvdirpart.cpp gvdirpartconfig.kcfgc + LINK tdeparts-shared gwenviewcore-shared + DESTINATION ${LIB_INSTALL_DIR}/trinity +) + + +##### other files + +tde_create_translated_desktop( + SOURCE gvdirpart.desktop + DESTINATION ${SERVICES_INSTALL_DIR} +) + +install( + FILES gvdirpart.rc + DESTINATION ${DATA_INSTALL_DIR}/gvdirpart +) + +install( + FILES gvdirpartconfig.kcfg + DESTINATION ${KCFG_INSTALL_DIR} +) diff --git a/src/gvimagepart/CMakeLists.txt b/src/gvimagepart/CMakeLists.txt new file mode 100644 index 0000000..0c962fc --- /dev/null +++ b/src/gvimagepart/CMakeLists.txt @@ -0,0 +1,26 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) + + +##### gvimagepart + +tde_add_kpart( libgvimagepart AUTOMOC + SOURCES gvimagepart.cpp + LINK tdeparts-shared gwenviewcore-shared + DESTINATION ${LIB_INSTALL_DIR}/trinity +) + + +##### other files + +tde_create_translated_desktop( + SOURCE gvimagepart.desktop + DESTINATION ${SERVICES_INSTALL_DIR} +) + +install( + FILES gvimagepart.rc gvimagepartpopup.rc + DESTINATION ${DATA_INSTALL_DIR}/gvimagepart +) diff --git a/src/imageutils/CMakeLists.txt b/src/imageutils/CMakeLists.txt new file mode 100644 index 0000000..9681a4a --- /dev/null +++ b/src/imageutils/CMakeLists.txt @@ -0,0 +1,34 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${EXIV2_INCLUDE_DIRS} + ${JPEG_INCLUDE_DIR} +) + + +##### gvimageutils (static) + +set( gvimageutils_SRCS imageutils.cpp jpegcontent.cpp scale.cpp transupp.c croppedqimage.cpp ) + +if( HAVE_X86_MMX ) + list( gvimageutils_SRCS APPEND _SRCS asm_scale.S ) + + # Force to use C compiler for asm_scale.S instead of ASM + # because it contains mixed code - ASM with C definitions + set_source_files_properties( asm_scale.S PROPERTIES LANGUAGE C ) + + add_compile_options( -DHAVE_X86_MMX ) +endif( ) + +tde_add_library( gvimageutils STATIC_PIC AUTOMOC + SOURCES ${gvimageutils_SRCS} + LINK tdecore-shared tdeio-shared ${EXIV2_LIBRARIES} ${JPEG_LIBRARIES} +) + + +##### testjpegcontent (executable) + +tde_add_check_executable( testjpegcontent AUTOMOC + SOURCES testjpegcontent.cpp + LINK gvimageutils-static +) diff --git a/src/imageutils/jpegcontent.cpp b/src/imageutils/jpegcontent.cpp index d94a32e..55bc384 100644 --- a/src/imageutils/jpegcontent.cpp +++ b/src/imageutils/jpegcontent.cpp @@ -17,9 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#if defined(HAVE_CONFIG_H) #include "config.h" -#endif // System #include diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt new file mode 100644 index 0000000..98ddfa8 --- /dev/null +++ b/src/tools/CMakeLists.txt @@ -0,0 +1,6 @@ +##### desktop files + +tde_create_translated_desktop( + SOURCE gimp.desktop kolourpaint.desktop konqueror.desktop tiledwallpaper.desktop wallpaper.desktop + DESTINATION ${DATA_INSTALL_DIR}/gwenview/tools +) diff --git a/src/tsthread/CMakeLists.txt b/src/tsthread/CMakeLists.txt new file mode 100644 index 0000000..9d16a37 --- /dev/null +++ b/src/tsthread/CMakeLists.txt @@ -0,0 +1,11 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) + + +##### tsthread (static) + +tde_add_library( tsthread STATIC_PIC AUTOMOC + SOURCES tsthread.cpp tswaitcondition.cpp +) diff --git a/src/updates/CMakeLists.txt b/src/updates/CMakeLists.txt new file mode 100644 index 0000000..ba99a56 --- /dev/null +++ b/src/updates/CMakeLists.txt @@ -0,0 +1,11 @@ +##### update files + +install( + FILES gwenview_thumbnail_size.upd gwenview_1.4_osdformat.upd + DESTINATION ${DATA_INSTALL_DIR}/tdeconf_update +) + +install( + PROGRAMS gwenview_thumbnail_size.sh gwenview_1.4_osdformat.sh + DESTINATION ${DATA_INSTALL_DIR}/tdeconf_update +) -- cgit v1.2.1