Skip to content

Commit

Permalink
Fix build on systems without ucontext.h in libc (#1055)
Browse files Browse the repository at this point in the history
* Enable thread based resumable tasks if ucontext is absent

Signed-off-by: pavelkumbrasev <pavel.kumbrasev@intel.com>
Co-authored-by: Ilya Isaev <ilya.isaev@intel.com>
  • Loading branch information
pavelkumbrasev and isaevil committed Jun 1, 2023
1 parent 42bd067 commit ea4e615
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions cmake/resumable_tasks.cmake
@@ -0,0 +1,23 @@
# Copyright (c) 2023 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.

include(CheckSymbolExists)

if (UNIX)
check_symbol_exists("getcontext" "ucontext.h" _tbb_have_ucontext)
if (NOT _tbb_have_ucontext)
set(TBB_RESUMABLE_TASKS_USE_THREADS "__TBB_RESUMABLE_TASKS_USE_THREADS=1")
endif()
unset(_tbb_have_ucontext)
endif()
1 change: 1 addition & 0 deletions src/tbb/CMakeLists.txt
Expand Up @@ -56,6 +56,7 @@ target_compile_definitions(tbb
$<$<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>)

Expand Down

0 comments on commit ea4e615

Please sign in to comment.