Add disable-exceptions feature to portfile for tbb (#16068)

* Add disable-exceptions feature to portfile to pass exceptions=0 to tbb_build in the non-windows case, and set TBB_USE_EXCEPTIONS=0 in the vcxproj files in the windows case. This removes the try/catch(...) wrappers around user code run by TBB. While these exception facilities can be nice in some cases, their removal allows for much easier debugging of a crash due to an unhandled exception in code that a TBB client provides to a TBB algortihm. With the try/catch(...) wrappers removed, the unhandled exception and crash dump are generated at the point of the thrown exception, versus significantly later in a different thread with the originally throwing thread no longer having the stack from when the exception was thrown.

* commit for changes from running x-add-version tbb to update for new port version

* Remove feature and undo changes made by x-add-version

* Rerun x-add-version
This commit is contained in:
aggieNick02 2021-04-08 14:01:25 -05:00 committed by GitHub
parent d46fc1f443
commit 83f3896fc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 7 deletions

View File

@ -1,9 +1,13 @@
project(tbb CXX) project(tbb CXX)
option(DISABLE_EXCEPTIONS "Set exceptions=0 for make to turn off exception support in TBB" OFF)
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*) file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*)
file(COPY ${SOURCES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src) file(COPY ${SOURCES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/src)
include(${CMAKE_CURRENT_BINARY_DIR}/src/cmake/TBBBuild.cmake REQUIRED) include(${CMAKE_CURRENT_BINARY_DIR}/src/cmake/TBBBuild.cmake REQUIRED)
if(DISABLE_EXCEPTIONS)
set(DISABLE_EXCEPTIONS_ARG exceptions=0)
endif()
if(NOT BUILD_SHARED_LIBS) if(NOT BUILD_SHARED_LIBS)
set(TBB_STATIC_INCLUDE extra_inc=big_iron.inc) set(TBB_STATIC_INCLUDE extra_inc=big_iron.inc)
endif() endif()
@ -26,7 +30,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
endif() endif()
endif() endif()
tbb_build(TBB_ROOT ${CMAKE_CURRENT_BINARY_DIR}/src MAKE_ARGS ${arch} ${CPLUS} ${CONLY} ${TBB_STATIC_INCLUDE} ${FORWARD_SDK_ROOT}) tbb_build(TBB_ROOT ${CMAKE_CURRENT_BINARY_DIR}/src MAKE_ARGS ${arch} ${CPLUS} ${CONLY} ${DISABLE_EXCEPTIONS_ARG} ${TBB_STATIC_INCLUDE} ${FORWARD_SDK_ROOT})
set(SUBDIR ${CMAKE_CURRENT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir) set(SUBDIR ${CMAKE_CURRENT_BINARY_DIR}/tbb_cmake_build/tbb_cmake_build_subdir)
if(CMAKE_BUILD_TYPE STREQUAL "Release") if(CMAKE_BUILD_TYPE STREQUAL "Release")

View File

@ -1,6 +1,6 @@
Source: tbb Source: tbb
Version: 2020_U3 Version: 2020_U3
Port-Version: 3 Port-Version: 4
Homepage: https://github.com/01org/tbb Homepage: https://github.com/01org/tbb
Description: Intel's Threading Building Blocks. Description: Intel's Threading Building Blocks.
Supports: !(uwp|arm|arm64) | linux | osx Supports: !(uwp|arm|arm64) | linux | osx

View File

@ -14,11 +14,22 @@ vcpkg_from_github(
) )
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
if (TBB_DISABLE_EXCEPTIONS)
message(STATUS "Building TBB with exception-handling constructs disabled because TBB_DISABLE_EXCEPTIONS is set to ON.")
else()
message(STATUS "TBB uses exception-handling constructs by default (if supported by the compiler). This use can be disabled with 'SET(TBB_DISABLE_EXCEPTIONS ON)' in your custom triplet.")
endif()
if (NOT VCPKG_TARGET_IS_WINDOWS) if (NOT VCPKG_TARGET_IS_WINDOWS)
if (TBB_DISABLE_EXCEPTIONS)
set(DISABLE_EXCEPTIONS ON)
else()
set(DISABLE_EXCEPTIONS OFF)
endif()
vcpkg_configure_cmake( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA PREFER_NINJA
OPTIONS -DDISABLE_EXCEPTIONS=${DISABLE_EXCEPTIONS}
) )
vcpkg_install_cmake() vcpkg_install_cmake()
@ -52,19 +63,21 @@ else()
configure_file(${CONFIGURE_FILE_NAME} ${CONFIGURE_BAK_FILE_NAME} COPYONLY) configure_file(${CONFIGURE_FILE_NAME} ${CONFIGURE_BAK_FILE_NAME} COPYONLY)
endif() endif()
configure_file(${CONFIGURE_BAK_FILE_NAME} ${CONFIGURE_FILE_NAME} COPYONLY) configure_file(${CONFIGURE_BAK_FILE_NAME} ${CONFIGURE_FILE_NAME} COPYONLY)
file(READ ${CONFIGURE_FILE_NAME} SLN_CONFIGURE)
if (VCPKG_LIBRARY_LINKAGE STREQUAL static) if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(READ ${CONFIGURE_FILE_NAME} SLN_CONFIGURE)
string(REPLACE "<ConfigurationType>DynamicLibrary<\/ConfigurationType>" string(REPLACE "<ConfigurationType>DynamicLibrary<\/ConfigurationType>"
"<ConfigurationType>StaticLibrary<\/ConfigurationType>" SLN_CONFIGURE "${SLN_CONFIGURE}") "<ConfigurationType>StaticLibrary<\/ConfigurationType>" SLN_CONFIGURE "${SLN_CONFIGURE}")
string(REPLACE "\/D_CRT_SECURE_NO_DEPRECATE" string(REPLACE "\/D_CRT_SECURE_NO_DEPRECATE"
"\/D_CRT_SECURE_NO_DEPRECATE \/DIN_CILK_STATIC" SLN_CONFIGURE "${SLN_CONFIGURE}") "\/D_CRT_SECURE_NO_DEPRECATE \/DIN_CILK_STATIC" SLN_CONFIGURE "${SLN_CONFIGURE}")
file(WRITE ${CONFIGURE_FILE_NAME} "${SLN_CONFIGURE}")
else() else()
file(READ ${CONFIGURE_FILE_NAME} SLN_CONFIGURE)
string(REPLACE "\/D_CRT_SECURE_NO_DEPRECATE" string(REPLACE "\/D_CRT_SECURE_NO_DEPRECATE"
"\/D_CRT_SECURE_NO_DEPRECATE \/DIN_CILK_RUNTIME" SLN_CONFIGURE "${SLN_CONFIGURE}") "\/D_CRT_SECURE_NO_DEPRECATE \/DIN_CILK_RUNTIME" SLN_CONFIGURE "${SLN_CONFIGURE}")
file(WRITE ${CONFIGURE_FILE_NAME} "${SLN_CONFIGURE}")
endif() endif()
if (TBB_DISABLE_EXCEPTIONS)
string(REPLACE "<PreprocessorDefinitions>%(PreprocessorDefinitions)<\/PreprocessorDefinitions>"
"<PreprocessorDefinitions>TBB_USE_EXCEPTIONS=0;%(PreprocessorDefinitions)<\/PreprocessorDefinitions>" SLN_CONFIGURE "${SLN_CONFIGURE}")
endif()
file(WRITE ${CONFIGURE_FILE_NAME} "${SLN_CONFIGURE}")
endmacro() endmacro()
CONFIGURE_PROJ_FILE(${SOURCE_PATH}/build/vs2013/tbb.vcxproj) CONFIGURE_PROJ_FILE(${SOURCE_PATH}/build/vs2013/tbb.vcxproj)

View File

@ -5870,7 +5870,7 @@
}, },
"tbb": { "tbb": {
"baseline": "2020_U3", "baseline": "2020_U3",
"port-version": 3 "port-version": 4
}, },
"tcl": { "tcl": {
"baseline": "core-9-0-a1", "baseline": "core-9-0-a1",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "4e6228578b0ca40358f584aa1ea8b4a9ac2d4ed9",
"version-string": "2020_U3",
"port-version": 4
},
{ {
"git-tree": "eb2f60732524f07ea5effc9aeda3472fd0bbe243", "git-tree": "eb2f60732524f07ea5effc9aeda3472fd0bbe243",
"version-string": "2020_U3", "version-string": "2020_U3",