Home | History | Annotate | Download | only in highgui
      1 if (WINRT)
      2   ocv_module_disable(highgui)
      3 endif()
      4 
      5 set(the_description "High-level GUI and Media I/O")
      6 ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio WRAP python)
      7 
      8 # ----------------------------------------------------------------------------
      9 #  CMake file for highgui. See root CMakeLists.txt
     10 #   Some parts taken from version of Hartmut Seichter, HIT Lab NZ.
     11 #   Jose Luis Blanco, 2008
     12 # ----------------------------------------------------------------------------
     13 
     14 # Compilation with /ZW is not allowed for *.c files
     15 if(HAVE_WINRT_CX AND NOT WINRT)
     16   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
     17 endif()
     18 
     19 if(APPLE)
     20   ocv_include_directories(${ZLIB_INCLUDE_DIRS})
     21   list(APPEND HIGHGUI_LIBRARIES ${ZLIB_LIBRARIES})
     22 endif()
     23 
     24 set(highgui_hdrs
     25     ${CMAKE_CURRENT_LIST_DIR}/src/precomp.hpp
     26     )
     27 
     28 set(highgui_srcs
     29     ${CMAKE_CURRENT_LIST_DIR}/src/window.cpp
     30     )
     31 
     32 file(GLOB highgui_ext_hdrs
     33      "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/*.hpp"
     34      "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.hpp"
     35      "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.h")
     36 
     37 if(HAVE_QT5)
     38   set(CMAKE_AUTOMOC ON)
     39   set(CMAKE_INCLUDE_CURRENT_DIR ON)
     40 
     41   QT5_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
     42   list(APPEND highgui_srcs
     43        ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.cpp
     44        ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h
     45        ${_RCC_OUTFILES})
     46 
     47   foreach(dt5_dep Core Gui Widgets Test Concurrent)
     48     add_definitions(${Qt5${dt5_dep}_DEFINITIONS})
     49     include_directories(${Qt5${dt5_dep}_INCLUDE_DIRS})
     50     list(APPEND HIGHGUI_LIBRARIES ${Qt5${dt5_dep}_LIBRARIES})
     51   endforeach()
     52 
     53   if(HAVE_QT_OPENGL)
     54     add_definitions(${Qt5OpenGL_DEFINITIONS})
     55     include_directories(${Qt5OpenGL_INCLUDE_DIRS})
     56     list(APPEND HIGHGUI_LIBRARIES ${Qt5OpenGL_LIBRARIES})
     57   endif()
     58 
     59 elseif(HAVE_QT)
     60   if (HAVE_QT_OPENGL)
     61     set(QT_USE_QTOPENGL TRUE)
     62   endif()
     63   include(${QT_USE_FILE})
     64 
     65   QT4_ADD_RESOURCES(_RCC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.qrc)
     66   QT4_WRAP_CPP(_MOC_OUTFILES ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.h)
     67 
     68   list(APPEND HIGHGUI_LIBRARIES ${QT_LIBRARIES})
     69   list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES})
     70   ocv_check_flag_support(CXX -Wno-missing-declarations _have_flag)
     71   if(${_have_flag})
     72     set_source_files_properties(${_RCC_OUTFILES} PROPERTIES COMPILE_FLAGS -Wno-missing-declarations)
     73   endif()
     74 elseif(HAVE_WIN32UI)
     75   list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_w32.cpp)
     76 elseif(HAVE_GTK OR HAVE_GTK3)
     77   list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_gtk.cpp)
     78 elseif(HAVE_CARBON)
     79   list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_carbon.cpp)
     80   list(APPEND HIGHGUI_LIBRARIES "-framework Carbon" "-framework QuickTime")
     81 elseif(HAVE_COCOA)
     82   list(APPEND highgui_srcs ${CMAKE_CURRENT_LIST_DIR}/src/window_cocoa.mm)
     83   list(APPEND HIGHGUI_LIBRARIES "-framework Cocoa")
     84 endif()
     85 
     86 if(UNIX)
     87   #these variables are set by CHECK_MODULE macro
     88   foreach(P ${HIGHGUI_INCLUDE_DIRS})
     89     ocv_include_directories(${P})
     90   endforeach()
     91 
     92   foreach(P ${HIGHGUI_LIBRARY_DIRS})
     93     link_directories(${P})
     94   endforeach()
     95 endif()
     96 
     97 source_group("Src" FILES ${highgui_srcs} ${highgui_hdrs})
     98 source_group("Include" FILES ${highgui_ext_hdrs})
     99 ocv_set_module_sources(HEADERS ${highgui_ext_hdrs} SOURCES ${highgui_srcs} ${highgui_hdrs})
    100 ocv_module_include_directories()
    101 
    102 ocv_create_module(${HIGHGUI_LIBRARIES})
    103 
    104 macro(ocv_highgui_configure_target)
    105 if(APPLE)
    106   add_apple_compiler_options(the_module)
    107 endif()
    108 
    109 if(BUILD_SHARED_LIBS)
    110   add_definitions(-DHIGHGUI_EXPORTS)
    111 endif()
    112 
    113 if(MSVC)
    114   set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG")
    115 endif()
    116 
    117 if(NOT BUILD_opencv_world)
    118   #stop automatic dependencies propagation for this module
    119   set_target_properties(${the_module} PROPERTIES LINK_INTERFACE_LIBRARIES "")
    120 endif()
    121 
    122 ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations)
    123 endmacro()
    124 
    125 if(NOT BUILD_opencv_world)
    126   ocv_highgui_configure_target()
    127 endif()
    128 
    129 ocv_add_accuracy_tests()
    130 ocv_add_perf_tests()
    131