opencl works
[profile/ivi/automotive-message-broker.git] / plugins / opencvlux / CMakeLists.txt
index 17ebedb..f7ef01c 100644 (file)
@@ -1,41 +1,60 @@
 if(opencvlux_plugin)
 
+set(qtmainloop "ON")
+
 find_package(OpenCV REQUIRED)
 
 if(OpenCV_LIBS)
-        message(STATUS "opencv found")
+   message(STATUS "opencv found: ${OpenCV_INCLUDE_DIRS}")
 else(OpenCV_LIBS)
-        message(FATAL_ERROR "opencv missing.  please install opencv")
+   message(FATAL_ERROR "opencv missing.  please install opencv")
 endif(OpenCV_LIBS)
 
-#find opencv ocl headers:
-find_path(ocl ocl.hpp PATH_SUFFIXES opencv/ocl opencv2/ocl DOC "opencv ocl headers")
+option(ocl "enable opencl" OFF)
+
+add_definitions(-DCV_DATA="${OpenCV_CONFIG_PATH}")
 
 if(ocl)
-       message(STATUS "found opencv ocl headers. enabling opencl support. ${ocl}")
-       add_definitions(-DOPENCL)
+  message(STATUS "found opencv ocl headers. enabling opencl support. ${ocl}")
+  add_definitions(-DOPENCL)
 else(ocl)
-       message(STATUS "no opencv ocl headers found (ocl.hpp). no opencl support")
+  message(STATUS "no opencl support")
 endif(ocl)
 
-find_path(cuda gpu.hpp PATH_SUFFIXES opencv/gpu opencv2/gpu DOC "opencv cuda headers")
+option(cuda "enable cuda" OFF)
 
 if(cuda)
-       message(STATUS "found opencv cuda headers.  enabling cuda support. ${cuda}")
-       add_definitions(-DCUDA)
+  message(STATUS "found opencv cuda headers.  enabling cuda support. ${cuda}")
+  add_definitions(-DCUDA)
 else(cuda)
-       message(STATUS "no opencv cuda headers found.  no cuda support")
+  message(STATUS "no opencv cuda headers found.  no cuda support")
+  remove_definitions(-DCUDA)
 endif(cuda)
 
-include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${OpenCV_INCLUDE_DIRS})
+find_package(Qt5Core REQUIRED)
+
+if(Qt5Core_FOUND)
+  message(STATUS "using Qt5")
+
+  set(QT_INCLUDE_DIRS ${Qt5Core_INCLUDE_DIRS} )
+  set(QT_LIBRARIES ${Qt5Core_LIBRARIES} )
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
+  message(STATUS "size of void_p: ${CMAKE_SIZEOF_VOID_P}")
+  add_definitions(${Qt5Core_DEFINITIONS})
+  add_definitions(-DQT_NO_KEYWORDS)
+
+endif(Qt5Core_FOUND)
+set(CMAKE_AUTOMOC ON)
+
+include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${OpenCV_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${QT_INCLUDE_DIRS})
 
 set(opencvluxplugin_headers opencvluxplugin.h)
 set(opencvluxplugin_sources opencvluxplugin.cpp)
 
-add_library(opencvluxplugin MODULE ${opencvluxplugin_sources} ${opencvluxplugin_headers_moc})
+add_library(opencvluxplugin MODULE ${opencvluxplugin_sources})
 set_target_properties(opencvluxplugin PROPERTIES PREFIX "")
-target_link_libraries(opencvluxplugin amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries} ${OpenCV_LIBS})
+target_link_libraries(opencvluxplugin amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries} ${OpenCV_LIBS} ${Boost_LIBRARIES} ${QT_LIBRARIES})
 
-install(TARGETS opencvluxplugin LIBRARY DESTINATION lib${LIB_SUFFIX}/automotive-message-broker)
+install(TARGETS opencvluxplugin LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
 
 endif(opencvlux_plugin)