2013-01-11 14:50:40 +08:00
|
|
|
set(CMAKE_SYSTEM_NAME Linux)
|
|
|
|
set(CMAKE_SYSTEM_VERSION 1)
|
|
|
|
set(CMAKE_SYSTEM_PROCESSOR arm)
|
|
|
|
|
2013-02-14 19:06:52 +08:00
|
|
|
set(GCC_COMPILER_VERSION "4.6" CACHE STRING "GCC Compiler version")
|
2013-02-06 18:41:58 +08:00
|
|
|
|
2013-02-06 23:18:36 +08:00
|
|
|
set(FLOAT_ABI_SUFFIX "")
|
|
|
|
if (NOT SOFTFP)
|
|
|
|
set(FLOAT_ABI_SUFFIX "hf")
|
|
|
|
endif()
|
|
|
|
|
2015-01-19 15:43:49 +08:00
|
|
|
find_program(CMAKE_C_COMPILER NAMES arm-linux-gnueabi${FLOAT_ABI_SUFFIX}-gcc-${GCC_COMPILER_VERSION})
|
|
|
|
find_program(CMAKE_CXX_COMPILER NAMES arm-linux-gnueabi${FLOAT_ABI_SUFFIX}-g++-${GCC_COMPILER_VERSION})
|
2013-02-06 23:18:36 +08:00
|
|
|
set(ARM_LINUX_SYSROOT /usr/arm-linux-gnueabi${FLOAT_ABI_SUFFIX} CACHE PATH "ARM cross compilation system root")
|
2013-01-11 14:50:40 +08:00
|
|
|
|
2013-01-24 17:29:55 +08:00
|
|
|
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)
|
2013-12-10 15:22:29 +08:00
|
|
|
message(WARNING "You use obsolete variable USE_NEON to enable NEON instruction set. Use -DENABLE_NEON=ON instead." )
|
|
|
|
set(ENABLE_NEON TRUE)
|
2013-01-24 17:29:55 +08:00
|
|
|
elseif(USE_VFPV3)
|
2013-12-10 15:22:29 +08:00
|
|
|
message(WARNING "You use obsolete variable USE_VFPV3 to enable VFPV3 instruction set. Use -DENABLE_VFPV3=ON instead." )
|
|
|
|
set(ENABLE_VFPV3 TRUE)
|
2013-01-24 17:29:55 +08:00
|
|
|
endif()
|
2013-01-11 14:50:40 +08:00
|
|
|
|
2013-01-21 20:45:35 +08:00
|
|
|
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${ARM_LINUX_SYSROOT})
|
2013-01-11 14:50:40 +08:00
|
|
|
|
2013-02-05 20:04:53 +08:00
|
|
|
if(EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
|
|
|
|
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${CUDA_TOOLKIT_ROOT_DIR})
|
|
|
|
endif()
|
|
|
|
|
2013-02-06 23:18:36 +08:00
|
|
|
set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )
|
2013-01-11 14:50:40 +08:00
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
|
|
|
|
2013-02-06 23:18:36 +08:00
|
|
|
# macro to find programs on the host OS
|
|
|
|
macro( find_host_program )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
|
|
|
|
if( CMAKE_HOST_WIN32 )
|
|
|
|
SET( WIN32 1 )
|
|
|
|
SET( UNIX )
|
|
|
|
elseif( CMAKE_HOST_APPLE )
|
|
|
|
SET( APPLE 1 )
|
|
|
|
SET( UNIX )
|
|
|
|
endif()
|
|
|
|
find_program( ${ARGN} )
|
|
|
|
SET( WIN32 )
|
|
|
|
SET( APPLE )
|
|
|
|
SET( UNIX 1 )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
# macro to find packages on the host OS
|
|
|
|
macro( find_host_package )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
|
|
|
|
if( CMAKE_HOST_WIN32 )
|
|
|
|
SET( WIN32 1 )
|
|
|
|
SET( UNIX )
|
|
|
|
elseif( CMAKE_HOST_APPLE )
|
|
|
|
SET( APPLE 1 )
|
|
|
|
SET( UNIX )
|
|
|
|
endif()
|
|
|
|
find_package( ${ARGN} )
|
|
|
|
SET( WIN32 )
|
|
|
|
SET( APPLE )
|
|
|
|
SET( UNIX 1 )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
|
|
|
|
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
|
|
|
|
endmacro()
|