TBB download and build option enabled for non Android platfroms.

This commit is contained in:
Alexander Smorkalov 2013-01-10 17:18:01 +04:00
parent 2e2e1355ac
commit 7882aba7af
3 changed files with 24 additions and 15 deletions

View File

@ -1,8 +1,4 @@
#build TBB for Android from source #build TBB for Android from source
if(NOT ANDROID)
message(FATAL_ERROR "The script is designed for Android only!")
endif()
project(tbb) project(tbb)
# 4.1 update 1 - works fine # 4.1 update 1 - works fine
@ -140,13 +136,26 @@ if(tbb_need_GENERIC_DWORD_LOAD_STORE)
set(tbb_need_GENERIC_DWORD_LOAD_STORE ON PARENT_SCOPE) set(tbb_need_GENERIC_DWORD_LOAD_STORE ON PARENT_SCOPE)
endif() endif()
add_library(tbb STATIC ${lib_srcs} ${lib_hdrs} "${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h" "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}") if (ANDROID)
target_link_libraries(tbb c m dl) set(TBB_SOURCE_FILES ${lib_srcs} ${lib_hdrs} "${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h" "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}")
else()
set(TBB_SOURCE_FILES ${lib_srcs} ${lib_hdrs} "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}")
endif()
if (BUILD_SHARED_LIBS)
add_library(tbb SHARED ${TBB_SOURCE_FILES})
target_link_libraries(tbb c m dl)
else()
add_library(tbb STATIC ${TBB_SOURCE_FILES})
target_link_libraries(tbb c m dl)
endif()
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations) ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations)
string(REPLACE "-Werror=non-virtual-dtor" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") string(REPLACE "-Werror=non-virtual-dtor" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h\"") if(ANDROID)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h\"")
endif()
set_target_properties(tbb set_target_properties(tbb
PROPERTIES OUTPUT_NAME tbb PROPERTIES OUTPUT_NAME tbb

View File

@ -163,13 +163,13 @@ OCV_OPTION(BUILD_ANDROID_SERVICE "Build OpenCV Manager for Google Play" OFF I
OCV_OPTION(BUILD_ANDROID_PACKAGE "Build platform-specific package for Google Play" OFF IF ANDROID ) OCV_OPTION(BUILD_ANDROID_PACKAGE "Build platform-specific package for Google Play" OFF IF ANDROID )
# 3rd party libs # 3rd party libs
OCV_OPTION(BUILD_ZLIB "Build zlib from source" WIN32 OR APPLE OR CARMA ) OCV_OPTION(BUILD_ZLIB "Build zlib from source" WIN32 OR APPLE OR CARMA )
OCV_OPTION(BUILD_TIFF "Build libtiff from source" WIN32 OR ANDROID OR APPLE OR CARMA ) OCV_OPTION(BUILD_TIFF "Build libtiff from source" WIN32 OR ANDROID OR APPLE OR CARMA )
OCV_OPTION(BUILD_JASPER "Build libjasper from source" WIN32 OR ANDROID OR APPLE OR CARMA ) OCV_OPTION(BUILD_JASPER "Build libjasper from source" WIN32 OR ANDROID OR APPLE OR CARMA )
OCV_OPTION(BUILD_JPEG "Build libjpeg from source" WIN32 OR ANDROID OR APPLE OR CARMA ) OCV_OPTION(BUILD_JPEG "Build libjpeg from source" WIN32 OR ANDROID OR APPLE OR CARMA )
OCV_OPTION(BUILD_PNG "Build libpng from source" WIN32 OR ANDROID OR APPLE OR CARMA ) OCV_OPTION(BUILD_PNG "Build libpng from source" WIN32 OR ANDROID OR APPLE OR CARMA )
OCV_OPTION(BUILD_OPENEXR "Build openexr from source" WIN32 OR ANDROID OR APPLE OR CARMA ) OCV_OPTION(BUILD_OPENEXR "Build openexr from source" WIN32 OR ANDROID OR APPLE OR CARMA )
OCV_OPTION(BUILD_TBB "Download and build TBB from source" ANDROID IF CMAKE_COMPILER_IS_GNUCXX )
# OpenCV installation options # OpenCV installation options
# =================================================== # ===================================================

View File

@ -1,4 +1,4 @@
if(ANDROID AND NOT MIPS) if(BUILD_TBB)
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb") add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
include_directories(SYSTEM ${TBB_INCLUDE_DIRS}) include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb) set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)