Fixed build with TBB for Android

This commit is contained in:
Andrey Kamaev 2012-06-08 10:32:51 +00:00
parent 018d85dddb
commit 8720b27d87
5 changed files with 17 additions and 13 deletions

View File

@ -72,7 +72,7 @@ if(NOT EXISTS "${tbb_tarball}")
file(REMOVE "${tbb_tarball}")
message(FATAL_ERROR "Downloaded TBB source tarball has invalid MD5 hash: ${tbb_local_md5} (expected: ${tbb_md5})")
endif()
if(EXISTS "${tbb_src_dir}")
file(REMOVE_RECURSE "${tbb_src_dir}")
endif()
@ -119,18 +119,21 @@ endif()
add_library(tbb STATIC ${lib_srcs} ${lib_hdrs} "${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h" "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}")
target_link_libraries(tbb c m dl)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -include \"${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h\"")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h\"")
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations)
string(REPLACE "-Werror=non-virtual-dtor" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set_target_properties(tbb
PROPERTIES OUTPUT_NAME tbb
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
)
PROPERTIES OUTPUT_NAME tbb
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}"
)
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(tbb PROPERTIES FOLDER "3rdparty")
endif()
if(NOT BUILD_SHARED_LIBS)
install(TARGETS tbb ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
endif()

View File

@ -6,4 +6,4 @@
"TBB: BUILD_GLIBC Unknown" ENDL \
"TBB: BUILD_LD Unknown" ENDL \
"TBB: BUILD_TARGET Unknown" ENDL \
"TBB: BUILD_COMMAND use cv::getBuildInformation() for details" ENDL \
"TBB: BUILD_COMMAND use cv::getBuildInformation() for details" ENDL

View File

@ -6,4 +6,4 @@
#N": BUILD_GLIBC Unknown" ENDL \
#N": BUILD_LD Unknown" ENDL \
#N": BUILD_TARGET Unknown" ENDL \
#N": BUILD_COMMAND use cv::getBuildInformation() for details" ENDL \
#N": BUILD_COMMAND use cv::getBuildInformation() for details" ENDL

View File

@ -75,6 +75,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
#add_extra_compiler_option(-Wcast-align)
#add_extra_compiler_option(-Wstrict-aliasing=2)
#add_extra_compiler_option(-Wshadow)
add_extra_compiler_option(-Wno-unnamed-type-template-args)
# The -Wno-long-long is required in 64bit systems when including sytem headers.
if(X86_64)

View File

@ -1,6 +1,6 @@
if(ANDROID)
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
ocv_include_directories(${TBB_INCLUDE_DIRS})
include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
add_definitions(-DTBB_USE_GCC_BUILTINS=1 -D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1 -D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
set(HAVE_TBB 1)
@ -10,7 +10,7 @@ elseif(UNIX AND NOT APPLE)
if(TBB_FOUND)
set(HAVE_TBB 1)
if(NOT ${TBB_INCLUDE_DIRS} STREQUAL "")
ocv_include_directories(${TBB_INCLUDE_DIRS})
include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
endif()
link_directories(${TBB_LIBRARY_DIRS})
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${TBB_LIBRARIES})
@ -63,7 +63,7 @@ if(NOT HAVE_TBB)
set(HAVE_TBB 1)
if(NOT "${TBB_INCLUDE_DIRS}" STREQUAL "")
ocv_include_directories("${TBB_INCLUDE_DIRS}")
include_directories(SYSTEM "${TBB_INCLUDE_DIRS}")
endif()
endif(TBB_INCLUDE_DIRS)
endif(NOT HAVE_TBB)