Skip to content

Commit aa15cd6

Browse files
committed
Merge pull request #431 from kylelutz/boost-build
Add Boost.Build support
2 parents d97fbc5 + a1e3366 commit aa15cd6

14 files changed

+118
-75
lines changed

doc/Jamfile.v2

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ import boostbook ;
33
import doxygen ;
44
import modules ;
55

6-
xml compute
7-
:
8-
compute.qbk
9-
:
10-
;
11-
126
doxygen autodoc
137
:
148
../include/boost/compute.hpp
@@ -97,6 +91,8 @@ doxygen autodoc
9791
<xsl:param>"boost.doxygen.reftitle=Header Reference"
9892
;
9993

94+
xml compute : compute.qbk : ;
95+
10096
boostbook standalone
10197
:
10298
compute

test/CMakeLists.txt

+2-69
Original file line numberDiff line numberDiff line change
@@ -196,72 +196,5 @@ add_compute_test("misc.amd_cpp_kernel_language" test_amd_cpp_kernel_language.cpp
196196
add_compute_test("misc.lambda" test_lambda.cpp)
197197
add_compute_test("misc.user_defined_types" test_user_defined_types.cpp)
198198

199-
# Check for linkage problems
200-
add_executable(test_multiple_objects
201-
test_multiple_objects1.cpp
202-
test_multiple_objects2.cpp
203-
)
204-
target_link_libraries(test_multiple_objects
205-
${OPENCL_LIBRARIES}
206-
${Boost_LIBRARIES}
207-
)
208-
# link with coverage library
209-
if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
210-
target_link_libraries(test_multiple_objects -fprofile-arcs -ftest-coverage)
211-
endif()
212-
add_test("misc.multiple_objects" test_multiple_objects)
213-
214-
# eigen interop tests
215-
if(${BOOST_COMPUTE_HAVE_EIGEN})
216-
find_package(Eigen REQUIRED)
217-
include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
218-
add_compute_test("interop.eigen" test_interop_eigen.cpp)
219-
endif()
220-
221-
# opencv interop tests
222-
if(${BOOST_COMPUTE_HAVE_OPENCV})
223-
find_package(OpenCV REQUIRED)
224-
include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
225-
add_compute_test("interop.opencv" test_interop_opencv.cpp)
226-
target_link_libraries(test_interop_opencv ${OpenCV_LIBS})
227-
endif()
228-
229-
# qt interop tests
230-
if(${BOOST_COMPUTE_HAVE_QT})
231-
# look for Qt4 in the first place
232-
find_package(Qt4 QUIET)
233-
234-
if(${QT4_FOUND})
235-
find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtOpenGL)
236-
include(${QT_USE_FILE})
237-
else()
238-
find_package(Qt5Widgets QUIET)
239-
240-
# look for Qt5
241-
if(${Qt5Widgets_FOUND})
242-
find_package(Qt5Core REQUIRED)
243-
find_package(Qt5Widgets REQUIRED)
244-
find_package(Qt5OpenGL REQUIRED)
245-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5OpenGL_EXECUTABLE_COMPILE_FLAGS}")
246-
set(QT_LIBRARIES ${Qt5OpenGL_LIBRARIES})
247-
else()
248-
# no valid Qt framework found
249-
message(FATAL_ERROR "Error: Did not find Qt4 or Qt5")
250-
endif()
251-
endif()
252-
253-
add_compute_test("interop.qt" test_interop_qt.cpp)
254-
target_link_libraries(test_interop_qt ${QT_LIBRARIES})
255-
256-
# the opengl interop test depends on qt to create the opengl context
257-
add_compute_test("interop.opengl" test_interop_opengl.cpp)
258-
target_link_libraries(test_interop_opengl ${QT_LIBRARIES})
259-
endif()
260-
261-
# vtk interop tests
262-
if(${BOOST_COMPUTE_HAVE_VTK})
263-
find_package(VTK REQUIRED)
264-
include(${VTK_USE_FILE})
265-
add_compute_test("interop.vtk" test_interop_vtk.cpp)
266-
target_link_libraries(test_interop_vtk ${VTK_LIBRARIES})
267-
endif()
199+
# extra tests (interop tests, linkage tests, etc.)
200+
add_subdirectory(extra)

