opencl works
[profile/ivi/automotive-message-broker.git] / plugins / opencvlux / CMakeLists.txt
index e243cf1..f7ef01c 100644 (file)
@@ -1,28 +1,60 @@
 if(opencvlux_plugin)
 
-FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui REQUIRED)
-include(${QT_USE_FILE})
-ADD_DEFINITIONS(${QT_DEFINITIONS})
+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)
 
-include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${OpenCV_INCLUDE_DIRS})
+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)
+else(ocl)
+  message(STATUS "no opencl support")
+endif(ocl)
+
+option(cuda "enable cuda" OFF)
+
+if(cuda)
+  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")
+  remove_definitions(-DCUDA)
+endif(cuda)
+
+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)
 
-QT4_WRAP_CPP(opencvluxplugin_headers_moc ${opencvluxplugin_headers})
-
-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} ${QT_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/automotive-message-broker)
+install(TARGETS opencvluxplugin LIBRARY DESTINATION ${PLUGIN_INSTALL_PATH})
 
 endif(opencvlux_plugin)