Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/configs/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ hunter_default_version(odb-mysql VERSION 2.4.0)
hunter_default_version(odb-pgsql VERSION 2.4.0)
hunter_default_version(odb-sqlite VERSION 2.4.0)
hunter_default_version(ogles_gpgpu VERSION 0.3.6)
hunter_default_version(oneTBB VERSION 2021.5.0)
hunter_default_version(oniguruma VERSION 6.8.1-p0)
hunter_default_version(onmt VERSION 0.4.1-p2)
hunter_default_version(openddlparser VERSION 0.1.0-p2)
Expand Down
32 changes: 32 additions & 0 deletions cmake/projects/oneTBB/hunter.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) 2022, Raffael Casagrande
# All rights reserved.

# !!! DO NOT PLACE HEADER GUARDS HERE !!!

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

hunter_add_version(
PACKAGE_NAME
oneTBB
VERSION
2021.5.0
URL
"https://github.com/oneapi-src/oneTBB/archive/v2021.5.0.tar.gz"
SHA1
71750727bd1436f4047342d0adb827c25d7bc2b0
)

hunter_cmake_args(
oneTBB
CMAKE_ARGS
TBB_TEST=OFF
TBB_STRICT=OFF
)

hunter_pick_scheme(DEFAULT url_sha1_cmake)
hunter_cacheable(oneTBB)
hunter_download(PACKAGE_NAME oneTBB)
20 changes: 20 additions & 0 deletions docs/packages/pkg/oneTBB.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. spelling::

oneTBB

.. index::
single: concurrency ; oneTBB

.. _pkg.oneTBB:

oneTBB
======

- `Official <https://github.com/oneapi-src/oneTBB>`__
- `Example <https://github.com/cpp-pm/hunter/blob/master/examples/oneTBB/CMakeLists.txt>`__
- Added by `craffael <https://github.com/craffael>`__ (`pr-600 <https://github.com/cpp-pm/hunter/pull/600>`__)

.. literalinclude:: /../examples/oneTBB/CMakeLists.txt
:language: cmake
:start-after: # DOCUMENTATION_START {
:end-before: # DOCUMENTATION_END }
19 changes: 19 additions & 0 deletions examples/oneTBB/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2022, Raffael Casagrande
# All rights reserved.

cmake_minimum_required(VERSION 3.2)

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

project(download-oneTBB)

# DOCUMENTATION_START {
hunter_add_package(oneTBB)
find_package(TBB CONFIG REQUIRED)
find_package(Threads REQUIRED)

add_executable(boo boo.cpp)
target_link_libraries(boo PUBLIC TBB::tbb)
# DOCUMENTATION_END }
16 changes: 16 additions & 0 deletions examples/oneTBB/boo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <tbb/tbb.h>

int main() {
// Calculate sum of numbers 1 to 100
int sum = oneapi::tbb::parallel_reduce(oneapi::tbb::blocked_range<int>(1,101), 0,
[](oneapi::tbb::blocked_range<int> const& r, int init) -> int {
for (int v = r.begin(); v != r.end(); v++ ) {
init += v;
}
return init;
},
[](int lhs, int rhs) -> int {
return lhs + rhs;
}
);
}