Skip to content

Commit

Permalink
KF5 porting, automatic build fixes, cmake changes, automoc
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrd2 committed Feb 23, 2015
1 parent 627e8de commit bfda64c
Show file tree
Hide file tree
Showing 228 changed files with 1,818 additions and 1,483 deletions.
54 changes: 46 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
PROJECT(subtitlecomposer)
project(subtitlecomposer)

FIND_PACKAGE(KDE4 REQUIRED)
# FIND_PACKAGE(Msgfmt REQUIRED)
FIND_PACKAGE(Gettext REQUIRED)
cmake_minimum_required(VERSION 2.8.12)
set(QT_MIN_VERSION "5.2.0")

INCLUDE(KDE4Defaults)
INCLUDE(MacroLibrary)
find_package(ECM 1.2.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

ADD_SUBDIRECTORY(po)
ADD_SUBDIRECTORY(src)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)

include(ECMInstallIcons)

include(ECMAddTests) # build tests

include(FeatureSummary)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Widgets Test Declarative)
#add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)

find_package(KF5 REQUIRED
Auth Config ConfigWidgets CoreAddons I18n KIO
Sonnet Kross Codecs TextWidgets WidgetsAddons
# TODO: remove it when done porting
KDELibs4Support)

find_package(Phonon4Qt5 REQUIRED)

add_definitions(
# -DQT_USE_QSTRINGBUILDER
# -DQT_NO_CAST_TO_ASCII
# -DQT_NO_CAST_FROM_ASCII
# -DQT_STRICT_ITERATORS
-DQT_NO_URL_CAST_FROM_STRING
# -DQT_NO_CAST_FROM_BYTEARRAY
# -DQT_NO_SIGNALS_SLOTS_KEYWORDS
# -DQT_USE_FAST_OPERATOR_PLUS
# -DQT_USE_FAST_CONCATENATION
# -Wno-deprecated-declarations
)

add_subdirectory(po)
add_subdirectory(src)
22 changes: 22 additions & 0 deletions cmake/COPYING-CMAKE-SCRIPTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 changes: 52 additions & 0 deletions cmake/FindGLIB2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# - Try to find the GLIB2 libraries
# Once done this will define
#
# GLIB2_FOUND - system has glib2
# GLIB2_INCLUDE_DIR - the glib2 include directory
# GLIB2_LIBRARIES - glib2 library

# Copyright (c) 2008 Laurent Montel, <montel@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.


if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
# Already in cache, be silent
set(GLIB2_FIND_QUIETLY TRUE)
endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)

find_package(PkgConfig)
pkg_check_modules(PC_LibGLIB2 glib-2.0)

find_path(GLIB2_MAIN_INCLUDE_DIR
NAMES glib.h
HINTS ${PC_LibGLIB2_INCLUDEDIR}
PATH_SUFFIXES glib-2.0)

find_library(GLIB2_LIBRARY
NAMES glib-2.0
HINTS ${PC_LibGLIB2_LIBDIR}
)

set(GLIB2_LIBRARIES ${GLIB2_LIBRARY})

# search the glibconfig.h include dir under the same root where the library is found
get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH)

find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h
PATH_SUFFIXES glib-2.0/include
HINTS ${PC_LibGLIB2_INCLUDEDIR} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH})

set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}")

# not sure if this include dir is optional or required
# for now it is optional
if(GLIB2_INTERNAL_INCLUDE_DIR)
set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}")
endif(GLIB2_INTERNAL_INCLUDE_DIR)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)

mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES)
52 changes: 52 additions & 0 deletions cmake/FindGObject.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# - Try to find GObject
# Once done this will define
#
# GOBJECT_FOUND - system has GObject
# GOBJECT_INCLUDE_DIR - the GObject include directory
# GOBJECT_LIBRARIES - the libraries needed to use GObject
# GOBJECT_DEFINITIONS - Compiler switches required for using GObject

# Copyright (c) 2011, Raphael Kubo da Costa <kubito@gmail.com>
# Copyright (c) 2006, Tim Beaulen <tbscope@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_GOBJECT gobject-2.0)
SET(GOBJECT_DEFINITIONS ${PC_GOBJECT_CFLAGS_OTHER})

