交叉编译Opencv for ARM

时间:2014-06-10 11:59:43

标签: c++ opencv arm

大家好,我正在尝试交叉编译一个使用c ++和opencv for ARM的应用程序。

我从ARM网站上获得了工具链,它适用于没有opencv库的应用程序。

我正在阅读并询问,我发现我必须下载opencv源代码,然后使用我的工具链编译并安装到某处,然后我可以编译我的应用程序。

问题是我从这里获得了opencv源代码" git clone https://github.com/Itseez/opencv.git"下载完成后,我可以看到这个文件:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(GCC_COMPILER_VERSION "4.6" CACHE STRING "GCC Compiler version")

set(FLOAT_ABI_SUFFIX "")

if (NOT SOFTFP)
   set(FLOAT_ABI_SUFFIX "hf")
endif()

set(CMAKE_C_COMPILER    arm-linux-
gnueabi${FLOAT_ABI_SUFFIX}-gcc-${GCC_COMPILER_VERSION})
set(CMAKE_CXX_COMPILER  arm-linux-
gnueabi${FLOAT_ABI_SUFFIX}-g++-${GCC_COMPILER_VERSION})
set(ARM_LINUX_SYSROOT /usr/arm-linux-gnueabi${FLOAT_ABI_SUFFIX} CACHE PATH "ARM cross 
compilation system root")

set(CMAKE_CXX_FLAGS           ""                    CACHE STRING "c++ flags")
set(CMAKE_C_FLAGS             ""                    CACHE STRING "c flags")
set(CMAKE_SHARED_LINKER_FLAGS ""                    CACHE STRING "shared linker flags")
set(CMAKE_MODULE_LINKER_FLAGS ""                    CACHE STRING "module linker flags")
set(CMAKE_EXE_LINKER_FLAGS    "-Wl,-z,nocopyreloc"  CACHE STRING "executable linker 
flags")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthumb -fdata-sections -Wa,--noexecstack 
-fsigned-char -Wno-psabi")
set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -mthumb -fdata-sections -Wa,--noexecstack 
-fsigned-char -Wno-psabi")

set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now ${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS    "-Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now ${CMAKE_EXE_LINKER_FLAGS}")

 if(USE_NEON)
   message(WARNING "You use obsolete variable USE_NEON to enable NEON instruction set. 
 Use -DENABLE_NEON=ON instead." )
   set(ENABLE_NEON TRUE)
 elseif(USE_VFPV3)
   message(WARNING "You use obsolete variable USE_VFPV3 to enable VFPV3 instruction 
 set. Use -DENABLE_VFPV3=ON instead." )
   set(ENABLE_VFPV3 TRUE)
 endif()

 set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${ARM_LINUX_SYSROOT})

 if(EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
     set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CUDA_TOOLKIT_ROOT_DIR})
 endif()

 set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when  
 using      shared libraries." )
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)

我红了,我应该更改此文件以指示我已经在我的计算机中的工具链,我在这里:

 /opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi

然后按照这样做:

 cmake -DSOFTFP=ON  -DCMAKE_TOOLCHAIN_FILE=../opencv/platforms/linux/arm-gnueabi.toolchain.cmake ../opencv    

这就是我拥有上述文件的路径。

我的问题是,如果这是正确的,我应该在上面的文件中做些什么来表明它是我的工具链进行编译?

谢谢你们

0 个答案:

没有答案