~mutse-young/ubuntu-docviewer-app/trunk

« back to all changes in this revision

Viewing changes to src/plugin/poppler-qml-plugin/CMakeLists.txt

  • Committer: David Planella
  • Date: 2014-10-28 22:01:16 UTC
  • mfrom: (31.2.8 add-poppler-plugin)
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: david.planella@ubuntu.com-20141028220116-bryaeq3if69o6r6o
Merged branch to add Poppler plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
cmake_minimum_required(VERSION 2.8.9)
 
2
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 
3
 
 
4
set(PLUGIN_DIR org/ubuntu/popplerqmlplugin)
 
5
 
 
6
#set cpp flags
 
7
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra -fPIC")
 
8
 
 
9
# Standard install paths
 
10
include(GNUInstallDirs)
 
11
 
 
12
#add the sources to compile
 
13
set(popplerqmlplugin_SRCS
 
14
        plugin.cpp
 
15
        plugin.h
 
16
        pdfModel.cpp
 
17
        pdfModel.h
 
18
        pageImageProvider.cpp
 
19
        pageImageProvider.h
 
20
        pagesWorkerThread.cpp
 
21
        pagesWorkerThread.h
 
22
        pdfPage.cpp
 
23
        pdfPage.h
 
24
        )
 
25
 
 
26
#should be deprecated in current cmake version
 
27
#qt5_use_modules(Qml Quick)
 
28
 
 
29
add_library(popplerqmlplugin MODULE
 
30
    ${popplerqmlplugin_SRCS}
 
31
)
 
32
 
 
33
target_link_libraries(popplerqmlplugin poppler-qt5)
 
34
 
 
35
qt5_use_modules(popplerqmlplugin Gui Qml Quick)
 
36
 
 
37
# Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator
 
38
if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
 
39
    add_custom_command(TARGET popplerqmlplugin POST_BUILD
 
40
        COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
 
41
        COMMENT "Creating plugin directory layout in the build directory"
 
42
        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
 
43
        COMMENT "Copying the qmldir file to the build directory"
 
44
        COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:popplerqmlplugin> ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR}
 
45
        COMMENT "Copying the plugin binary to the build directory"
 
46
    )
 
47
endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
 
48
 
 
49
# Install plugin file
 
50
install(TARGETS popplerqmlplugin DESTINATION ${QT_IMPORTS_DIR}/org/ubuntu/popplerqmlplugin/)
 
51
install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/org/ubuntu/popplerqmlplugin/)