[cmake/android]: add extra flag for android sdk build

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@18 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2015-08-04 03:34:45 +00:00
parent 41575fa420
commit 14a93174a5

View File

@@ -1376,6 +1376,11 @@ if( ANDROID_RELRO )
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now" ) set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now" )
endif() endif()
# ----------------------------------------------------------------------------
# add linker definition for Android SDK build
# ----------------------------------------------------------------------------
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,-dynamic-linker,/system/bin/linker " )
if( ANDROID_COMPILER_IS_CLANG ) if( ANDROID_COMPILER_IS_CLANG )
set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} -Qunused-arguments ${ANDROID_CXX_FLAGS}" ) set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} -Qunused-arguments ${ANDROID_CXX_FLAGS}" )
if( BUILD_WITH_ANDROID_NDK ) if( BUILD_WITH_ANDROID_NDK )
@@ -1383,6 +1388,11 @@ if( ANDROID_COMPILER_IS_CLANG )
endif() endif()
endif() endif()
# ----------------------------------------------------------------------------
# add nostdlib for Android SDK build
# ----------------------------------------------------------------------------
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -nostdlib" )
# cache flags # cache flags
set( CMAKE_CXX_FLAGS "" CACHE STRING "c++ flags" ) set( CMAKE_CXX_FLAGS "" CACHE STRING "c++ flags" )
set( CMAKE_C_FLAGS "" CACHE STRING "c flags" ) set( CMAKE_C_FLAGS "" CACHE STRING "c flags" )
@@ -1449,8 +1459,17 @@ endif()
# global includes and link directories # global includes and link directories
include_directories( SYSTEM "${ANDROID_SYSROOT}/usr/include" ${ANDROID_STL_INCLUDE_DIRS} ) include_directories( SYSTEM "${ANDROID_SYSROOT}/usr/include" ${ANDROID_STL_INCLUDE_DIRS} )
get_filename_component(__android_install_path "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" ABSOLUTE) # avoid CMP0015 policy warning
link_directories( "${__android_install_path}" ) # ----------------------------------------------------------------------------
# comment unused directory detection
# ----------------------------------------------------------------------------
#get_filename_component(__android_install_path "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" ABSOLUTE) # avoid CMP0015 policy warning
#link_directories( "${__android_install_path}" )
# ----------------------------------------------------------------------------
# add sysroot library
# ----------------------------------------------------------------------------
link_directories( "${ANDROID_SYSROOT}/usr/lib" )
# detect if need link crtbegin_so.o explicitly # detect if need link crtbegin_so.o explicitly
if( NOT DEFINED ANDROID_EXPLICIT_CRT_LINK ) if( NOT DEFINED ANDROID_EXPLICIT_CRT_LINK )