FIND_PATH(GOBJECT_INCLUDE_DIR gobject.h
HINTS
${PC_GOBJECT_INCLUDEDIR}
${PC_GOBJECT_INCLUDE_DIRS}
PATH_SUFFIXES glib-2.0/gobject/
)

FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0
HINTS
${PC_GOBJECT_LIBDIR}
${PC_GOBJECT_LIBRARY_DIRS}
)
FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0
HINTS
${PC_GOBJECT_LIBDIR}
${PC_GOBJECT_LIBRARY_DIRS}
)
FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0
HINTS
${PC_GOBJECT_LIBDIR}
${PC_GOBJECT_LIBRARY_DIRS}
)
FIND_LIBRARY(_GLibs NAMES glib-2.0
HINTS
${PC_GOBJECT_LIBDIR}
${PC_GOBJECT_LIBRARY_DIRS}
)

SET( GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs} )

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GOBJECT DEFAULT_MSG GOBJECT_LIBRARIES GOBJECT_INCLUDE_DIR)

MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR _GObjectLibs _GModuleLibs _GThreadLibs _GLibs)
85 changes: 85 additions & 0 deletions cmake/FindGStreamer.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# - Try to find GStreamer
# Once done this will define
#
# GSTREAMER_FOUND - system has GStreamer
# GSTREAMER_INCLUDE_DIR - the GStreamer include directory
# GSTREAMER_LIBRARIES - the libraries needed to use GStreamer
# GSTREAMER_DEFINITIONS - Compiler switches required for using GStreamer
# GSTREAMER_VERSION - the version of GStreamer

# Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org>
# (c)2006, Tim Beaulen <tbscope@gmail.com>

# TODO: Other versions --> GSTREAMER_X_Y_FOUND (Example: GSTREAMER_0_8_FOUND and GSTREAMER_1.0_FOUND etc)


IF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY)
# in cache already
SET(GStreamer_FIND_QUIETLY TRUE)
ELSE (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY)
SET(GStreamer_FIND_QUIETLY FALSE)
ENDIF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY)

IF (NOT WIN32)
FIND_PACKAGE(PkgConfig REQUIRED)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
# don't make this check required - otherwise you can't use macro_optional_find_package on this one
PKG_CHECK_MODULES(PKG_GSTREAMER gstreamer-1.0)
SET(GSTREAMER_VERSION ${PKG_GSTREAMER_VERSION})
SET(GSTREAMER_DEFINITIONS ${PKG_GSTREAMER_CFLAGS})
ENDIF (NOT WIN32)

FIND_PATH(GSTREAMER_INCLUDE_DIR gst/gst.h
PATHS
${PKG_GSTREAMER_INCLUDE_DIRS}
PATH_SUFFIXES gstreamer-1.0
)

FIND_LIBRARY(GSTREAMER_LIBRARIES NAMES gstreamer-1.0
PATHS
${PKG_GSTREAMER_LIBRARY_DIRS}
)

FIND_LIBRARY(GSTREAMER_BASE_LIBRARY NAMES gstbase-1.0
PATHS
${PKG_GSTREAMER_LIBRARY_DIRS}
)

FIND_LIBRARY(GSTREAMER_APP_LIBRARY NAMES gstapp-1.0
PATHS
${PKG_GSTREAMER_LIBRARY_DIRS}
)

IF (GSTREAMER_INCLUDE_DIR)
ELSE (GSTREAMER_INCLUDE_DIR)
MESSAGE(STATUS "GStreamer: WARNING: include dir not found")
ENDIF (GSTREAMER_INCLUDE_DIR)

IF (GSTREAMER_LIBRARIES)
ELSE (GSTREAMER_LIBRARIES)
MESSAGE(STATUS "GStreamer: WARNING: library not found")
ENDIF (GSTREAMER_LIBRARIES)

if (GSTREAMER_APP_LIBRARY)
ELSE (GSTREAMER_APP_LIBRARY)
MESSAGE(STATUS "GStreamer: WARNING: app library not found")
ENDIF (GSTREAMER_APP_LIBRARY)

IF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY)
SET(GSTREAMER_FOUND TRUE)
ELSE (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY)
SET(GSTREAMER_FOUND FALSE)
ENDIF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_APP_LIBRARY)

