Skip to content

Commit

Permalink
Commit oneTBB 2021.1.1 source code
Browse files Browse the repository at this point in the history
  • Loading branch information
tbbdev committed Dec 8, 2020
1 parent 978af3d commit 46fb877
Show file tree
Hide file tree
Showing 293 changed files with 20,049 additions and 18,797 deletions.
27 changes: 14 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
cmake_minimum_required(VERSION 3.1)

include(CheckCXXCompilerFlag)
include(GNUInstallDirs)

# Enable CMake policies

Expand Down Expand Up @@ -46,7 +47,7 @@ if (CMAKE_VERSION VERSION_LESS 3.4)
enable_language(C)
endif()

file(READ include/tbb/version.h _tbb_version_info)
file(READ include/oneapi/tbb/version.h _tbb_version_info)
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _tbb_ver_major "${_tbb_version_info}")
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _tbb_ver_minor "${_tbb_version_info}")
string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_tbb_version_info}")
Expand All @@ -55,7 +56,7 @@ set(TBB_BINARY_MINOR_VERSION 1)
set(TBBMALLOC_BINARY_VERSION 2)
set(TBBBIND_BINARY_VERSION 3)

project(TBB VERSION ${_tbb_ver_major}.${_tbb_ver_minor} LANGUAGES CXX)
project(TBB VERSION ${_tbb_ver_major}.${_tbb_ver_minor}.1 LANGUAGES CXX)
unset(_tbb_ver_major)
unset(_tbb_ver_minor)

Expand Down Expand Up @@ -93,7 +94,6 @@ endif()
option(TBB_TEST "Enable testing" ON)
option(TBB_EXAMPLES "Enable examples" OFF)
option(TBB_STRICT "Treat compiler warnings as errors" ON)
option(TBB_NUMA_SUPPORT "Enable NUMA support that depends on Portable Hardware Locality (hwloc) library" OFF)
option(TBB_WINDOWS_DRIVER "Build as Universal Windows Driver (UWD)" OFF)
option(TBB_NO_APPCONTAINER "Apply /APPCONTAINER:NO (for testing binaries for Windows Store)" OFF)
option(TBB4PY_BUILD "Enable tbb4py build" OFF)
Expand Down Expand Up @@ -187,25 +187,25 @@ else()
if (NOT "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips")
add_subdirectory(src/tbbmalloc)
add_subdirectory(src/tbbmalloc_proxy)
if (TBB_NUMA_SUPPORT)
if (APPLE)
message(WARNING "TBBBind build target is disabled due to unsupported environment")
else()
add_subdirectory(src/tbbbind)
endif()
if (APPLE)
message(STATUS "TBBBind build target is disabled due to unsupported environment")
else()
add_subdirectory(src/tbbbind)
endif()
endif()

# -------------------------------------------------------------------
# Installation instructions
include(CMakePackageConfigHelpers)

install(DIRECTORY include
DESTINATION .)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT devel)

install(EXPORT ${PROJECT_NAME}Targets
NAMESPACE TBB::
DESTINATION lib/cmake/${PROJECT_NAME})
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT devel)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
"include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Targets.cmake)\n")

Expand All @@ -214,7 +214,8 @@ else()

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION lib/cmake/${PROJECT_NAME})
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
COMPONENT devel)
# -------------------------------------------------------------------
endif()

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# oneAPI Threading Building Blocks (Beta)
# oneAPI Threading Building Blocks
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE.txt)

oneAPI Threading Building Blocks (oneTBB) lets you easily write parallel C++ programs that take
Expand Down Expand Up @@ -28,4 +28,4 @@ By its terms, contributions submitted to the project are also done under that li
------------------------------------------------------------------------
Intel and the Intel logo are trademarks of Intel Corporation or its subsidiaries in the U.S. and/or other countries.

