From 3ed99b77009415938856f74815a450c88d9f1825 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Mon, 21 Jan 2013 16:45:35 +0400 Subject: [PATCH] Code review notes applied. Toolchain for arm hardfp added. --- 3rdparty/tbb/CMakeLists.txt | 38 +++++-------------- .../linux/arm-gnueabi-hardfp.toolchain.cmake | 20 ++++++++++ ...ake => arm-gnueabi-softfp.toolchain.cmake} | 4 +- ...e_linux.sh => cmake_arm_gnueabi_hardfp.sh} | 6 +-- .../linux/scripts/cmake_arm_gnueabi_softfp.sh | 8 ++++ 5 files changed, 43 insertions(+), 33 deletions(-) create mode 100644 platforms/linux/arm-gnueabi-hardfp.toolchain.cmake rename platforms/linux/{armlinux.toolchain.cmake => arm-gnueabi-softfp.toolchain.cmake} (75%) rename platforms/linux/scripts/{cmake_linux.sh => cmake_arm_gnueabi_hardfp.sh} (51%) create mode 100755 platforms/linux/scripts/cmake_arm_gnueabi_softfp.sh diff --git a/3rdparty/tbb/CMakeLists.txt b/3rdparty/tbb/CMakeLists.txt index 6c633e9b9c..12224032d5 100644 --- a/3rdparty/tbb/CMakeLists.txt +++ b/3rdparty/tbb/CMakeLists.txt @@ -115,29 +115,16 @@ file(GLOB lib_srcs "${tbb_src_dir}/src/tbb/*.cpp") file(GLOB lib_hdrs "${tbb_src_dir}/src/tbb/*.h") list(APPEND lib_srcs "${tbb_src_dir}/src/rml/client/rml_tbb.cpp") -if (ANDROID) - add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required - -D__TBB_BUILD=1 #required - -D__TBB_SURVIVE_THREAD_SWITCH=0 #no cilk on Android? - -DUSE_PTHREAD #required - -DTBB_USE_GCC_BUILTINS=1 #required - -DTBB_USE_DEBUG=0 #just to be sure - -DTBB_NO_LEGACY=1 #don't need backward compatibility - -DDO_ITT_NOTIFY=0 #it seems that we don't need these notifications on Android - ) -else() - add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=1 #required - -D__TBB_BUILD=1 #required - -D__TBB_SURVIVE_THREAD_SWITCH=1 #cilk - -DUSE_PTHREAD #required - -DTBB_USE_GCC_BUILTINS=1 #required - -DTBB_USE_DEBUG=0 #just to be sure - -DTBB_NO_LEGACY=1 #don't need backward compatibility - -DDO_ITT_NOTIFY=0 #Required +add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required + -D__TBB_BUILD=1 #required + -D__TBB_SURVIVE_THREAD_SWITCH=0 #no cilk on Android? + -DUSE_PTHREAD #required + -DTBB_USE_GCC_BUILTINS=1 #required + -DTBB_USE_DEBUG=0 #just to be sure + -DTBB_NO_LEGACY=1 #don't need backward compatibility + -DDO_ITT_NOTIFY=0 #it seems that we don't need these notifications on Android ) -endif() - if(ANDROID_COMPILER_IS_CLANG) add_definitions(-D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1) ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-prototypes) @@ -155,13 +142,8 @@ 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() +add_library(tbb ${TBB_SOURCE_FILES}) +target_link_libraries(tbb c m dl) ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations) string(REPLACE "-Werror=non-virtual-dtor" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") diff --git a/platforms/linux/arm-gnueabi-hardfp.toolchain.cmake b/platforms/linux/arm-gnueabi-hardfp.toolchain.cmake new file mode 100644 index 0000000000..d1af22234c --- /dev/null +++ b/platforms/linux/arm-gnueabi-hardfp.toolchain.cmake @@ -0,0 +1,20 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR arm) + +set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc-4.6) +set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++-4.6) + +#suppress compiller varning +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi" ) +set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi" ) + +# can be any other plases +set(ARM_LINUX_SYSROOT /usr/arm-linux-gnueabihf CACHE PATH "ARM cross compilation system root") + +set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${ARM_LINUX_SYSROOT}) + +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) + diff --git a/platforms/linux/armlinux.toolchain.cmake b/platforms/linux/arm-gnueabi-softfp.toolchain.cmake similarity index 75% rename from platforms/linux/armlinux.toolchain.cmake rename to platforms/linux/arm-gnueabi-softfp.toolchain.cmake index c2bcaf72be..597f1ec432 100644 --- a/platforms/linux/armlinux.toolchain.cmake +++ b/platforms/linux/arm-gnueabi-softfp.toolchain.cmake @@ -10,9 +10,9 @@ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi" ) # can be any other plases -set(__arm_linux_eabi_root /usr/arm-linux-gnueabi) +set(ARM_LINUX_SYSROOT /usr/arm-linux-gnueabi CACHE PATH "ARM cross compilation system root") -set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${__arm_linux_eabi_root}) +set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${ARM_LINUX_SYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) diff --git a/platforms/linux/scripts/cmake_linux.sh b/platforms/linux/scripts/cmake_arm_gnueabi_hardfp.sh similarity index 51% rename from platforms/linux/scripts/cmake_linux.sh rename to platforms/linux/scripts/cmake_arm_gnueabi_hardfp.sh index c2a8a18b57..9d2732852b 100755 --- a/platforms/linux/scripts/cmake_linux.sh +++ b/platforms/linux/scripts/cmake_arm_gnueabi_hardfp.sh @@ -1,8 +1,8 @@ #!/bin/sh cd `dirname $0`/.. -mkdir -p build -cd build +mkdir -p build_hardfp +cd build_hardfp -cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_TOOLCHAIN_FILE=../armlinux.toolchain.cmake $@ ../../.. +cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi-hardfp.toolchain.cmake $@ ../../.. diff --git a/platforms/linux/scripts/cmake_arm_gnueabi_softfp.sh b/platforms/linux/scripts/cmake_arm_gnueabi_softfp.sh new file mode 100755 index 0000000000..52ff6d22cf --- /dev/null +++ b/platforms/linux/scripts/cmake_arm_gnueabi_softfp.sh @@ -0,0 +1,8 @@ +#!/bin/sh +cd `dirname $0`/.. + +mkdir -p build_softfp +cd build_softfp + +cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi-softfp.toolchain.cmake $@ ../../.. +