IF (GSTREAMER_FOUND)
IF (NOT GStreamer_FIND_QUIETLY)
MESSAGE(STATUS "Found GStreamer: ${GSTREAMER_LIBRARIES}")
ENDIF (NOT GStreamer_FIND_QUIETLY)
ELSE (GSTREAMER_FOUND)
IF (GStreamer_FIND_REQUIRED)
MESSAGE(SEND_ERROR "Could NOT find GStreamer")
ENDIF (GStreamer_FIND_REQUIRED)
ENDIF (GSTREAMER_FOUND)

MARK_AS_ADVANCED(GSTREAMER_INCLUDE_DIR GSTREAMER_LIBRARIES GSTREAMER_BASE_LIBRARY GSTREAMER_INTERFACE_LIBRARY GSTREAMER_APP_LIBRARY)
112 changes: 112 additions & 0 deletions cmake/FindGStreamerPlugins.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# - Try to find GStreamer_Plugins
# Once done this will define
#
# GSTREAMERPLUGINSBASE_FOUND - system has GStreamer_Plugins
# GSTREAMERPLUGINSBASE_INCLUDE_DIRS - the GStreamer_Plugins include directories
# GSTREAMERPLUGINSBASE_LIBRARIES - the libraries needed to use GStreamer_Plugins
#
# The following variables are set for each plugin PLUGINNAME:
#
# GSTREAMER_PLUGIN_PLUGINNAME_FOUND - plugin is found
# GSTREAMER_PLUGIN_PLUGINNAME_INCLUDE_DIR - plugin include directory
# GSTREAMER_PLUGIN_PLUGINNAME_LIBRARY - the library needed to use plugin
#
# (c)2009 Nokia Corporation
# (c)2010 Yury G. Kudryashov <urkud@ya.ru>

FIND_PACKAGE(PkgConfig REQUIRED)

IF (NOT WIN32)
# don't make this check required - otherwise you can't use macro_optional_find_package on this one
PKG_CHECK_MODULES( PKG_GSTREAMER_PLUGINSBASE gstreamer-plugins-base-1.0 )
ENDIF (NOT WIN32)

MACRO(MACRO_FIND_GSTREAMER_PLUGIN _plugin _header)
STRING(TOUPPER ${_plugin} _upper)
IF (NOT WIN32)
# don't make this check required - otherwise you can't use macro_optional_find_package on this one
PKG_CHECK_MODULES( PKG_GSTREAMER_${_upper} gstreamer-${_plugin}-1.0 )
ENDIF (NOT WIN32)

FIND_LIBRARY(GSTREAMER_PLUGIN_${_upper}_LIBRARY NAMES gst${_plugin}-1.0
PATHS
${PKG_GSTREAMER_PLUGINSBASE_LIBRARY_DIRS}
${PKG_GSTREAMER_${_upper}_LIBRARY_DIRS}
)

FIND_PATH(GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR
NAMES gst/${_plugin}/${_header}
PATHS
${PKG_GSTREAMER_PLUGINSBASE_INCLUDE_DIRS}
${PKG_GSTREAMER_${_upper}_INCLUDE_DIRS}
)

IF(GSTREAMER_PLUGIN_${_upper}_LIBRARY AND GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR)
SET(GSTREAMER_PLUGIN_${_upper}_FOUND TRUE)
LIST(APPEND GSTREAMERPLUGINSBASE_INCLUDE_DIRS GSTREAMER_${_upper}_INCLUDE_DIR)
LIST(APPEND GSTREAMERPLUGINSBASE_LIBRARIES GSTREAMER_${_upper}_LIBRARY)
ELSE(GSTREAMER_PLUGIN_${_upper}_LIBRARY AND GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR)
MESSAGE(STATUS "Could not find ${_plugin} plugin")
MESSAGE(STATUS "${_upper} library: ${GSTREAMER_${_upper}_LIBRARY}")
MESSAGE(STATUS "${_upper} include dir: ${GSTREAMER_${_upper}_INCLUDE_DIR}")
SET(GSTREAMER_PLUGIN_${_upper}_FOUND FALSE)
SET(GSTREAMER_PLUGIN_${_upper}_LIBRARY GSTREAMER_${_upper}_LIBRARY-NOTFOUND)
SET(GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR GSTREAMER_${_upper}_INCLUDE_DIR-NOTFOUND)
SET(GSTREAMERPLUGINSBASE_FOUND FALSE)
ENDIF(GSTREAMER_PLUGIN_${_upper}_LIBRARY AND GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR)

