Skip to content

Commit

Permalink
Add boost.compute
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslo committed Feb 9, 2016
1 parent 20d3ba2 commit 8052c9c
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/configs/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ hunter_config(Async++ VERSION 0.0.3-hunter)
hunter_config(Avahi VERSION 0.6.31)
hunter_config(BZip2 VERSION 1.0.6-p1)
hunter_config(Boost VERSION 1.58.0-p1)
hunter_config(BoostCompute VERSION 0.5-p0)
hunter_config(CLAPACK VERSION 3.2.1)
hunter_config(Clang VERSION 3.6.2)
hunter_config(ClangToolsExtra VERSION ${HUNTER_Clang_VERSION})
Expand Down
28 changes: 28 additions & 0 deletions cmake/projects/BoostCompute/hunter.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (c) 2016, Ruslan Baratov
# All rights reserved.

if(DEFINED HUNTER_CMAKE_PROJECTS_BOOSTCOMPUTE_CMAKE_)
return()
else()
set(HUNTER_CMAKE_PROJECTS_BOOSTCOMPUTE_CMAKE_ 1)
endif()

include(hunter_add_version)
include(hunter_cacheable)
include(hunter_download)
include(hunter_pick_scheme)

hunter_add_version(
PACKAGE_NAME
BoostCompute
VERSION
0.5-p0
URL
"https://github.com/hunter-packages/boost-compute/archive/v0.5-p0.tar.gz"
SHA1
f9a54b5210a4a8f1beb8c7bd3e2469a76f975de5
)

hunter_pick_scheme(DEFAULT url_sha1_cmake)
hunter_cacheable(BoostCompute)
hunter_download(PACKAGE_NAME BoostCompute)
19 changes: 19 additions & 0 deletions examples/Boost-compute/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2016, Ruslan Baratov
# All rights reserved.

cmake_minimum_required(VERSION 3.0)

# Emulate HunterGate:
# * https://github.com/hunter-packages/gate
include("../common.cmake")

project(download-boost-compute)

# download boost.compute
hunter_add_package(BoostCompute)

# now boost.compute can be used
find_package(BoostCompute CONFIG REQUIRED)

add_executable(foo foo.cpp)
target_link_libraries(foo BoostCompute::boost_compute)
14 changes: 14 additions & 0 deletions examples/Boost-compute/foo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <iostream> // std::cout
#include <boost/compute/core.hpp>

int main() {
namespace compute = boost::compute;

// get the default device
compute::device device = compute::system::default_device();

// print the device's name
std::cout << "hello from " << device.name() << std::endl;

return EXIT_SUCCESS;
}

0 comments on commit 8052c9c

Please sign in to comment.