Skip to content

Commit 05b1dd0

Browse files
committed
Committing oneTBB 2021.1-beta08 source code
1 parent 88b4c27 commit 05b1dd0

File tree

1,220 files changed

+96662
-289306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,220 files changed

+96662
-289306
lines changed

.gitignore

+49-77
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,60 @@
1-
# Ignore the debug and release directories created with Makefile builds #
2-
#########################################################################
3-
build/*_debug/
4-
build/*_release/
1+
# -------- C++ --------
2+
# Prerequisites
3+
*.d
54

6-
# Compiled source #
7-
###################
8-
*.com
9-
*.class
10-
*.dll
11-
*.lib
12-
*.pdb
13-
*.exe
5+
# Compiled Object files
6+
*.slo
7+
*.lo
148
*.o
15-
*.so
16-
*.so.1
17-
*.so.2
18-
*.dylib
19-
*.a
209
*.obj
21-
*.pyc
2210

23-
*.orig
24-
*.raw
25-
*.sample
26-
*.slo
27-
*.swp
28-
*.config
29-
*.la
30-
*.lai
31-
*.lo
32-
*.nhdr
33-
*.nii.gz
34-
*.nrrd
11+
# Precompiled Headers
12+
*.gch
13+
*.pch
3514

36-
# Packages #
37-
############
38-
# it's better to unpack these files and commit the raw source
39-
# git has its own built in compression methods
40-
*.7z
41-
*.dmg
42-
*.gz
43-
*.iso
44-
*.jar
45-
*.rar
46-
*.tar
47-
*.tgz
48-
*.zip
15+
# Compiled Dynamic libraries
16+
*.so
17+
*.so.*
18+
*.dylib
19+
*.dll
4920

50-
# Logs and databases #
51-
######################
52-
*.log
53-
*.sql
54-
*.sqlite
21+
# Fortran module files
22+
*.mod
23+
*.smod
5524

56-
# OS generated files #
57-
######################
58-
.DS_Store
59-
.DS_Store?
60-
._*
61-
.Spotlight-V100
62-
.Trashes
63-
ehthumbs.db
64-
Thumbs.db
25+
# Compiled Static libraries
26+
*.lai
27+
*.la
28+
*.a
29+
*.lib
6530

66-
# IDE generated files #
67-
######################
68-
/.ninja_deps
69-
/.ninja_log
70-
/build.ninja
71-
/rules.ninja
72-
*~
73-
.emacs.desktop
74-
.tags
31+
# Executables
32+
*.exe
33+
*.out
34+
*.app
7535

76-
# Build system generated files #
77-
################################
36+
# -------- CMake --------
7837
CMakeCache.txt
79-
CMakeFiles/
38+
CMakeFiles
39+
CMakeScripts
40+
Testing
41+
Makefile
42+
cmake_install.cmake
43+
install_manifest.txt
44+
compile_commands.json
45+
CTestTestfile.cmake
46+
build/*
47+
48+
# -------- Python --------
49+
__pycache__/
50+
*.py[cod]
51+
*$py.class
52+
53+
# -------- IDE --------
54+
.vscode/*
55+
.vs/*
56+
57+
# -------- CTags --------
58+
.tags
59+
.ctags
8060

81-
# Other #
82-
#########
83-
.clang_complete
84-
.idea
85-
.svn
86-
crash*
87-
*.tmp
88-
/.vs

CMakeLists.txt

+242
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
# Copyright (c) 2020 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
cmake_minimum_required(VERSION 3.1)
16+
17+
include(CheckCXXCompilerFlag)
18+
19+
# Enable CMake policies
20+
21+
if (POLICY CMP0091)
22+
# The NEW behavior for this policy is to not place MSVC runtime library flags in the default
23+
# CMAKE_<LANG>_FLAGS_<CONFIG> cache entries and use CMAKE_MSVC_RUNTIME_LIBRARY abstraction instead.
24+
cmake_policy(SET CMP0091 NEW)
25+
elseif (DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
26+
message(FATAL_ERROR "CMAKE_MSVC_RUNTIME_LIBRARY was defined while policy CMP0091 is not available. Use CMake 3.15 or newer.")
27+
endif()
28+
29+
if (TBB_WINDOWS_DRIVER AND (NOT ("${CMAKE_MSVC_RUNTIME_LIBRARY}" STREQUAL MultiThreaded OR "${CMAKE_MSVC_RUNTIME_LIBRARY}" STREQUAL MultiThreadedDebug)))
30+
message(FATAL_ERROR "Enabled TBB_WINDOWS_DRIVER requires CMAKE_MSVC_RUNTIME_LIBRARY to be set to MultiThreaded or MultiThreadedDebug.")
31+
endif()
32+
33+
# Until CMake 3.4.0 FindThreads.cmake requires C language enabled.
34+
# Enable C language before CXX to avoid possible override of CMAKE_SIZEOF_VOID_P.
35+
if (CMAKE_VERSION VERSION_LESS 3.4)
36+
enable_language(C)
37+
endif()
38+
39+
file(READ include/tbb/version.h _tbb_version_info)
40+
string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _tbb_ver_major "${_tbb_version_info}")
41+
string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _tbb_ver_minor "${_tbb_version_info}")
42+
string(REGEX REPLACE ".*#define TBB_INTERFACE_VERSION ([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${_tbb_version_info}")
43+
string(REGEX REPLACE ".*#define __TBB_BINARY_VERSION ([0-9]+).*" "\\1" TBB_BINARY_VERSION "${_tbb_version_info}")
44+
set(TBBMALLOC_BINARY_VERSION 2)
45+
46+
project(TBB VERSION ${_tbb_ver_major}.${_tbb_ver_minor} LANGUAGES CXX)
47+
unset(_tbb_ver_major)
48+
unset(_tbb_ver_minor)
49+
50+
# ---------------------------------------------------------------------------------------------------------
51+
# Handle C++ standard version.
52+
if (NOT MSVC) # no need to cover MSVC as it uses C++14 by default.
53+
if (NOT CMAKE_CXX_STANDARD)
54+
set(CMAKE_CXX_STANDARD 11)
55+
endif()
56+
57+
if (CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION) # if standard option was detected by CMake
58+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
59+
else() # if standard option wasn't detected by CMake (e.g. for Intel Compiler with CMake 3.1)
60+
# TBB_CXX_STD_FLAG should be added to targets via target_compile_options
61+
set(TBB_CXX_STD_FLAG -std=c++${CMAKE_CXX_STANDARD})
62+
63+
check_cxx_compiler_flag(${TBB_CXX_STD_FLAG} c++${CMAKE_CXX_STANDARD})
64+
if (NOT c++${CMAKE_CXX_STANDARD})
65+
message(FATAL_ERROR "C++${CMAKE_CXX_STANDARD} (${TBB_CXX_STD_FLAG}) support is required")
66+
endif()
67+
unset(c++${CMAKE_CXX_STANDARD})
68+
endif()
69+
endif()
70+
71+
set(CMAKE_CXX_EXTENSIONS OFF) # use -std=c++... instead of -std=gnu++...
72+
# ---------------------------------------------------------------------------------------------------------
73+
74+
# Detect architecture (bitness).
75+
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
76+
set(TBB_ARCH 32)
77+
else()
78+
set(TBB_ARCH 64)
79+
endif()
80+
81+
option(TBB_TEST "Enable testing" ON)
82+
option(TBB_EXAMPLES "Enable examples" OFF)
83+
option(TBB_STRICT "Treat compiler warnings as errors" ON)
84+
option(TBB_NUMA_SUPPORT "Enable NUMA support that depends on Portable Hardware Locality (hwloc) library" OFF)
85+
option(TBB_WINDOWS_DRIVER "Build as Universal Windows Driver (UWD)" OFF)
86+
option(TBB_NO_APPCONTAINER "Apply /APPCONTAINER:NO (for testing binaries for Windows Store)" OFF)
87+
option(TBB4PY_BUILD "Enable tbb4py build" OFF)
88+
option(TBB_CPF "Enable preview features of the library" OFF)
89+
option(TBB_FIND_PACKAGE "Enable search for external oneTBB using find_package instead of build from sources" OFF)
90+
91+
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
92+
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type" FORCE)
93+
message(STATUS "CMAKE_BUILD_TYPE is not specified. Using default: ${CMAKE_BUILD_TYPE}")
94+
# Possible values of build type for cmake-gui
95+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
96+
endif()
97+
98+
# -------------------------------------------------------------------
99+
# Files and folders naming
100+
set(CMAKE_DEBUG_POSTFIX _debug)
101+
102+
if (NOT DEFINED TBB_OUTPUT_DIR_BASE)
103+
if (MSVC)
104+
if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY OR CMAKE_MSVC_RUNTIME_LIBRARY MATCHES DLL)
105+
set(_tbb_msvc_runtime _md)
106+
else()
107+
set(_tbb_msvc_runtime _mt)
108+
endif()
109+
110+
if (WINDOWS_STORE)
111+
if (TBB_NO_APPCONTAINER)
112+
set(_tbb_win_store _wsnoappcont)
113+
else()
114+
set(_tbb_win_store _ws)
115+
endif()
116+
elseif(TBB_WINDOWS_DRIVER)
117+
set(_tbb_win_store _wd)
118+
endif()
119+
endif()
120+
121+
string(REGEX MATCH "^([0-9]+\.[0-9]+|[0-9]+)" _tbb_compiler_version_short ${CMAKE_CXX_COMPILER_VERSION})
122+
string(TOLOWER ${CMAKE_CXX_COMPILER_ID}_${_tbb_compiler_version_short}_cxx${CMAKE_CXX_STANDARD}_${TBB_ARCH}${_tbb_msvc_runtime}${_tbb_win_store} TBB_OUTPUT_DIR_BASE)
123+
unset(_tbb_msvc_runtime)
124+
unset(_tbb_win_store)
125+
unset(_tbb_compiler_version_short)
126+
endif()
127+
128+
foreach(output_type LIBRARY ARCHIVE PDB RUNTIME)
129+
if (CMAKE_BUILD_TYPE)
130+
string(TOLOWER ${CMAKE_BUILD_TYPE} _tbb_build_type_lower)
131+
set(CMAKE_${output_type}_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${TBB_OUTPUT_DIR_BASE}_${_tbb_build_type_lower})
132+
unset(_tbb_build_type_lower)
133+
endif()
134+
135+
if (CMAKE_CONFIGURATION_TYPES)
136+
foreach(suffix ${CMAKE_CONFIGURATION_TYPES})
137+
string(TOUPPER ${suffix} _tbb_suffix_upper)
138+
string(TOLOWER ${suffix} _tbb_suffix_lower)
139+
set(CMAKE_${output_type}_OUTPUT_DIRECTORY_${_tbb_suffix_upper} ${CMAKE_BINARY_DIR}/${TBB_OUTPUT_DIR_BASE}_${_tbb_suffix_lower})
140+
endforeach()
141+
unset(_tbb_suffix_lower)
142+
unset(_tbb_suffix_upper)
143+
endif()
144+
endforeach()
145+
146+
# -------------------------------------------------------------------
147+
148+
# -------------------------------------------------------------------
149+
# Common dependencies
150+
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
151+
find_package(Threads REQUIRED)
152+
# -------------------------------------------------------------------
153+
154+
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
155+
156+
file(GLOB FILES_WITH_EXTRA_TARGETS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/*.cmake)
157+
foreach(FILE_WITH_EXTRA_TARGETS ${FILES_WITH_EXTRA_TARGETS})
158+
include(${FILE_WITH_EXTRA_TARGETS})
159+
endforeach()
160+
161+
set(TBB_COMPILER_SETTINGS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compilers/${CMAKE_CXX_COMPILER_ID}.cmake)
162+
if (EXISTS ${TBB_COMPILER_SETTINGS_FILE})
163+
include(${TBB_COMPILER_SETTINGS_FILE})
164+
else()
165+
message(WARNING "TBB compiler settings not found ${TBB_COMPILER_SETTINGS_FILE}")
166+
endif()
167+
168+
if (TBB_FIND_PACKAGE OR TBB_DIR)
169+
# Allow specifying external TBB to test with.
170+
# Do not add main targets and installation instructions in that case.
171+
message(STATUS "Using external TBB for testing")
172+
find_package(TBB REQUIRED)
173+
else()
174+
add_subdirectory(src/tbb)
175+
if (NOT "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips")
176+
add_subdirectory(src/tbbmalloc)
177+
add_subdirectory(src/tbbmalloc_proxy)
178+
if (TBB_NUMA_SUPPORT)
179+
add_subdirectory(src/tbbbind)
180+
endif()
181+
endif()
182+
183+
# -------------------------------------------------------------------
184+
# Installation instructions
185+
include(CMakePackageConfigHelpers)
186+
187+
install(DIRECTORY include
188+
DESTINATION .)
189+
190+
install(EXPORT ${CMAKE_PROJECT_NAME}Targets
191+
NAMESPACE TBB::
192+
DESTINATION lib/cmake/${CMAKE_PROJECT_NAME})
193+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake
194+
"include(\${CMAKE_CURRENT_LIST_DIR}/${CMAKE_PROJECT_NAME}Targets.cmake)\n")
195+
196+
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
197+
COMPATIBILITY AnyNewerVersion)
198+
199+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
200+
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
201+
DESTINATION lib/cmake/${CMAKE_PROJECT_NAME})
202+
# -------------------------------------------------------------------
203+
endif()
204+
205+
if (TBB_TEST)
206+
enable_testing()
207+
add_subdirectory(test)
208+
endif()
209+
210+
if (TBB_EXAMPLES)
211+
add_subdirectory(examples)
212+
endif()
213+
214+
if (TBB_BENCH)
215+
if (NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/benchmark)
216+
message(FATAL_ERROR "Benchmarks are not supported yet")
217+
endif()
218+
219+
enable_testing()
220+
add_subdirectory(benchmark)
221+
endif()
222+
223+
if (ANDROID_PLATFORM)
224+
if (${ANDROID_STL} STREQUAL "c++_shared")
225+
configure_file(
226+
"${ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_shared.so"
227+
"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libc++_shared.so"
228+
COPYONLY)
229+
endif()
230+
# This custom target may be implemented without separate CMake script, but it requires
231+
# ADB(Android Debug Bridge) executable file availability, so to incapsulate this requirement
232+
# only for corresponding custom target, it was implemented by this way.
233+
add_custom_target(device_environment_cleanup COMMAND ${CMAKE_COMMAND}
234+
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/android/device_environment_cleanup.cmake)
235+
endif()
236+
237+
if (TBB4PY_BUILD)
238+
add_subdirectory(python)
239+
endif()
240+
241+
# Keep it the last instruction.
242+
add_subdirectory(cmake/post_install)

0 commit comments

Comments
 (0)