MARK_AS_ADVANCED(GSTREAMER_PLUGIN_${_upper}_LIBRARY
GSTREAMER_PLUGIN_${_upper}_INCLUDE_DIR)
ENDMACRO(MACRO_FIND_GSTREAMER_PLUGIN)

#
# Base plugins:
# audio
# cdda
# netbuffer
# pbutils
# riff
# rtp
# rtsp
# sdp
# tag
# video
#
# The gstinterfaces-1.0 library is found by FindGStreamer.cmake
#

SET(GSTREAMER_PLUGINSBASE_FOUND TRUE)
MACRO_FIND_GSTREAMER_PLUGIN(audio audio.h)
MACRO_FIND_GSTREAMER_PLUGIN(cdda gstcddabasesrc.h)
MACRO_FIND_GSTREAMER_PLUGIN(netbuffer gstnetbuffer.h)
MACRO_FIND_GSTREAMER_PLUGIN(pbutils pbutils.h)
MACRO_FIND_GSTREAMER_PLUGIN(riff riff-ids.h)
MACRO_FIND_GSTREAMER_PLUGIN(rtp gstrtpbuffer.h)
MACRO_FIND_GSTREAMER_PLUGIN(rtsp gstrtspdefs.h)
MACRO_FIND_GSTREAMER_PLUGIN(sdp gstsdp.h)
MACRO_FIND_GSTREAMER_PLUGIN(tag tag.h)
MACRO_FIND_GSTREAMER_PLUGIN(video video.h)

IF (GSTREAMERPLUGINSBASE_FOUND)
LIST(REMOVE_DUPLICATES GSTREAMERPLUGINSBASE_LIBRARIES)
LIST(REMOVE_DUPLICATES GSTREAMERPLUGINSBASE_INCLUDE_DIRS)
IF (NOT GStreamer_Plugins_FIND_QUIETLY)
MESSAGE(STATUS "Found GStreamer Plugins:
${GSTREAMER_PLUGIN_AUDIO_LIBRARIES}
${GSTREAMER_PLUGIN_CDDA_LIBRARIES}
${GSTREAMER_PLUGIN_NETBUFFER_LIBRARIES}
${GSTREAMER_PLUGIN_PBUTILS_LIBRARIES}
${GSTREAMER_PLUGIN_RIFF_LIBRARIES}
${GSTREAMER_PLUGIN_RTP_LIBRARIES}
${GSTREAMER_PLUGIN_RTSP_LIBRARIES}
${GSTREAMER_PLUGIN_SDP_LIBRARIES}
${GSTREAMER_PLUGIN_TAG_LIBRARIES}
${GSTREAMER_PLUGIN_VIDEO_LIBRARIES}")
ENDIF (NOT GStreamer_Plugins_FIND_QUIETLY)
ELSE (GSTREAMERPLUGINSBASE_FOUND)
SET(GSTREAMERPLUGINSBASE_LIBRARIES GSTREAMERPLUGINSBASE_LIBRARIES-NOTFOUND)
SET(GSTREAMERPLUGINSBASE_INCLUDE_DIRS GSTREAMERPLUGINSBASE_INCLUDE_DIRS-NOTFOUND)
IF (GStreamer_Plugins_FIND_REQUIRED)
MESSAGE(SEND_ERROR "Could NOT find GStreamer Plugins")
ENDIF (GStreamer_Plugins_FIND_REQUIRED)
ENDIF (GSTREAMERPLUGINSBASE_FOUND)
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include_directories( ${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} )
include_directories(${QT_INCLUDES})

kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en)

add_subdirectory( en )
add_subdirectory(en)
4 changes: 2 additions & 2 deletions doc/en/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include_directories( ${KDE4_INCLUDES} ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} )
include_directories(${QT_INCLUDES})

kde4_create_handbook( index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en )
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en)
Loading

0 comments on commit bfda64c

Please sign in to comment.