1 | #########################quick start############################################
|
---|
2 | # cmake ../ -G "CodeBlocks - Unix Makefiles"
|
---|
3 | # make
|
---|
4 | # make install
|
---|
5 | # make clean
|
---|
6 | # sudo apt-get install libopencv-dev
|
---|
7 | ################################################################################
|
---|
8 | project(OpencvVideo)
|
---|
9 | set(${PROJECT_NAME}_VERSION_MAJOR 0)
|
---|
10 | set(${PROJECT_NAME}_VERSION_MINOR 1)
|
---|
11 | # Create a DLL
|
---|
12 | add_definitions(-DCVWEBCAM_COMPONENT_EXPORTS)
|
---|
13 | add_definitions( -DVIDEO_EXPORTS )
|
---|
14 |
|
---|
15 | #include(FindOpenCV.cmake)
|
---|
16 | find_package(OpenCV REQUIRED)
|
---|
17 |
|
---|
18 | # Check for OpenCV
|
---|
19 | if(NOT OpenCV_FOUND)
|
---|
20 | message(FATAL_ERROR "Project ${PROJECT_NAME} requires OpenCV library")
|
---|
21 | endif()
|
---|
22 | ################################################################################
|
---|
23 | create_export(EXPORT_HDR ${PROJECT_NAME})
|
---|
24 | pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
|
---|
25 | add_definitions (${QT_DEFINITIONS})
|
---|
26 | find_package(Qt5Network REQUIRED)
|
---|
27 | ################################################################################
|
---|
28 | # DIRECTORIES
|
---|
29 | include_directories(
|
---|
30 | ${PROJECT_BINARY_DIR}
|
---|
31 | ${QT_INCLUDE_DIR}
|
---|
32 | ${PACPUS_INCLUDE_DIR}
|
---|
33 | ${PACPUS_INCLUDE_DIR}/Pacpus/
|
---|
34 | )
|
---|
35 |
|
---|
36 | # ========================================
|
---|
37 | # Link directories
|
---|
38 | # ========================================
|
---|
39 | link_directories(
|
---|
40 | ${PACPUS_LIB_DIR}
|
---|
41 | )
|
---|
42 |
|
---|
43 |
|
---|
44 | ################################################################################
|
---|
45 | # FILES
|
---|
46 | set(PROJECT_HDRS
|
---|
47 | ${EXPORT_HDR}
|
---|
48 | CVWebcamComponent.hpp
|
---|
49 | WebcamWorker.hpp
|
---|
50 | )
|
---|
51 | set(PROJECT_SRCS
|
---|
52 | ${PLUGIN_CPP}
|
---|
53 | )
|
---|
54 |
|
---|
55 | if(OpenCV_FOUND)
|
---|
56 | list(APPEND PROJECT_SRCS CVWebcamComponent.cpp WebcamWorker.cpp)
|
---|
57 | endif()
|
---|
58 |
|
---|
59 | set(FILES_TO_MOC
|
---|
60 | ${PLUGIN_HDR}
|
---|
61 | CVWebcamComponent.hpp
|
---|
62 | WebcamWorker.hpp
|
---|
63 | )
|
---|
64 |
|
---|
65 | set(UI_FILES
|
---|
66 | )
|
---|
67 |
|
---|
68 | ################################################################################
|
---|
69 | # Qt: call moc, uic
|
---|
70 | qt_wrap_cpp(PROJECT_MOC_SRCS
|
---|
71 | ${FILES_TO_MOC}
|
---|
72 | )
|
---|
73 |
|
---|
74 | qt_wrap_ui(PROJECT_UI_SRCS
|
---|
75 | ${UI_FILES}
|
---|
76 | )
|
---|
77 |
|
---|
78 | ################################################################################
|
---|
79 | # BUILD and LINK
|
---|
80 | pacpus_add_library(${PROJECT_NAME} SHARED
|
---|
81 | ${PROJECT_HDRS}
|
---|
82 | ${PROJECT_SRCS}
|
---|
83 | ${PROJECT_MOC_SRCS}
|
---|
84 | ${PROJECT_UI_SRCS}
|
---|
85 | )
|
---|
86 |
|
---|
87 |
|
---|
88 | # ========================================
|
---|
89 | # Libraries
|
---|
90 | # ========================================
|
---|
91 | set(LIBS
|
---|
92 | optimized FileLib debug FileLib_d
|
---|
93 | optimized PacpusLib debug PacpusLib_d
|
---|
94 | optimized PacpusTools debug PacpusTools_d
|
---|
95 | )
|
---|
96 | if (WIN32)
|
---|
97 | list(APPEND LIBS
|
---|
98 | optimized ROAD_TIME debug ROAD_TIME_d
|
---|
99 | )
|
---|
100 | endif()
|
---|
101 | # LINK
|
---|
102 | target_link_libraries(${PROJECT_NAME}
|
---|
103 | ${PACPUS_LIBRARIES}
|
---|
104 | ${PACPUS_DEPENDENCIES_LIB}
|
---|
105 | ${LIBS}
|
---|
106 | ${QT_LIBRARIES}
|
---|
107 | ${OpenCV_LIBS}
|
---|
108 | )
|
---|
109 | qt5_use_modules(${PROJECT_NAME} Network)
|
---|
110 | ################################################################################
|
---|
111 | # FOLDERS
|
---|
112 | pacpus_folder(${PROJECT_NAME} "components")
|
---|
113 | ################################################################################
|
---|
114 | # INSTALL
|
---|
115 | pacpus_install(${PROJECT_NAME})
|
---|