1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
unset(_HDRS)
unset(_UIS)
unset(_SRCS)
unset(_RSCS)
unset(PLUGIN)
set( PLUGIN imagepreviewplugin )
project(${PLUGIN})
cmake_minimum_required(VERSION 3.1.0)
set( CMAKE_AUTOMOC TRUE )
IF( NOT WIN32 )
set( LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
set( PLUGINS_PATH "lib${LIB_SUFFIX}/psi-plus/plugins" CACHE STRING "Install suffix for plugins" )
ELSE()
set( PLUGINS_PATH "psi-plus/plugins" CACHE STRING "Install suffix for plugins" )
ENDIF()
option( USE_WEBENGINE "Use WebEngine support instead of Webkit" OFF )
find_package( Qt5 COMPONENTS Core REQUIRED )
if(${Qt5Core_VERSION} VERSION_GREATER 5.6.0)
find_package( Qt5 COMPONENTS WebEngine QUIET )
if( Qt5WebEngine_FOUND )
set(USE_WEBENGINE ON)
add_definitions(
-DWEBENGINE=1
-DHAVE_WEBENGINE
)
else()
set(USE_WEBENGINE OFF)
add_definitions(
-DHAVE_WEBKIT
)
endif()
endif()
add_definitions( -DQT_PLUGIN -DHAVE_QT5 )
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
../../include
.
)
set( _SRCS
${PLUGIN}.cpp
ScrollKeeper.cpp
)
set( _HDRS
ScrollKeeper.h
)
set( _RSCS
${PLUGIN}.qrc
)
add_definitions(-DHAVE_QT5)
find_package(Qt5 COMPONENTS Widgets Xml Network REQUIRED)
set(QT_DEPLIBS
Qt5::Widgets
Qt5::Xml
Qt5::Network
)
if( USE_WEBENGINE )
find_package(Qt5 COMPONENTS WebEngine WebEngineWidgets REQUIRED)
list(APPEND QT_DEPLIBS
Qt5::WebEngine
Qt5::WebEngineWidgets
)
else()
find_package(Qt5 COMPONENTS WebKit WebKitWidgets REQUIRED)
list(APPEND QT_DEPLIBS
Qt5::WebKit
Qt5::WebKitWidgets
)
endif()
qt5_wrap_ui(UIS ${_UIS})
qt5_add_resources(RSCS ${_RSCS})
add_library(
${PLUGIN}
MODULE
${_SRCS}
${RSCS}
)
target_link_libraries(
${PLUGIN}
${QT_DEPLIBS}
)
if( UNIX AND NOT( APPLE OR CYGWIN ) )
install(
TARGETS
${PLUGIN}
LIBRARY
DESTINATION
${CMAKE_INSTALL_PREFIX}/${PLUGINS_PATH}
RUNTIME DESTINATION
${CMAKE_INSTALL_PREFIX}/${PLUGINS_PATH}
)
endif()
if( WIN32 )
install(
TARGETS
${PLUGIN}
LIBRARY
DESTINATION
${CMAKE_INSTALL_PREFIX}/${PLUGINS_PATH}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/${PLUGINS_PATH}
)
endif()
|