okular/CMakeLists.txt

378 lines
10 KiB
CMake
Raw Normal View History

project(okular)
2014-08-10 18:35:46 +00:00
cmake_minimum_required(VERSION 2.8.12)
2014-08-06 20:51:03 +00:00
set(QT_REQUIRED_VERSION "5.6.0")
set(KF5_REQUIRED_VERSION "5.16.0")
2014-08-06 20:51:03 +00:00
find_package(ECM 5.19.0 CONFIG REQUIRED)
2014-08-06 20:51:03 +00:00
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
# KDE Application Version, managed by release script
set (KDE_APPLICATIONS_VERSION_MAJOR "17")
set (KDE_APPLICATIONS_VERSION_MINOR "07")
set (KDE_APPLICATIONS_VERSION_MICRO "80")
set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}")
2014-08-06 20:51:03 +00:00
include(ECMInstallIcons)
include(ECMSetupVersion)
include(ECMOptionalAddSubdirectory)
2014-08-10 18:35:46 +00:00
include(GenerateExportHeader)
include(FeatureSummary)
2015-03-04 06:52:20 +00:00
include(ECMAddAppIcon)
2016-08-13 20:32:31 +00:00
include(KDECompilerSettings NO_POLICY_SCOPE)
2014-08-10 18:35:46 +00:00
include(KDEInstallDirs)
include(KDECMakeSettings)
2014-08-12 21:36:11 +00:00
include(ECMAddTests)
include(ECMAddAppIcon)
include(ECMPackageConfigHelpers)
2017-07-17 18:37:44 +00:00
ecm_setup_version(1.2.${KDE_APPLICATIONS_VERSION_MICRO}
VARIABLE_PREFIX OKULAR
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/core/version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/Okular5ConfigVersion.cmake")
2014-08-06 20:51:03 +00:00
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS Core DBus Test Widgets PrintSupport Svg Qml Quick)
find_package(Qt5 ${QT_REQUIRED_VERSION} OPTIONAL_COMPONENTS TextToSpeech)
if (NOT Qt5TextToSpeech_FOUND)
message(STATUS "Qt5TextToSpeech not found, speech features will be disabled")
else()
add_definitions(-DHAVE_SPEECH)
endif()
find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
2014-08-09 14:05:30 +00:00
Archive
Bookmarks
Completion
2014-08-09 14:05:30 +00:00
Config
ConfigWidgets
CoreAddons
2016-07-24 21:44:49 +00:00
DocTools
2016-07-11 17:40:49 +00:00
IconThemes
2014-08-09 14:05:30 +00:00
JS
KIO
Parts
ThreadWeaver
Wallet
2016-07-11 17:40:49 +00:00
WindowSystem
2014-08-09 14:05:30 +00:00
)
if(NOT WIN32)
find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
Activities
)
endif()
2014-08-09 14:05:30 +00:00
find_package(Phonon4Qt5 CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
find_package(ZLIB REQUIRED)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
2014-09-10 20:30:35 +00:00
add_definitions(-DTRANSLATION_DOMAIN="okular")
2014-08-09 14:05:30 +00:00
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${PHONON_INCLUDES} core/synctex ${ZLIB_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/core)
2016-08-13 20:53:29 +00:00
add_subdirectory( mobile )
2015-08-26 22:05:06 +00:00
option(BUILD_COVERAGE "Build the project with gcov support" OFF)
2017-03-19 22:27:04 +00:00
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override" )
endif()
endif()
2015-08-26 22:05:06 +00:00
if(BUILD_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
endif()
2014-08-09 10:47:33 +00:00
add_subdirectory( ui )
add_subdirectory( shell )
add_subdirectory( generators )
2014-10-19 16:21:07 +00:00
add_subdirectory( autotests )
add_subdirectory( conf/autotests )
2014-08-06 20:51:03 +00:00
2016-07-11 17:41:37 +00:00
add_subdirectory(doc)
include(OkularConfigureChecks.cmake)
if(NOT WIN32)
set(MATH_LIB m)
else(NOT WIN32)
set(MATH_LIB)
endif(NOT WIN32)
# okularcore
set(okularcore_SRCS
core/action.cpp
core/annotations.cpp
core/area.cpp
core/audioplayer.cpp
core/bookmarkmanager.cpp
core/chooseenginedialog.cpp
core/document.cpp
2013-04-05 22:39:35 +00:00
core/documentcommands.cpp
core/fontinfo.cpp
core/form.cpp
core/generator.cpp
core/generator_p.cpp
core/misc.cpp
core/movie.cpp
core/observer.cpp
2014-09-11 17:36:01 +00:00
core/debug.cpp
core/page.cpp
core/pagecontroller.cpp
core/pagesize.cpp
core/pagetransition.cpp
core/rotationjob.cpp
core/scripter.cpp
core/sound.cpp
core/sourcereference.cpp
core/textdocumentgenerator.cpp
core/textdocumentsettings.cpp
core/textpage.cpp
core/tilesmanager.cpp
core/utils.cpp
core/view.cpp
core/fileprinter.cpp
core/script/executor_kjs.cpp
core/script/kjs_app.cpp
core/script/kjs_console.cpp
core/script/kjs_data.cpp
core/script/kjs_document.cpp
core/script/kjs_fullscreen.cpp
core/script/kjs_field.cpp
core/script/kjs_spell.cpp
core/script/kjs_util.cpp
core/synctex/synctex_parser.c
core/synctex/synctex_parser_utils.c
)
2014-08-13 09:26:37 +00:00
ki18n_wrap_ui(okularcore_SRCS
conf/textdocumentsettings.ui
)
install( FILES
core/action.h
core/annotations.h
core/area.h
core/document.h
core/fontinfo.h
core/form.h
core/generator.h
core/global.h
core/page.h
core/pagesize.h
core/pagetransition.h
core/sound.h
core/sourcereference.h
core/textdocumentgenerator.h
core/textdocumentsettings.h
core/textpage.h
core/tile.h
core/utils.h
core/fileprinter.h
core/observer.h
${CMAKE_CURRENT_BINARY_DIR}/core/version.h
${CMAKE_CURRENT_BINARY_DIR}/core/okularcore_export.h
${CMAKE_CURRENT_BINARY_DIR}/settings_core.h
2015-03-04 06:52:20 +00:00
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/okular/core COMPONENT Devel)
install( FILES
interfaces/configinterface.h
interfaces/guiinterface.h
interfaces/printinterface.h
2012-05-21 21:54:48 +00:00
interfaces/saveinterface.h
interfaces/viewerinterface.h
2015-03-04 06:52:20 +00:00
DESTINATION ${KDE_INSTALL_INCLUDEDIR}/okular/interfaces COMPONENT Devel)
2014-08-13 09:26:37 +00:00
ki18n_wrap_ui(okularcore_SRCS
core/chooseenginewidget.ui
)
2014-08-08 22:07:35 +00:00
kconfig_add_kcfg_files(okularcore_SRCS conf/settings_core.kcfgc )
2014-10-06 06:58:55 +00:00
add_library(okularcore SHARED ${okularcore_SRCS})
generate_export_header(okularcore BASE_NAME okularcore EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/core/okularcore_export.h")
# Special handling for linking okularcore on OSX/Apple
IF(APPLE)
SET(OKULAR_IOKIT "-framework IOKit" CACHE STRING "Apple IOKit framework")
ENDIF(APPLE)
2014-08-09 14:05:30 +00:00
target_link_libraries(okularcore
PRIVATE
2014-08-09 14:05:30 +00:00
${OKULAR_IOKIT}
KF5::Archive
KF5::JS
KF5::JSApi
KF5::KIOCore
KF5::KIOWidgets
KF5::I18n
2014-08-09 14:05:30 +00:00
KF5::ThreadWeaver
KF5::Wallet
KF5::Bookmarks
2014-08-09 14:05:30 +00:00
Phonon::phonon4qt5
${MATH_LIB}
${ZLIB_LIBRARIES}
PUBLIC # these are included from the installed headers
KF5::CoreAddons
KF5::XmlGui
KF5::ConfigGui
Qt5::PrintSupport
Qt5::Widgets
2014-08-09 14:05:30 +00:00
)
set_target_properties(okularcore PROPERTIES VERSION 7.0.0 SOVERSION 7 OUTPUT_NAME Okular5Core EXPORT_NAME Core)
install(TARGETS okularcore EXPORT Okular5Targets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
2015-03-04 06:52:20 +00:00
install(FILES conf/okular.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES conf/okular_core.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES core/okularGenerator.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR})
# okularpart
set(okularpart_conf_SRCS
conf/preferencesdialog.cpp
conf/dlgaccessibility.cpp
conf/dlgdebug.cpp
conf/dlgeditor.cpp
conf/dlggeneral.cpp
conf/dlgannotations.cpp
conf/dlgperformance.cpp
conf/dlgpresentation.cpp
conf/editannottooldialog.cpp
conf/editdrawingtooldialog.cpp
conf/widgetannottools.cpp
conf/widgetconfigurationtoolsbase.cpp
conf/widgetdrawingtools.cpp
)
set(okularpart_SRCS
${okularpart_conf_SRCS}
part.cpp
extensions.cpp
ui/embeddedfilesdialog.cpp
ui/annotwindow.cpp
ui/annotationmodel.cpp
ui/annotationpopup.cpp
ui/annotationpropertiesdialog.cpp
ui/annotationproxymodels.cpp
ui/annotationtools.cpp
ui/annotationwidgets.cpp
ui/bookmarklist.cpp
2014-09-11 17:36:01 +00:00
ui/debug_ui.cpp
ui/drawingtoolactions.cpp
ui/fileprinterpreview.cpp
ui/findbar.cpp
ui/formwidgets.cpp
ui/guiutils.cpp
ui/ktreeviewsearchline.cpp
2011-09-22 17:09:26 +00:00
ui/latexrenderer.cpp
ui/minibar.cpp
ui/okmenutitle.cpp
ui/pageitemdelegate.cpp
ui/pagepainter.cpp
ui/pagesizelabel.cpp
ui/pageviewannotator.cpp
Add annotation resize functionality Usage: If you left-click an annotation, it gets selected. Resize handles appear on the selection rectangle. When cursor is moved over one of the 8 resize handles on the corners/edges, the cursor shape changes to indicate resize mode. Everywhere else on the annotation means "move", just as it was before resize feature was added. Pressing ESC or clicking an area outside the annotation cancels a selection. Pressing Del deletes a selected annotation. Feature is only applicable for annotation types AText, AStamp and AGeom. Implementation: It works by eventually changing AnnotationPrivate::m_boundary and notifying generator (i.e. poppler) about that change. Annotation state handling is shifted out of PageView into a new class MouseAnnotation (ui/pageviewmouseannotation.cpp). Some functionality not related to resizing but to annotation interaction in general is also shifted to class MouseAnnotation, to build a single place of responsiblity. Other changes: Add method Document::adjustPageAnnotation, backed by a QUndoCommand. class Okular::AdjustAnnotationCommand. Add Annotation::adjust and Annotation::canBeResized methods. Draw resize handles in PagePainter::paintCroppedPageOnPainter. Resize and move work -for types AText, AStamp and AGeom -on all pages of document -when viewport position changes -when zoom level changes -for all page rotations (0°, 90°, 180°, 270°) Selection is canceled -when currently selected annotation is deleted -on mouse click outside of currently selected annotation -ESC is pressed Viewport is shifted when mouse cursor during move/resize comes close to viewport border. Resize to negative is prevented. Tiny annotations are still selectable. If mouse is moved over an annotation type that we can focus, and the annotation is not yet focused, mouse cursor shape changes to arrow. If mouse cursor rests over an annotation A, while annotation B is focused, a tooltip for annotation A is shown. Selected Annotation is deleted when Del is pressed. Test for regressions: -Annotation interaction (focus, move, resize, start playback, ...) are only done in mode EnumMouseMode::Browse. -If mouse is moved over an annotation type where we can start an action, mouse cursor shape changes to pointing hand. -If mouse is moved over an annotation type that we can't interact with, mouse cursor shape stays a open hand. -If mouse cursor rests over an annotation of any type, a tooltip for that annotation is shown. -Grab/move scroll area (on left click + mouse move) is prevented, if mouse is over focused annotation, or over AMovie/AScreen/AFileAttachment annotation. -A double click on a annotation starts the "annotator". REVIEW: 127366 BUG: 177778 BUG: 314843 BUG: 358060
2017-03-19 22:16:06 +00:00
ui/pageviewmouseannotation.cpp
ui/pageview.cpp
2014-02-24 22:42:10 +00:00
ui/magnifierview.cpp
ui/pageviewutils.cpp
ui/presentationsearchbar.cpp
ui/presentationwidget.cpp
ui/propertiesdialog.cpp
ui/searchlineedit.cpp
ui/searchwidget.cpp
ui/sidebar.cpp
ui/side_reviews.cpp
ui/snapshottaker.cpp
ui/thumbnaillist.cpp
ui/toc.cpp
ui/tocmodel.cpp
ui/toolaction.cpp
ui/videowidget.cpp
2015-05-27 13:56:56 +00:00
ui/layers.cpp
)
if (Qt5TextToSpeech_FOUND)
set(okularpart_SRCS ${okularpart_SRCS}
ui/tts.cpp)
endif()
2014-08-13 09:26:37 +00:00
ki18n_wrap_ui(okularpart_SRCS
conf/dlgaccessibilitybase.ui
conf/dlgeditorbase.ui
conf/dlggeneralbase.ui
conf/dlgannotationsbase.ui
conf/dlgperformancebase.ui
conf/dlgpresentationbase.ui
)
2014-08-08 22:07:35 +00:00
kconfig_add_kcfg_files(okularpart_SRCS conf/settings.kcfgc )
add_library(okularpart SHARED ${okularpart_SRCS})
generate_export_header(okularpart BASE_NAME okularpart)
2016-07-11 17:40:49 +00:00
target_link_libraries(okularpart okularcore
${MATH_LIB}
Qt5::Svg
Phonon::phonon4qt5
KF5::Archive
KF5::Bookmarks
2016-07-21 19:53:54 +00:00
KF5::I18n
2016-07-11 17:40:49 +00:00
KF5::IconThemes
2016-07-17 00:28:57 +00:00
KF5::ItemViews
KF5::KIOCore
KF5::KIOFileWidgets
KF5::KIOWidgets
KF5::KIONTLM
2016-07-11 17:40:49 +00:00
KF5::Parts
KF5::Solid
KF5::Wallet
KF5::WindowSystem
)
set_target_properties(okularpart PROPERTIES PREFIX "")
if (Qt5TextToSpeech_FOUND)
target_link_libraries(okularpart Qt5::TextToSpeech)
endif()
2015-03-04 06:52:20 +00:00
install(TARGETS okularpart DESTINATION ${KDE_INSTALL_PLUGINDIR})
########### install files ###############
2015-03-04 06:52:20 +00:00
install(FILES okular.upd DESTINATION ${KDE_INSTALL_DATADIR}/kconf_update)
2015-03-04 06:52:20 +00:00
install( FILES okular_part.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
install( FILES part.rc part-viewermode.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/okular )
install( FILES okular.categories DESTINATION ${KDE_INSTALL_CONFDIR} )
########### cmake files #################
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Okular5")
ecm_configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/Okular5Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/Okular5Config.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
PATH_VARS INCLUDE_INSTALL_DIR CMAKE_INSTALL_PREFIX
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/Okular5Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/Okular5ConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT Okular5Targets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE Okular5Targets.cmake NAMESPACE Okular::)
########### summary #################
2014-08-06 20:51:03 +00:00
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)