Skip to content

Commit 621af05

Browse files
Allow loading dependencies by name (#1594)
Signed-off-by: Fedotov, Aleksei <[email protected]>
1 parent 34e7495 commit 621af05

File tree

7 files changed

+458
-102
lines changed

7 files changed

+458
-102
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,21 @@ if(APPLE)
134134
option(TBB_BUILD_APPLE_FRAMEWORKS "Build as Apple Frameworks" OFF)
135135
endif()
136136

137+
if (WIN32)
138+
if (TBB_VERIFY_DEPENDENCY_SIGNATURE)
139+
message(STATUS "Dependency signature verification during dynamic linking in run-time is ENABLED.")
140+
elseif (NOT DEFINED TBB_VERIFY_DEPENDENCY_SIGNATURE)
141+
message(WARNING
142+
"Dependency signature verification during dynamic linking in run-time is disabled by "
143+
"default. This may lead to security vulnerabilities. See installation section in "
144+
"oneTBB documentation for more details.")
145+
else()
146+
message(STATUS "Dependency signature verification during dynamic linking in run-time is DISABLED")
147+
endif()
148+
option(TBB_VERIFY_DEPENDENCY_SIGNATURE
149+
"Verify signature of a dependency during its dynamic linking at run-time on Windows*" OFF)
150+
endif()
151+
137152
if (NOT DEFINED BUILD_SHARED_LIBS)
138153
set(BUILD_SHARED_LIBS ON)
139154
endif()

INSTALL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ cmake <options> <repo_root>
1616

1717
You may want to use some additional options for configuration:
1818

19-
| Option | Purpose | Description |
20-
| ------ |------ | ------ |
21-
| `-G <generator>` | Specify project generator | For more information, run cmake `–help`. |
22-
|`-DCMAKE_BUILD_TYPE=Debug` | Specify for Debug build | Not applicable for multi-configuration generators such as Visual Studio generator. |
23-
19+
| Option | Purpose | Description |
20+
|---------------------------------------------|-------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
21+
| `-G <generator>` | Specify project generator | For more information, run cmake `–help`. |
22+
| `-DCMAKE_BUILD_TYPE=Debug` | Specify for Debug build | Not applicable for multi-configuration generators such as Visual Studio generator. |
23+
| `-DTBB_VERIFY_DEPENDENCY_SIGNATURE=ON\|OFF` | Controls signature verification of dynamic dependencies loaded during runtime | If set to ON, only the signed dynamic dependencies are loaded. This is the recommended behavior. By default, the value is unspecified. Therefore, the warning is printed. To suppress the warning, set the value explicitly. |
2424

2525
## Build oneTBB
2626

cmake/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ TBB_CONTROL_FLOW_GUARD:BOOL - Enable Control Flow Guard (CFG) during the compila
2424
TBB_BUILD_APPLE_FRAMEWORKS - Enable the Apple* frameworks instead of dylibs, only available on the Apple platform. (OFF by default)
2525
TBB_FILE_TRIM - Enable __FILE__ trim, replace a build-time full path with a relative path in the debug info and macro __FILE__; use it to make
2626
reproducible location-independent builds (ON by default)
27+
TBB_VERIFY_DEPENDENCY_SIGNATURE - On Windows* enable verification of signatures for dependencies linked at run-time. (ON by default)
2728
```
2829

2930
## Configure, Build, and Test

src/tbb/CMakeLists.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@ endif()
5555

5656
# TODO: Add statistics.cpp
5757

58-
target_compile_definitions(tbb
59-
PUBLIC
60-
$<$<CONFIG:DEBUG>:TBB_USE_DEBUG>
61-
PRIVATE
62-
__TBB_BUILD
63-
${TBB_RESUMABLE_TASKS_USE_THREADS}
64-
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:__TBB_DYNAMIC_LOAD_ENABLED=0>
65-
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:__TBB_SOURCE_DIRECTLY_INCLUDED=1>)
58+
target_compile_definitions(
59+
tbb
60+
PUBLIC
61+
$<$<CONFIG:DEBUG>:TBB_USE_DEBUG>
62+
PRIVATE
63+
__TBB_BUILD
64+
${TBB_RESUMABLE_TASKS_USE_THREADS}
65+
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:__TBB_DYNAMIC_LOAD_ENABLED=0>
66+
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:__TBB_SOURCE_DIRECTLY_INCLUDED=1>
67+
$<$<NOT:$<BOOL:${TBB_VERIFY_DEPENDENCY_SIGNATURE}>>:__TBB_SKIP_DEPENDENCY_SIGNATURE_VERIFICATION=1>
68+
)
6669

6770
if (NOT ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(armv7-a|aarch64|mips|arm64|riscv)" OR
6871
"${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64" OR

0 commit comments

Comments
 (0)