\* Other names and brands may be claimed as the property of others.
\* Other names and brands may be claimed as the property of others.
16 changes: 13 additions & 3 deletions cmake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ The following controls are available during the configure stage:
```
TBB_TEST:BOOL - Enable testing (ON by default)
TBB_STRICT:BOOL - Treat compiler warnings as errors (ON by default)
TBB_NUMA_SUPPORT:BOOL - Enable TBBBind build target and task_arena extensions for NUMA support (depends on Portable Hardware Locality (hwloc) library) (OFF by default)
TBB_SANITIZE:STRING - Sanitizer parameter, passed to compiler/linker
TBB_SIGNTOOL:FILEPATH - Tool for digital signing, used in post install step for libraries if provided.
TBB_SIGNTOOL_ARGS:STRING - Additional arguments for TBB_SIGNTOOL, used if TBB_SIGNTOOL is set.
Expand Down Expand Up @@ -138,6 +137,17 @@ make test_spec

**NOTE: be careful about installation: avoid commands like `make install` unless you fully understand the consequences.**

The following install components are supported:
- `runtime` - oneTBB runtime package (core shared libraries and `.dll` files on Windows).
- `devel` - oneTBB development package (header files, CMake integration files, library symbolic links and `.lib` files on Windows).
- `tbb4py` - [oneTBB Module for Python](#onetbb-python-module-support).

How to install specific components after configuration and build:

```bash
cmake -DCOMPONENT=<component> [-DBUILD_TYPE=<build-type>] -P cmake_install.cmake
```

Simple packaging using CPack is supported.
The following commands allow to create a simple portable package which includes header files, libraries and integration files for CMake:

Expand Down Expand Up @@ -184,8 +194,8 @@ Variable | Description
`TBB_VERSION` | oneTBB version (format: `<major>.<minor>.<patch>.<tweak>`)
`TBB_IMPORTED_TARGETS` | All created oneTBB imported targets (not supported for builds from source code)

Starting from [oneTBB 2021.1-beta08](https://github.com/oneapi-src/oneTBB/releases/tag/v2021.1-beta08) GitHub release TBBConfig files in the binary packages are located under `<tbb-root>/lib[/<intel64|ia32>]/cmake/TBB`.
For example, for Linux 64-bit `TBB_DIR` should be set to `<tbb-root>/lib/intel64/cmake/TBB`.
Starting from [oneTBB 2021.1](https://github.com/oneapi-src/oneTBB/releases/tag/v2021.1) GitHub release TBBConfig files in the binary packages are located under `<tbb-root>/lib/cmake/TBB`.
For example, `TBB_DIR` should be set to `<tbb-root>/lib/cmake/TBB`.

TBBConfig files are automatically created during the build from source code and can be installed together with the library.
Also oneTBB provides a helper function that creates TBBConfig files from predefined templates: see `tbb_generate_config` in `cmake/config_generation.cmake`.
Expand Down
8 changes: 5 additions & 3 deletions cmake/compilers/AppleClang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ set(TBB_WARNING_LEVEL -Wall -Wextra $<$<BOOL:${TBB_STRICT}>:-Werror>)
set(TBB_TEST_WARNING_FLAGS -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor)
set(TBB_WARNING_SUPPRESS -Wno-parentheses -Wno-non-virtual-dtor -Wno-dangling-else)
# For correct ucontext.h structures layout
set(TBB_LIB_COMPILE_FLAGS -D_XOPEN_SOURCE)
set(TBB_BENCH_COMPILE_FLAGS -D_XOPEN_SOURCE)
set(TBB_COMMON_COMPILE_FLAGS -D_XOPEN_SOURCE)

set(TBB_MMD_FLAG -MMD)
set(TBB_COMMON_COMPILE_FLAGS -mrtm)

if (NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES "^arm64$")
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm)
endif()

# TBB malloc settings
set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions)
Expand Down
26 changes: 20 additions & 6 deletions cmake/config_generation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ function(tbb_generate_config)
set(options HANDLE_SUBDIRS)
set(oneValueArgs INSTALL_DIR
SYSTEM_NAME
SIZEOF_VOID_P # 4 for 32 bit, 8 for 64 bit.
LIB_REL_PATH INC_REL_PATH DLL_REL_PATH
VERSION
TBB_BINARY_VERSION
Expand All @@ -39,8 +38,6 @@ function(tbb_generate_config)
file(TO_CMAKE_PATH "${tbb_gen_cfg_DLL_REL_PATH}" TBB_DLL_REL_PATH)
file(TO_CMAKE_PATH "${tbb_gen_cfg_INC_REL_PATH}" TBB_INC_REL_PATH)

set(TBB_SIZEOF_VOID_P "${tbb_gen_cfg_SIZEOF_VOID_P}")

set(TBB_VERSION ${tbb_gen_cfg_VERSION})

set(TBB_COMPONENTS_BIN_VERSION "
Expand All @@ -57,7 +54,11 @@ set(_tbbbind_bin_version ${tbb_gen_cfg_TBBBIND_BINARY_VERSION})
set(TBB_IMPLIB_DEBUG "")
if (tbb_gen_cfg_HANDLE_SUBDIRS)
set(TBB_HANDLE_SUBDIRS "
set(_tbb_subdir gcc4.8)
if (CMAKE_SIZEOF_VOID_P STREQUAL \"8\")
set(_tbb_subdir intel64/gcc4.8)
else ()
set(_tbb_subdir ia32/gcc4.8)
endif()
")
endif()
elseif (tbb_gen_cfg_SYSTEM_NAME STREQUAL "Darwin")
Expand All @@ -76,9 +77,9 @@ set(_tbb_subdir gcc4.8)
# Expand TBB_LIB_REL_PATH here in IMPORTED_IMPLIB property and
# redefine it with TBB_DLL_REL_PATH value to properly fill IMPORTED_LOCATION property in TBBConfig.cmake.in template.
set(TBB_IMPLIB_RELEASE "
IMPORTED_IMPLIB_RELEASE \"\${CMAKE_CURRENT_LIST_DIR}/${TBB_LIB_REL_PATH}/\${_tbb_subdir}/\${_tbb_component}.lib\"")
IMPORTED_IMPLIB_RELEASE \"\${CMAKE_CURRENT_LIST_DIR}/${TBB_LIB_REL_PATH}/\${_tbb_subdir}/\${_tbb_component}\${_bin_version}.lib\"")
set(TBB_IMPLIB_DEBUG "
IMPORTED_IMPLIB_DEBUG \"\${CMAKE_CURRENT_LIST_DIR}/${TBB_LIB_REL_PATH}/\${_tbb_subdir}/\${_tbb_component}_debug.lib\"")
IMPORTED_IMPLIB_DEBUG \"\${CMAKE_CURRENT_LIST_DIR}/${TBB_LIB_REL_PATH}/\${_tbb_subdir}/\${_tbb_component}\${_bin_version}_debug.lib\"")
set(TBB_LIB_REL_PATH ${TBB_DLL_REL_PATH})

if (tbb_gen_cfg_HANDLE_SUBDIRS)
Expand All @@ -87,8 +88,21 @@ set(_tbb_subdir vc14)
if (WINDOWS_STORE)
set(_tbb_subdir \${_tbb_subdir}_uwp)
endif()
if (CMAKE_SIZEOF_VOID_P STREQUAL \"8\")
set(_tbb_subdir intel64/\${_tbb_subdir})
else ()
set(_tbb_subdir ia32/\${_tbb_subdir})
endif()
")
endif()

set(TBB_HANDLE_BIN_VERSION "
unset(_bin_version)
if (_tbb_component STREQUAL tbb)
set(_bin_version \${_tbb_bin_version})
endif()
")
else()
message(FATAL_ERROR "Unsupported OS name: ${tbb_system_name}")
endif()
Expand Down
Loading

0 comments on commit 46fb877

Please sign in to comment.