[60] | 1 | project(OpencvVideo)
|
---|
| 2 | ################################################################################
|
---|
| 3 |
|
---|
| 4 | # Create a DLL
|
---|
| 5 | add_definitions(-DCVWEBCAM_COMPONENT_EXPORTS)
|
---|
| 6 | add_definitions( -DVIDEO_EXPORTS )
|
---|
| 7 |
|
---|
| 8 | find_package(OpenCV REQUIRED)
|
---|
| 9 |
|
---|
| 10 | # Check for OpenCV
|
---|
| 11 | if(NOT OpenCV_FOUND)
|
---|
| 12 | message(FATAL_ERROR "Project ${PROJECT_NAME} requires OpenCV library")
|
---|
| 13 | endif()
|
---|
| 14 |
|
---|
| 15 | # ========================================
|
---|
| 16 | # Configure qt4
|
---|
| 17 | # ========================================
|
---|
| 18 | if(QT4_FOUND)
|
---|
| 19 | set(QT_USE_QTXML true)
|
---|
| 20 | set(QT_USE_QTNETWORK true)
|
---|
| 21 | include(${QT_USE_FILE})
|
---|
| 22 | else()
|
---|
| 23 | message(ERROR "Qt4 needed")
|
---|
| 24 | endif()
|
---|
| 25 |
|
---|
| 26 | # ========================================
|
---|
| 27 | # Compiler definitions
|
---|
| 28 | # ========================================
|
---|
| 29 | add_definitions(
|
---|
| 30 | ${QT_DEFINITIONS}
|
---|
| 31 | )
|
---|
| 32 |
|
---|
| 33 | # ========================================
|
---|
| 34 | # Include directories
|
---|
| 35 | # ========================================
|
---|
| 36 | include_directories(
|
---|
| 37 | ${PROJECT_BINARY_DIR}
|
---|
| 38 | ${QT_INCLUDE_DIR}
|
---|
| 39 | )
|
---|
| 40 |
|
---|
| 41 | # ========================================
|
---|
| 42 | # Link directories
|
---|
| 43 | # ========================================
|
---|
| 44 | link_directories( ${PACPUS_LIB_DIR} )
|
---|
| 45 |
|
---|
| 46 | message (STATUS ${PACPUS_LIB_DIR})
|
---|
| 47 |
|
---|
| 48 | pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
|
---|
| 49 |
|
---|
| 50 | # ========================================
|
---|
| 51 | # List of sources
|
---|
| 52 | # ========================================
|
---|
| 53 | if (UNIX)
|
---|
| 54 | set(
|
---|
| 55 | PROJECT_SRCS
|
---|
| 56 | ${PLUGIN_CPP}
|
---|
| 57 | )
|
---|
| 58 | endif()
|
---|
| 59 |
|
---|
| 60 | if(WIN32)
|
---|
| 61 | set(
|
---|
| 62 | PROJECT_SRCS
|
---|
| 63 | ${PLUGIN_CPP}
|
---|
| 64 | )
|
---|
| 65 | if(OpenCV_FOUND)
|
---|
| 66 | list(APPEND PROJECT_SRCS CVWebcamComponent.cpp WebcamWorker.cpp)
|
---|
| 67 | endif()
|
---|
| 68 | endif()
|
---|
| 69 |
|
---|
| 70 |
|
---|
| 71 | # ========================================
|
---|
| 72 | # Files to MOC
|
---|
| 73 | # ========================================
|
---|
| 74 | set(
|
---|
| 75 | FILES_TO_MOC
|
---|
| 76 | ${PLUGIN_H}
|
---|
| 77 | CVWebcamComponent.hpp
|
---|
| 78 | WebcamWorker.hpp
|
---|
| 79 | )
|
---|
| 80 |
|
---|
| 81 | set(
|
---|
| 82 | UI_FILES
|
---|
| 83 |
|
---|
| 84 | )
|
---|
| 85 |
|
---|
| 86 | # ========================================
|
---|
| 87 | # Call MOC
|
---|
| 88 | # ========================================
|
---|
| 89 | qt4_wrap_cpp(
|
---|
| 90 | PROJECT_MOC_SRCS
|
---|
| 91 | ${FILES_TO_MOC}
|
---|
| 92 | )
|
---|
| 93 |
|
---|
| 94 | qt4_wrap_ui(
|
---|
| 95 | PROJECT_UI_SRCS
|
---|
| 96 | ${UI_FILES}
|
---|
| 97 | )
|
---|
| 98 |
|
---|
| 99 | # ========================================
|
---|
| 100 | # Build a library
|
---|
| 101 | # ========================================
|
---|
| 102 | pacpus_add_library(
|
---|
| 103 | ${PROJECT_NAME} SHARED
|
---|
| 104 | ${PROJECT_SRCS}
|
---|
| 105 | ${PROJECT_MOC_SRCS}
|
---|
| 106 | ${PROJECT_UI_SRCS}
|
---|
| 107 | )
|
---|
| 108 |
|
---|
| 109 | message(STATUS ${PACPUS_DEPENDENCIES_LIB} )
|
---|
| 110 |
|
---|
| 111 | # ========================================
|
---|
| 112 | # Libraries
|
---|
| 113 | # ========================================
|
---|
| 114 | # All the platform
|
---|
| 115 | target_link_libraries(
|
---|
| 116 | ${PROJECT_NAME}
|
---|
| 117 | ${PACPUS_LIBRARIES}
|
---|
| 118 | ${QT_LIBRARIES}
|
---|
| 119 | ${PACPUS_DEPENDENCIES_LIB}
|
---|
| 120 | ${OpenCV_LIBS}
|
---|
| 121 | PacpusTools
|
---|
| 122 | )
|
---|
| 123 |
|
---|
| 124 | # ========================================
|
---|
| 125 | # Install
|
---|
| 126 | # ========================================
|
---|
| 127 | pacpus_install(${PROJECT_NAME})
|
---|
| 128 |
|
---|