diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d5d8677 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,92 @@ +############################################ +# # +# Improvements and feedbacks are welcome # +# # +# This file is released under GPL >= 3 # +# # +############################################ + + +cmake_minimum_required( VERSION 3.1 ) + + +#### general package setup + +project( k9copy ) + + +#### include essential cmake modules + +include( FindPkgConfig ) +include( CheckFunctionExists ) +include( CheckSymbolExists ) +include( CheckIncludeFile ) +include( CheckLibraryExists ) +include( CheckCSourceCompiles ) +include( CheckCXXSourceCompiles ) + + +#### 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_OPENGL "Enable OpenGL" ${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} ) +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" ) + + +##### source directories + +add_subdirectory( icons ) +add_subdirectory( k9decmpeg ) +add_subdirectory( k9devices ) +add_subdirectory( k9Mplayer ) +add_subdirectory( k9vamps ) +add_subdirectory( libdvdnav ) +add_subdirectory( libk9copy ) +add_subdirectory( k9author ) +add_subdirectory( src ) + +tde_conditional_add_project_docs( BUILD_DOC ) +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..3a9bbd2 --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,99 @@ +########################################### +# # +# 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 ) + + +##### libdvdread + +pkg_search_module ( LIBDVDREAD dvdread REQUIRED ) +if ( NOT LIBDVDREAD_FOUND ) + tde_message_fatal( "libdvdread is required, but was not found on your system" ) +endif ( ) + + +##### ffmpeg + +pkg_search_module( LIBAVCODEC libavcodec ) +if( NOT LIBAVCODEC_FOUND ) + tde_message_fatal( "libavcodec is required, but was not found on your system" ) +endif( ) + +pkg_search_module( LIBAVFORMAT libavformat ) +if( NOT LIBAVFORMAT_FOUND ) + tde_message_fatal( "libavformat is required, but was not found on your system" ) +endif( ) + +pkg_search_module( LIBAVUTIL libavutil ) +if( NOT LIBAVUTIL_FOUND ) + tde_message_fatal( "libavutil is required, but was not found on your system" ) +endif( ) + +pkg_search_module( LIBSWSCALE libswscale ) +if( NOT LIBSWSCALE_FOUND ) + tde_message_fatal( "libswscale is required, but was not found on your system" ) +endif( ) + +##### k3bdevice library +find_library( HAVE_K3BDEVICE k3bdevice ) +if( HAVE_K3BDEVICE ) + set( K3BDEVICE_LIBRARY "k3bdevice" ) +else() + tde_message_fatal( "libk3bdevice is required, but was not found on your system" ) +endif( ) + + +##### OpenGL + +if( WITH_OPENGL ) + set( OpenGL_GL_PREFERENCE LEGACY ) + find_package( OpenGL ) + if( NOT OPENGL_FOUND ) + tde_message_fatal( "OpenGL is required, but was not found on your system" ) + endif( NOT OPENGL_FOUND ) + set( HAVE_OPENGL ${OPENGL_FOUND} ) +endif( WITH_OPENGL ) + + +##### types + +check_include_file( "inttypes.h" HAVE_INTTYPES_H ) +check_include_file( "stdint.h" HAVE_STDINT_H ) + + +##### architecture + +if( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686" ) + set( ARCH_X86 1 ) +elseif( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" ) + set( ARCH_X86_64 1 ) +elseif( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "alpha" ) + set( ARCH_ALPHA 1 ) +elseif( ${CMAKE_SYSTEM_PROCESSOR} MATCHES ppc* ) + set( ARCH_PPC 1 ) +elseif( ${CMAKE_SYSTEM_PROCESSOR} MATCHES sparc* ) + set( ARCH_SPARC 1 ) +endif() + diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..5a397e7 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,24 @@ +#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@ + +/* Defines if you have OpenGL */ +#cmakedefine HAVE_OPENGL 1 + +/* Define if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H 1 + +/* Define if you have the header file. */ +#cmakedefine HAVE_STDINT_H 1 + +/* Define based on architecture */ +#cmakedefine ARCH_X86 1 +#cmakedefine ARCH_X86_64 1 +#cmakedefine ALPHA 1 +#cmakedefine PPC 1 +#cmakedefine SPARC 1 diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt new file mode 100644 index 0000000..47e6d7d --- /dev/null +++ b/icons/CMakeLists.txt @@ -0,0 +1 @@ +tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/k9copy/icons ) diff --git a/k9Mplayer/CMakeLists.txt b/k9Mplayer/CMakeLists.txt new file mode 100644 index 0000000..bbde101 --- /dev/null +++ b/k9Mplayer/CMakeLists.txt @@ -0,0 +1,12 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/libk9copy + ${TDE_INCLUDE_DIR} +) + +##### main k9mplayer +tde_add_library( k9mplayer STATIC_PIC AUTOMOC + SOURCES mplayer.ui k9mplayer.cpp +) diff --git a/k9author/CMakeLists.txt b/k9author/CMakeLists.txt new file mode 100644 index 0000000..b0ad1e2 --- /dev/null +++ b/k9author/CMakeLists.txt @@ -0,0 +1,21 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/libk9copy + ${CMAKE_SOURCE_DIR}/k9devices + ${CMAKE_SOURCE_DIR}/k9vamps + ${CMAKE_SOURCE_DIR}/src + ${LIBAVCODEC} + ${LIBAVFORMAT} + ${LIBAVUTIL} + ${LIBAVSWSCALE} + ${TDE_INCLUDE_DIR} +) + +##### main k9author +file( GLOB _lib_cpp_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) +file( GLOB _lib_ui_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.ui ) +tde_add_library( k9author STATIC_PIC AUTOMOC + SOURCES ${_lib_cpp_files} ${_lib_ui_files} +) diff --git a/k9decmpeg/CMakeLists.txt b/k9decmpeg/CMakeLists.txt new file mode 100644 index 0000000..6373a81 --- /dev/null +++ b/k9decmpeg/CMakeLists.txt @@ -0,0 +1,15 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/k9vamps + ${CMAKE_SOURCE_DIR}/libdvdnav + ${CMAKE_SOURCE_DIR}/libk9copy + ${TDE_INCLUDE_DIR} +) + +##### main k9decmpeg +file( GLOB _lib_cpp_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) +tde_add_library( k9decmpeg STATIC_PIC AUTOMOC + SOURCES ${_lib_cpp_files} +) diff --git a/k9devices/CMakeLists.txt b/k9devices/CMakeLists.txt new file mode 100644 index 0000000..aa7282c --- /dev/null +++ b/k9devices/CMakeLists.txt @@ -0,0 +1,12 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/libk9copy + ${TDE_INCLUDE_DIR} +) + +##### main k9devices +tde_add_library( k9devices STATIC_PIC AUTOMOC + SOURCES k9cddrive.cpp +) diff --git a/k9vamps/CMakeLists.txt b/k9vamps/CMakeLists.txt new file mode 100644 index 0000000..2dfd9a1 --- /dev/null +++ b/k9vamps/CMakeLists.txt @@ -0,0 +1,12 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/libk9copy + ${TDE_INCLUDE_DIR} +) + +##### main k9vamps +file( GLOB _lib_cpp_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) +tde_add_library( k9vamps STATIC_PIC + SOURCES ${_lib_cpp_files} +) diff --git a/libdvdnav/CMakeLists.txt b/libdvdnav/CMakeLists.txt new file mode 100644 index 0000000..f7baadd --- /dev/null +++ b/libdvdnav/CMakeLists.txt @@ -0,0 +1,10 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_BINARY_DIR} +) + +##### main k9dvdnav +file( GLOB _lib_c_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.c ) +tde_add_library( k9dvdnav STATIC_PIC + SOURCES ${_lib_c_files} +) diff --git a/libk9copy/CMakeLists.txt b/libk9copy/CMakeLists.txt new file mode 100644 index 0000000..dc753b7 --- /dev/null +++ b/libk9copy/CMakeLists.txt @@ -0,0 +1,16 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/libdvdnav + ${CMAKE_SOURCE_DIR}/k9decmpeg + ${CMAKE_SOURCE_DIR}/k9vamps + ${TDE_INCLUDE_DIR} +) + +##### main k9copy +file( GLOB _lib_cpp_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) +file( GLOB _lib_ui_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.ui ) +tde_add_library( k9copy STATIC_PIC AUTOMOC + SOURCES ${_lib_cpp_files} ${_lib_ui_files} +) diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000..24e3bd8 --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1 @@ +tde_add_project_translations() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..0b70b10 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,60 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/k9Mplayer + ${CMAKE_SOURCE_DIR}/k9author + ${CMAKE_SOURCE_DIR}/k9decmpeg + ${CMAKE_SOURCE_DIR}/k9devices + ${CMAKE_SOURCE_DIR}/k9vamps + ${CMAKE_SOURCE_DIR}/libdvdnav + ${CMAKE_SOURCE_DIR}/libk9copy + ${TDE_INCLUDE_DIR} +) + +link_directories( + ${TDE_LIB_DIR} + ${LIBAVCODEC_LIBRARY_DIRS} + ${LIBAVFORMAT_LIBRARY_DIRS} + ${LIBAVUTIL_LIBRARY_DIRS} + ${LIBSWSCALE_LIBRARY_DIRS} +) + +##### k9copy (executable) +file( GLOB _lib_cpp_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ) +file( GLOB _lib_ui_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.ui ) + +tde_add_executable( k9copy AUTOMOC + SOURCES ${_lib_cpp_files} ${_lib_ui_files} + LINK + k9mplayer-static k9author-static k9decmpeg-static k9devices-static + k9vamps-static k9dvdnav-static k9copy-static + tdecore-shared tdefx-shared tdeui-shared tdeio-shared tdehtml-shared + tdetexteditor-shared tdeparts-shared tdemdi-shared DCOP-shared + ${LIBAVCODEC_LIBRARIES} ${LIBAVFORMAT_LIBRARIES} ${LIBAVUTIL_LIBRARIES} + ${LIBSWSCALE_LIBRARIES} ${LIBDVDREAD_LIBRARIES} ${K3BDEVICE_LIBRARY} + DESTINATION ${BIN_INSTALL_DIR} +) + + +##### app icon + +tde_install_icons( ${PROJECT_NAME} ) + + +##### other files + +install( + FILES anim.mng k9copyui.rc mencoder.xml + DESTINATION ${DATA_INSTALL_DIR}/k9copy +) + +tde_create_translated_desktop( + SOURCE k9copy_open.desktop + DESTINATION ${DATA_INSTALL_DIR}/konqueror/servicemenus +) + +tde_create_translated_desktop( + SOURCE k9copy.desktop + DESTINATION ${XDG_APPS_INSTALL_DIR} +) diff --git a/src/k9glwidget.h b/src/k9glwidget.h index 21fea91..0f55560 100644 --- a/src/k9glwidget.h +++ b/src/k9glwidget.h @@ -12,6 +12,10 @@ #ifndef K9GLWIDGET_H #define K9GLWIDGET_H +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "k9common.h" #ifdef Q_MOC_RUN diff --git a/src/kviewmpeg2.cpp b/src/kviewmpeg2.cpp index 2433df3..7f369a1 100644 --- a/src/kviewmpeg2.cpp +++ b/src/kviewmpeg2.cpp @@ -17,6 +17,11 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "k9common.h" #include #include @@ -86,10 +91,8 @@ kViewMPEG2::kViewMPEG2() { m_layout=new TQGridLayout(label,1,1); #ifdef HAVE_OPENGL - readSettings(); #else - m_prefUseGL=FALSE; #endif //disable the option use_gl, so if k9copy crash, we restart without gl