• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
10# include local test headers
11include_directories(..)
12
13# Check for linkage problems
14add_executable(test_multiple_objects
15    test_multiple_objects1.cpp
16    test_multiple_objects2.cpp
17    )
18target_link_libraries(test_multiple_objects
19    ${OPENCL_LIBRARIES}
20    ${Boost_LIBRARIES}
21    )
22# link with coverage library
23if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
24  target_link_libraries(test_multiple_objects -fprofile-arcs -ftest-coverage)
25endif()
26add_test("misc.multiple_objects" test_multiple_objects)
27
28# eigen interop tests
29if(${BOOST_COMPUTE_HAVE_EIGEN})
30  find_package(Eigen REQUIRED)
31  include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
32  add_compute_test("interop.eigen" test_interop_eigen.cpp)
33endif()
34
35# opencv interop tests
36if(${BOOST_COMPUTE_HAVE_OPENCV})
37  find_package(OpenCV REQUIRED)
38  include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
39  add_compute_test("interop.opencv" test_interop_opencv.cpp)
40  target_link_libraries(test_interop_opencv ${OpenCV_LIBS})
41endif()
42
43# qt interop tests
44if(${BOOST_COMPUTE_HAVE_QT})
45  # look for Qt4 in the first place
46  find_package(Qt4 QUIET)
47
48  if(${QT4_FOUND})
49    find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtOpenGL)
50    include(${QT_USE_FILE})
51  else()
52    find_package(Qt5Widgets QUIET)
53
54    # look for Qt5
55    if(${Qt5Widgets_FOUND})
56      find_package(Qt5Core REQUIRED)
57      find_package(Qt5Widgets REQUIRED)
58      find_package(Qt5OpenGL REQUIRED)
59      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5OpenGL_EXECUTABLE_COMPILE_FLAGS}")
60      set(QT_LIBRARIES ${Qt5OpenGL_LIBRARIES})
61    else()
62      # no valid Qt framework found
63      message(FATAL_ERROR "Error: Did not find Qt4 or Qt5")
64    endif()
65  endif()
66
67  add_compute_test("interop.qt" test_interop_qt.cpp)
68  target_link_libraries(test_interop_qt ${QT_LIBRARIES})
69
70  # the opengl interop test depends on qt to create the opengl context
71  add_compute_test("interop.opengl" test_interop_opengl.cpp)
72  target_link_libraries(test_interop_opengl ${QT_LIBRARIES})
73endif()
74
75# vtk interop tests
76if(${BOOST_COMPUTE_HAVE_VTK})
77  find_package(VTK REQUIRED)
78  include(${VTK_USE_FILE})
79  add_compute_test("interop.vtk" test_interop_vtk.cpp)
80  target_link_libraries(test_interop_vtk ${VTK_LIBRARIES})
81endif()
82