test/Jamfile.v2

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# (C) Copyright 2015: Kyle Lutz
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4+
5+
import testing ;
6+
7+
lib boost_unit_test_framework ;
8+
9+
project boost/compute/test
10+
: source-location .
11+
: requirements
12+
<include>.
13+
<include>../include
14+
<define>BOOST_TEST_DYN_LINK
15+
<linkflags>"-lboost_unit_test_framework"
16+
;
17+
18+
rule test_all
19+
{
20+
local all_rules = ;
21+
22+
for local fileb in [ glob *.cpp ]
23+
{
24+
all_rules += [ run $(fileb)
25+
:
26+
:
27+
:
28+
<host-os>linux:<linkflags>"-lOpenCL"
29+
<host-os>darwin:<linkflags>"-framework OpenCL"
30+
] ;
31+
}
32+
33+
return $(all_rules) ;
34+
}
35+
36+
test-suite compute : [ test_all r ] : ;

test/extra/CMakeLists.txt

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# include local test headers
2+
include_directories(..)
3+
4+
# Check for linkage problems
5+
add_executable(test_multiple_objects
6+
test_multiple_objects1.cpp
7+
test_multiple_objects2.cpp
8+
)
9+
target_link_libraries(test_multiple_objects
10+
${OPENCL_LIBRARIES}
11+
${Boost_LIBRARIES}
12+
)
13+
# link with coverage library
14+
if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
15+
target_link_libraries(test_multiple_objects -fprofile-arcs -ftest-coverage)
16+
endif()
17+
add_test("misc.multiple_objects" test_multiple_objects)
18+
19+
# eigen interop tests
20+
if(${BOOST_COMPUTE_HAVE_EIGEN})
21+
find_package(Eigen REQUIRED)
22+
include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
23+
add_compute_test("interop.eigen" test_interop_eigen.cpp)
24+
endif()
25+
26+
# opencv interop tests
27+
if(${BOOST_COMPUTE_HAVE_OPENCV})
28+
find_package(OpenCV REQUIRED)
29+
include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
30+
add_compute_test("interop.opencv" test_interop_opencv.cpp)
31+
target_link_libraries(test_interop_opencv ${OpenCV_LIBS})
32+
endif()
33+
34+
# qt interop tests
35+
if(${BOOST_COMPUTE_HAVE_QT})
36+
# look for Qt4 in the first place
37+
find_package(Qt4 QUIET)
38+
39+
if(${QT4_FOUND})
40+
find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtOpenGL)
41+
include(${QT_USE_FILE})
42+
else()
43+
find_package(Qt5Widgets QUIET)
44+
45+
# look for Qt5
46+
if(${Qt5Widgets_FOUND})
47+
find_package(Qt5Core REQUIRED)
48+
find_package(Qt5Widgets REQUIRED)
49+
find_package(Qt5OpenGL REQUIRED)
50+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5OpenGL_EXECUTABLE_COMPILE_FLAGS}")
51+
set(QT_LIBRARIES ${Qt5OpenGL_LIBRARIES})
52+
else()
53+
# no valid Qt framework found
54+
message(FATAL_ERROR "Error: Did not find Qt4 or Qt5")
55+
endif()
56+
endif()
57+
58+
add_compute_test("interop.qt" test_interop_qt.cpp)
59+
target_link_libraries(test_interop_qt ${QT_LIBRARIES})
60+
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+
66+
# vtk interop tests
67+
if(${BOOST_COMPUTE_HAVE_VTK})
68+
find_package(VTK REQUIRED)
69+
include(${VTK_USE_FILE})
70+
add_compute_test("interop.vtk" test_interop_vtk.cpp)
71+
target_link_libraries(test_interop_vtk ${VTK_LIBRARIES})
72+
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/test_function.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#define BOOST_TEST_MODULE TestFunction
1212
#include <boost/test/unit_test.hpp>
1313

14+
#include <iostream>
15+
1416
#include <boost/compute/system.hpp>
1517
#include <boost/compute/function.hpp>
1618
#include <boost/compute/algorithm/accumulate.hpp>

test/test_local_buffer.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#define BOOST_TEST_MODULE TestLocalBuffer
1212
#include <boost/test/unit_test.hpp>
1313

14+
#include <iostream>
15+
1416
#include <boost/compute/core.hpp>
1517
#include <boost/compute/memory/local_buffer.hpp>
1618
#include <boost/compute/utility/source.hpp>

test/test_user_defined_types.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#define BOOST_TEST_MODULE TestUserDefinedTypes
1212
#include <boost/test/unit_test.hpp>
1313

14+
#include <iostream>
15+
1416
#include <boost/compute/function.hpp>
1517
#include <boost/compute/system.hpp>
1618
#include <boost/compute/algorithm/sort.hpp>

0 commit comments

Comments
 (0)