Commit 070a77ae authored by Alexander Smorkalov's avatar Alexander Smorkalov

TBB updated to version 4.1 update 4.

parent 347c86d9
#Cross compile TBB from source #Cross compile TBB from source
project(tbb) project(tbb)
# Development release if (WIN32 AND NOT ARM)
set(tbb_ver "tbb41_20130516oss") message(FATAL_ERROR "BUILD_TBB option supports Windows on ARM only!\nUse regular official TBB build instead of the BUILD_TBB option!")
set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130516oss_src.tgz") endif()
set(tbb_md5 "08c14d1c196bc9595d8c52bedc239937")
# 4.1 update 4 - works fine
set(tbb_ver "tbb41_20130613oss")
set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20130613oss_src.tgz")
set(tbb_md5 "108c8c1e481b0aaea61878289eb28b6a")
set(tbb_version_file "version_string.ver") set(tbb_version_file "version_string.ver")
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused-parameter) ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow -Wunused-parameter)
...@@ -121,7 +125,7 @@ if(NOT EXISTS "${tbb_src_dir}") ...@@ -121,7 +125,7 @@ if(NOT EXISTS "${tbb_src_dir}")
RESULT_VARIABLE tbb_untar_RESULT) RESULT_VARIABLE tbb_untar_RESULT)
if(NOT tbb_untar_RESULT EQUAL 0 OR NOT EXISTS "${tbb_src_dir}") if(NOT tbb_untar_RESULT EQUAL 0 OR NOT EXISTS "${tbb_src_dir}")
message(FATAL_ERROR "Failed to unpack TBB sources (${tbb_untar_RESULT} ${tbb_src_dir})") message(FATAL_ERROR "Failed to unpack TBB sources from ${tbb_tarball} to ${tbb_src_dir} with error ${tbb_untar_RESULT}")
endif() endif()
endif() endif()
...@@ -137,18 +141,22 @@ file(GLOB lib_hdrs "${tbb_src_dir}/src/tbb/*.h") ...@@ -137,18 +141,22 @@ file(GLOB lib_hdrs "${tbb_src_dir}/src/tbb/*.h")
list(APPEND lib_srcs "${tbb_src_dir}/src/rml/client/rml_tbb.cpp") list(APPEND lib_srcs "${tbb_src_dir}/src/rml/client/rml_tbb.cpp")
if (WIN32) if (WIN32)
add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 add_definitions(/D__TBB_DYNAMIC_LOAD_ENABLED=0
/D__TBB_BUILD=1 /D__TBB_BUILD=1
/DTBB_NO_LEGACY=1 /DTBB_NO_LEGACY=1
/D_UNICODE /D_UNICODE
/DUNICODE /DUNICODE
/DWINAPI_FAMILY=WINAPI_FAMILY_APP /DWINAPI_FAMILY=WINAPI_FAMILY_APP
/DDO_ITT_NOTIFY=0 /DDO_ITT_NOTIFY=0
/DUSE_WINTHREAD /DUSE_WINTHREAD
/D_WIN32_WINNT=0x0602
/D__TBB_WIN32_USE_CL_BUILTINS
) # defines were copied from windows.cl.inc ) # defines were copied from windows.cl.inc
if (ARM)
add_definitions(/D_WIN32_WINNT=0x0602
/D__TBB_WIN32_USE_CL_BUILTINS
)
endif()
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} /APPCONTAINER") set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} /APPCONTAINER")
else() else()
add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required
...@@ -193,16 +201,18 @@ set(TBB_SOURCE_FILES ${TBB_SOURCE_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_vers ...@@ -193,16 +201,18 @@ set(TBB_SOURCE_FILES ${TBB_SOURCE_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_vers
add_library(tbb ${TBB_SOURCE_FILES}) add_library(tbb ${TBB_SOURCE_FILES})
if (ARM AND WIN32) if (WIN32)
if (ARM)
set(platform_macro /D_M_ARM=1)
endif()
add_custom_command(TARGET tbb add_custom_command(TARGET tbb
PRE_BUILD PRE_BUILD
COMMAND ${CMAKE_C_COMPILER} /nologo /TC /EP ${tbb_src_dir}\\src\\tbb\\win32-tbb-export.def /DTBB_NO_LEGACY=1 /D_CRT_SECURE_NO_DEPRECATE /D__TBB_BUILD=1 /D_M_ARM=1 /I${tbb_src_dir}\\src /I${tbb_src_dir}\\include > "${tbb_src_dir}\\src\\tbb\\tbb.def" COMMAND ${CMAKE_C_COMPILER} /nologo /TC /EP ${tbb_src_dir}\\src\\tbb\\win32-tbb-export.def /DTBB_NO_LEGACY=1 /D_CRT_SECURE_NO_DEPRECATE /D__TBB_BUILD=1 ${platform_macro} /I${tbb_src_dir}\\src /I${tbb_src_dir}\\include > "${tbb_src_dir}\\src\\tbb\\tbb.def"
WORKING_DIRECTORY ${tbb_src_dir}\\src\\tbb WORKING_DIRECTORY ${tbb_src_dir}\\src\\tbb
COMMENT "Generating tbb.def file" VERBATIM COMMENT "Generating tbb.def file" VERBATIM
) )
endif()
if (WIN32)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${tbb_src_dir}/src/tbb/tbb.def /DLL /MAP /fixed:no /INCREMENTAL:NO") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEF:${tbb_src_dir}/src/tbb/tbb.def /DLL /MAP /fixed:no /INCREMENTAL:NO")
else() else()
target_link_libraries(tbb c m dl) target_link_libraries(tbb c m dl)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment