CMakeLists.txt 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # ---------------------------------------------------------------------------
  2. # Copyright (c) 2015 Kyle Lutz <kyle.r.lutz@gmail.com>
  3. #
  4. # Distributed under the Boost Software License, Version 1.0
  5. # See accompanying file LICENSE_1_0.txt or copy at
  6. # http://www.boost.org/LICENSE_1_0.txt
  7. #
  8. # ---------------------------------------------------------------------------
  9. # include local test headers
  10. include_directories(..)
  11. # Check for linkage problems
  12. add_executable(test_multiple_objects
  13. test_multiple_objects1.cpp
  14. test_multiple_objects2.cpp
  15. )
  16. target_link_libraries(test_multiple_objects
  17. ${OPENCL_LIBRARIES}
  18. ${Boost_LIBRARIES}
  19. )
  20. # link with coverage library
  21. if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
  22. target_link_libraries(test_multiple_objects -fprofile-arcs -ftest-coverage)
  23. endif()
  24. add_test("misc.multiple_objects" test_multiple_objects)
  25. # eigen interop tests
  26. if(${BOOST_COMPUTE_HAVE_EIGEN})
  27. find_package(Eigen REQUIRED)
  28. include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
  29. add_compute_test("interop.eigen" test_interop_eigen.cpp)
  30. endif()
  31. # opencv interop tests
  32. if(${BOOST_COMPUTE_HAVE_OPENCV})
  33. find_package(OpenCV REQUIRED)
  34. include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
  35. add_compute_test("interop.opencv" test_interop_opencv.cpp)
  36. target_link_libraries(test_interop_opencv ${OpenCV_LIBS})
  37. endif()
  38. # qt interop tests
  39. if(${BOOST_COMPUTE_HAVE_QT})
  40. # look for Qt4 in the first place
  41. find_package(Qt4 QUIET)
  42. if(${QT4_FOUND})
  43. find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtOpenGL)
  44. include(${QT_USE_FILE})
  45. else()
  46. find_package(Qt5Widgets QUIET)
  47. # look for Qt5
  48. if(${Qt5Widgets_FOUND})
  49. find_package(Qt5Core REQUIRED)
  50. find_package(Qt5Widgets REQUIRED)
  51. find_package(Qt5OpenGL REQUIRED)
  52. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5OpenGL_EXECUTABLE_COMPILE_FLAGS}")
  53. set(QT_LIBRARIES ${Qt5OpenGL_LIBRARIES})
  54. else()
  55. # no valid Qt framework found
  56. message(FATAL_ERROR "Error: Did not find Qt4 or Qt5")
  57. endif()
  58. endif()
  59. add_compute_test("interop.qt" test_interop_qt.cpp)
  60. target_link_libraries(test_interop_qt ${QT_LIBRARIES})
  61. # the opengl interop test depends on qt to create the opengl context
  62. add_compute_test("interop.opengl" test_interop_opengl.cpp)
  63. target_link_libraries(test_interop_opengl ${QT_LIBRARIES})
  64. endif()
  65. # vtk interop tests
  66. if(${BOOST_COMPUTE_HAVE_VTK})
  67. find_package(VTK REQUIRED)
  68. include(${VTK_USE_FILE})
  69. add_compute_test("interop.vtk" test_interop_vtk.cpp)
  70. target_link_libraries(test_interop_vtk ${VTK_LIBRARIES})
  71. endif()