-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
219 lines (194 loc) · 6.74 KB
/
CMakeLists.txt
File metadata and controls
219 lines (194 loc) · 6.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# Copyright (c) 2020-2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
add_library(tbb
address_waiter.cpp
allocator.cpp
arena.cpp
arena_slot.cpp
concurrent_bounded_queue.cpp
dynamic_link.cpp
exception.cpp
governor.cpp
global_control.cpp
itt_notify.cpp
main.cpp
market.cpp
tcm_adaptor.cpp
misc.cpp
misc_ex.cpp
observer_proxy.cpp
parallel_pipeline.cpp
private_server.cpp
profiling.cpp
rml_tbb.cpp
rtm_mutex.cpp
rtm_rw_mutex.cpp
semaphore.cpp
small_object_pool.cpp
task.cpp
task_dispatcher.cpp
task_group_context.cpp
thread_dispatcher.cpp
thread_request_serializer.cpp
threading_control.cpp
version.cpp
queuing_rw_mutex.cpp)
add_library(TBB::tbb ALIAS tbb)
if (WIN32)
target_sources(tbb PRIVATE tbb.rc)
set_target_properties(tbb PROPERTIES OUTPUT_NAME "tbb${TBB_BINARY_VERSION}")
endif()
# TODO: Add statistics.cpp
target_compile_definitions(tbb
PUBLIC
$<$<CONFIG:DEBUG>:TBB_USE_DEBUG>
PRIVATE
__TBB_BUILD
${TBB_RESUMABLE_TASKS_USE_THREADS}
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:__TBB_DYNAMIC_LOAD_ENABLED=0>
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:__TBB_SOURCE_DIRECTLY_INCLUDED=1>)
if (NOT ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(armv7-a|aarch64|mips|arm64|riscv)" OR
"${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64" OR
WINDOWS_STORE OR
TBB_WINDOWS_DRIVER))
target_compile_definitions(tbb PRIVATE __TBB_USE_ITT_NOTIFY)
endif()
target_include_directories(tbb
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_compile_options(tbb
PRIVATE
${TBB_CXX_STD_FLAG} # TODO: consider making it PUBLIC.
${TBB_MMD_FLAG}
${TBB_DSE_FLAG}
${TBB_WARNING_LEVEL}
${TBB_WARNING_SUPPRESS}
${TBB_LIB_COMPILE_FLAGS}
${TBB_COMMON_COMPILE_FLAGS}
)
# Avoid use of target_link_libraries here as it changes /DEF option to \DEF on Windows.
set_target_properties(tbb PROPERTIES
DEFINE_SYMBOL ""
)
tbb_handle_ipo(tbb)
if (TBB_DEF_FILE_PREFIX) # If there's no prefix, assume we're using export directives
set_target_properties(tbb PROPERTIES
LINK_FLAGS "${TBB_LINK_DEF_FILE_FLAG}\"${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbb.def\""
LINK_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/def/${TBB_DEF_FILE_PREFIX}-tbb.def"
)
endif()
# Prefer using target_link_options instead of target_link_libraries to specify link options because
# target_link_libraries may incorrectly handle some options (on Windows, for example).
if (COMMAND target_link_options)
target_link_options(tbb
PRIVATE
${TBB_LIB_LINK_FLAGS}
${TBB_COMMON_LINK_FLAGS}
)
else()
target_link_libraries(tbb
PRIVATE
${TBB_LIB_LINK_FLAGS}
${TBB_COMMON_LINK_FLAGS}
)
endif()
target_link_libraries(tbb
PRIVATE
Threads::Threads
${TBB_LIB_LINK_LIBS}
${TBB_COMMON_LINK_LIBS}
)
# Strip debug symbols into a separate .dbg file
if(TBB_LINUX_SEPARATE_DBG)
if(NOT CMAKE_BUILD_TYPE STREQUAL "release")
find_program(OBJCOPY_COMMAND objcopy)
if(NOT OBJCOPY_COMMAND)
message(WARNING "objcopy command not found in the system")
else()
add_custom_command(TARGET tbb POST_BUILD
COMMAND objcopy --only-keep-debug $<TARGET_FILE:tbb> $<TARGET_FILE:tbb>.dbg
COMMAND objcopy --strip-debug $<TARGET_FILE:tbb>
COMMAND objcopy --add-gnu-debuglink=$<TARGET_FILE:tbb>.dbg $<TARGET_FILE:tbb>
COMMENT "Creating and associating .dbg file with tbb"
)
endif()
else()
message(WARNING " TBB_LINUX_SEPARATE_DBG flag is not used on release config")
endif()
endif()
if(TBB_BUILD_APPLE_FRAMEWORKS)
set_target_properties(tbb PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION ${TBB_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION}
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.intel.tbb
MACOSX_FRAMEWORK_IDENTIFIER com.intel.tbb
MACOSX_FRAMEWORK_BUNDLE_VERSION ${TBB_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION}
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${TBB_BINARY_VERSION})
endif()
tbb_install_target(tbb)
if (TBB_INSTALL)
if (MSVC)
# Create a copy of target linker file (tbb<ver>[_debug].lib) with legacy name (tbb[_debug].lib)
# to support previous user experience for linkage.
install(FILES
$<TARGET_LINKER_FILE:tbb>
DESTINATION lib
CONFIGURATIONS RelWithDebInfo Release MinSizeRel
RENAME tbb.lib
COMPONENT devel
)
install(FILES
$<TARGET_LINKER_FILE:tbb>
DESTINATION lib
CONFIGURATIONS Debug
RENAME tbb_debug.lib
COMPONENT devel
)
endif()
if(TBB_LINUX_SEPARATE_DBG)
install(FILES
$<TARGET_FILE:tbb>.dbg
DESTINATION lib
COMPONENT devel
)
endif()
set(_tbb_pc_lib_name tbb)
if (WIN32)
set(_tbb_pc_lib_name ${_tbb_pc_lib_name}${TBB_BINARY_VERSION})
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(TBB_PC_NAME tbb)
else()
set(TBB_PC_NAME tbb32)
endif()
set(_prefix_for_pc_file "${CMAKE_INSTALL_PREFIX}")
if (IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(_libdir_for_pc_file "${CMAKE_INSTALL_LIBDIR}")
else()
set(_libdir_for_pc_file "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
endif()
if (IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
set(_includedir_for_pc_file "${CMAKE_INSTALL_INCLUDEDIR}")
else()
set(_includedir_for_pc_file "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
endif()
configure_file(${PROJECT_SOURCE_DIR}/integration/pkg-config/tbb.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${TBB_PC_NAME}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TBB_PC_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/
COMPONENT devel)
endif()
if (COMMAND tbb_gen_vars)
tbb_gen_vars(tbb)
endif()