Changeset 99 in pacpussensors for trunk/OpencvVideo


Ignore:
Timestamp:
Oct 15, 2015, 2:47:01 PM (9 years ago)
Author:
nguyenhu
Message:

compilation under linux with 0.2.X framework

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/OpencvVideo/CMakeLists.txt

    r60 r99  
     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################################################################################
    18project(OpencvVideo)
    2 ################################################################################
    3 
     9set(${PROJECT_NAME}_VERSION_MAJOR 0)
     10set(${PROJECT_NAME}_VERSION_MINOR 1)
    411# Create a DLL
    512add_definitions(-DCVWEBCAM_COMPONENT_EXPORTS)
    613add_definitions( -DVIDEO_EXPORTS )
    714
     15#include(FindOpenCV.cmake)
    816find_package(OpenCV REQUIRED)
    917
     
    1220    message(FATAL_ERROR "Project ${PROJECT_NAME} requires OpenCV library")
    1321endif()
    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}
     22################################################################################
     23create_export(EXPORT_HDR ${PROJECT_NAME})
     24pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     25add_definitions (${QT_DEFINITIONS})
     26find_package(Qt5Network REQUIRED)
     27################################################################################
     28# DIRECTORIES
     29include_directories(
     30    ${PROJECT_BINARY_DIR}
     31    ${QT_INCLUDE_DIR}
     32    ${PACPUS_INCLUDE_DIR}
     33    ${PACPUS_INCLUDE_DIR}/Pacpus/
    3934)
    4035
     
    4237# Link directories
    4338# ========================================
    44 link_directories( ${PACPUS_LIB_DIR} )
     39link_directories(
     40        ${PACPUS_LIB_DIR}
     41)
    4542
    46 message (STATUS ${PACPUS_LIB_DIR})
    4743
    48 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
     44################################################################################
     45# FILES
     46set(PROJECT_HDRS
     47    ${EXPORT_HDR}
     48    CVWebcamComponent.hpp
     49    WebcamWorker.hpp
     50)
     51set(PROJECT_SRCS
     52    ${PLUGIN_CPP}
     53)
    4954
    50 # ========================================
    51 # List of sources
    52 # ========================================
    53 if (UNIX)
    54         set(
    55                 PROJECT_SRCS
    56                 ${PLUGIN_CPP}
    57         )
     55if(OpenCV_FOUND)
     56    list(APPEND PROJECT_SRCS CVWebcamComponent.cpp WebcamWorker.cpp)
    5857endif()
    5958
    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
     59set(FILES_TO_MOC
     60    ${PLUGIN_HDR}
     61    CVWebcamComponent.hpp
     62    WebcamWorker.hpp
    7963)
    8064
    81 set(
    82     UI_FILES
    83 
     65set(UI_FILES
    8466)
    8567
    86 # ========================================
    87 # Call MOC
    88 # ========================================
    89 qt4_wrap_cpp(
    90     PROJECT_MOC_SRCS
     68################################################################################
     69# Qt: call moc, uic
     70qt_wrap_cpp(PROJECT_MOC_SRCS
    9171    ${FILES_TO_MOC}
    9272)
    9373
    94 qt4_wrap_ui(
    95     PROJECT_UI_SRCS
     74qt_wrap_ui(PROJECT_UI_SRCS
    9675    ${UI_FILES}
    9776)
    9877
    99 # ========================================
    100 # Build a library
    101 # ========================================
    102 pacpus_add_library(
    103     ${PROJECT_NAME} SHARED
     78################################################################################
     79# BUILD and LINK
     80pacpus_add_library(${PROJECT_NAME} SHARED
     81    ${PROJECT_HDRS}
    10482    ${PROJECT_SRCS}
    10583    ${PROJECT_MOC_SRCS}
     
    10785)
    10886
    109 message(STATUS  ${PACPUS_DEPENDENCIES_LIB} )
    11087
    11188# ========================================
    11289# Libraries
    11390# ========================================
    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
     91set(LIBS
     92    optimized FileLib debug FileLib_d
     93    optimized PacpusLib debug PacpusLib_d
     94    optimized PacpusTools debug PacpusTools_d
    12295)
    123 
    124 # ========================================
    125 # Install
    126 # ========================================
    127 pacpus_install(${PROJECT_NAME})
    128 
     96if (WIN32)
     97    list(APPEND LIBS
     98        optimized ROAD_TIME debug ROAD_TIME_d
     99    )
     100endif()
     101# LINK
     102target_link_libraries(${PROJECT_NAME}
     103                      ${PACPUS_LIBRARIES}
     104                      ${PACPUS_DEPENDENCIES_LIB}
     105                      ${LIBS}
     106                      ${QT_LIBRARIES}
     107                      ${OpenCV_LIBS}
     108                     )
     109qt5_use_modules(${PROJECT_NAME} Network)
     110################################################################################
     111# FOLDERS
     112pacpus_folder(${PROJECT_NAME} "components")
     113################################################################################
     114# INSTALL
     115pacpus_install(${PROJECT_NAME})
Note: See TracChangeset for help on using the changeset viewer.