Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
af80ff94
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
af80ff94
编写于
5月 02, 2017
作者:
L
Liu Yiqun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow the case user sets CMAKE_C_COMPILER directly instead of standalone toolchain.
上级
39f9056c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
58 addition
and
35 deletion
+58
-35
cmake/cross_compiling/android.cmake
cmake/cross_compiling/android.cmake
+58
-35
未找到文件。
cmake/cross_compiling/android.cmake
浏览文件 @
af80ff94
...
...
@@ -41,7 +41,8 @@ IF(NOT DEFINED ANDROID_STANDALONE_TOOLCHAIN)
CACHE PATH
"Folder holds the standalone toolchain of Android NDK"
)
ENDIF
()
IF
(
NOT ANDROID_STANDALONE_TOOLCHAIN
)
MESSAGE
(
FATAL_ERROR
"Set ANDROID_STANDALONE_TOOLCHAIN to use a standalone toolchain.
\n
"
MESSAGE
(
WARNING
"It is recommened to set ANDROID_STANDALONE_TOOLCHAIN to "
"use a standalone toolchain.
\n
"
"To cross-compile for Android, you need to:
\n
"
"1. Download an Android NDK from"
" https://developer.android.com/ndk/downloads/index.html
\n
"
...
...
@@ -65,11 +66,6 @@ ENDIF()
IF
(
NOT DEFINED ANDROID_ARM_MODE
)
SET
(
ANDROID_ARM_MODE ON
)
ENDIF
()
IF
(
NOT DEFINED ANDROID_ARM_NEON
)
SET
(
ANDROID_ARM_NEON ON
)
ENDIF
()
IF
(
NOT ANDROID_ARM_MODE OR ANDROID_ARM_MODE STREQUAL
"thumb"
)
SET
(
ANDROID_ARM_MODE OFF
)
SET
(
ANDROID_ARM_MODE_NAME
"thumb"
)
...
...
@@ -78,6 +74,10 @@ ELSEIF(ANDROID_ARM_MODE OR ANDROID_ARM_MODE STREQUAL "arm")
SET
(
ANDROID_ARM_MODE_NAME
"arm"
)
ENDIF
()
IF
(
NOT DEFINED ANDROID_ARM_NEON
)
SET
(
ANDROID_ARM_NEON ON
)
ENDIF
()
IF
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.7.0"
)
IF
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.1.0"
)
SET
(
CMAKE_SYSTEM_NAME
"Linux"
)
...
...
@@ -85,47 +85,70 @@ IF(${CMAKE_VERSION} VERSION_LESS "3.7.0")
MESSAGE
(
WARNING
"It is recommended to use CMake >= 3.7.0 (current version: "
"
${
CMAKE_VERSION
}
), when cross-compiling for Android."
)
SET
(
CMAKE_SYSROOT
"
${
ANDROID_STANDALONE_TOOLCHAIN
}
/sysroot"
)
IF
(
NOT CMAKE_SYSTEM_VERSION
)
SET
(
ANDROID_STANDALONE_TOOLCHAIN_API
""
)
SET
(
ANDROID_API_LEVEL_H_REGEX
"^[
\t
]*#[
\t
]*define[
\t
]+__ANDROID_API__[
\t
]+([0-9]+)"
)
FILE
(
STRINGS
"
${
ANDROID_STANDALONE_TOOLCHAIN
}
/sysroot/usr/include/android/api-level.h"
ANDROID_API_LEVEL_H_CONTENT REGEX
"
${
ANDROID_API_LEVEL_H_REGEX
}
"
)
IF
(
ANDROID_API_LEVEL_H_CONTENT MATCHES
"
${
ANDROID_API_LEVEL_H_REGEX
}
"
)
SET
(
ANDROID_STANDALONE_TOOLCHAIN_API
"
${
CMAKE_MATCH_1
}
"
)
IF
(
ANDROID_STANDALONE_TOOLCHAIN
)
SET
(
CMAKE_SYSROOT
"
${
ANDROID_STANDALONE_TOOLCHAIN
}
/sysroot"
)
IF
(
NOT CMAKE_SYSTEM_VERSION
)
SET
(
ANDROID_STANDALONE_TOOLCHAIN_API
""
)
SET
(
ANDROID_API_LEVEL_H_REGEX
"^[
\t
]*#[
\t
]*define[
\t
]+__ANDROID_API__[
\t
]+([0-9]+)"
)
FILE
(
STRINGS
"
${
ANDROID_STANDALONE_TOOLCHAIN
}
/sysroot/usr/include/android/api-level.h"
ANDROID_API_LEVEL_H_CONTENT REGEX
"
${
ANDROID_API_LEVEL_H_REGEX
}
"
)
IF
(
ANDROID_API_LEVEL_H_CONTENT MATCHES
"
${
ANDROID_API_LEVEL_H_REGEX
}
"
)
SET
(
ANDROID_STANDALONE_TOOLCHAIN_API
"
${
CMAKE_MATCH_1
}
"
)
ENDIF
()
SET
(
CMAKE_SYSTEM_VERSION
${
ANDROID_STANDALONE_TOOLCHAIN_API
}
)
ENDIF
()
SET
(
CMAKE_SYSTEM_VERSION
${
ANDROID_STANDALONE_TOOLCHAIN_API
}
)
ENDIF
()
# Toolchain
SET
(
ANDROID_TOOLCHAIN
"gcc"
)
SET
(
ANDROID_TOOLCHAIN_ROOT
${
ANDROID_STANDALONE_TOOLCHAIN
}
)
IF
(
ANDROID_ABI MATCHES
"^armeabi(-v7a)?$"
)
SET
(
ANDROID_TOOLCHAIN_NAME arm-linux-androideabi
)
IF
(
ANDROID_ABI STREQUAL
"armeabi"
)
SET
(
CMAKE_SYSTEM_PROCESSOR armv5te
)
ELSEIF
(
ANDROID_ABI STREQUAL
"armeabi-v7a"
)
SET
(
CMAKE_SYSTEM_PROCESSOR armv7-a
)
# Toolchain
SET
(
ANDROID_TOOLCHAIN
"gcc"
)
SET
(
ANDROID_TOOLCHAIN_ROOT
${
ANDROID_STANDALONE_TOOLCHAIN
}
)
IF
(
ANDROID_ABI MATCHES
"^armeabi(-v7a)?$"
)
SET
(
ANDROID_TOOLCHAIN_NAME arm-linux-androideabi
)
IF
(
ANDROID_ABI STREQUAL
"armeabi"
)
SET
(
CMAKE_SYSTEM_PROCESSOR armv5te
)
ELSEIF
(
ANDROID_ABI STREQUAL
"armeabi-v7a"
)
SET
(
CMAKE_SYSTEM_PROCESSOR armv7-a
)
ENDIF
()
ENDIF
()
SET
(
ANDROID_TOOLCHAIN_PREFIX
"
${
ANDROID_TOOLCHAIN_ROOT
}
/bin/
${
ANDROID_TOOLCHAIN_NAME
}
-"
)
ENDIF
()
SET
(
ANDROID_TOOLCHAIN_PREFIX
"
${
ANDROID_TOOLCHAIN_ROOT
}
/bin/
${
ANDROID_TOOLCHAIN_NAME
}
-"
)
IF
(
EXISTS
"
${
ANDROID_TOOLCHAIN_PREFIX
}
gcc"
)
SET
(
CMAKE_C_COMPILER
"
${
ANDROID_TOOLCHAIN_PREFIX
}
gcc"
CACHE PATH
"C compiler"
)
# C compiler
IF
(
NOT CMAKE_C_COMPILER
)
SET
(
ANDROID_C_COMPILER
"
${
ANDROID_TOOLCHAIN_PREFIX
}
gcc"
)
ELSE
()
MESSAGE
(
FATAL_ERROR
"Cannot found C compiler:
${
ANDROID_TOOLCHAIN_PREFIX
}
gcc"
)
GET_FILENAME_COMPONENT
(
ANDROID_C_COMPILER_PATH
${
CMAKE_C_COMPILER
}
PROGRAM
)
SET
(
ANDROID_C_COMPILER
${
ANDROID_C_COMPILER_PATH
}
)
ENDIF
()
IF
(
NOT EXISTS
${
ANDROID_C_COMPILER
}
)
MESSAGE
(
FATAL_ERROR
"Cannot found C compiler:
${
ANDROID_C_COMPILER
}
"
)
ENDIF
()
IF
(
EXISTS
"
${
ANDROID_TOOLCHAIN_PREFIX
}
g++"
)
SET
(
CMAKE_CXX_COMPILER
"
${
ANDROID_TOOLCHAIN_PREFIX
}
g++"
CACHE PATH
"CXX compiler"
)
# CXX compiler
IF
(
NOT CMAKE_CXX_COMPILER
)
SET
(
ANDROID_CXX_COMPILER
"
${
ANDROID_TOOLCHAIN_PREFIX
}
g++"
)
ELSE
()
MESSAGE
(
FATAL_ERROR
"Cannot found CXX compiler:
${
ANDROID_TOOLCHAIN_PREFIX
}
g++"
)
GET_FILENAME_COMPONENT
(
ANDROID_CXX_COMPILER_PATH
${
CMAKE_CXX_COMPILER
}
PROGRAM
)
SET
(
ANDROID_CXX_COMPILER
${
ANDROID_CXX_COMPILER_PATH
}
)
ENDIF
()
IF
(
NOT EXISTS
${
ANDROID_CXX_COMPILER
}
)
MESSAGE
(
FATAL_ERROR
"Cannot found CXX compiler:
${
ANDROID_CXX_COMPILER
}
"
)
ENDIF
()
IF
(
EXISTS
"
${
ANDROID_TOOLCHAIN_PREFIX
}
gfortran"
)
SET
(
CMAKE_Fortran_COMPILER
"
${
ANDROID_TOOLCHAIN_PREFIX
}
gfortran"
CACHE PATH
"Fortran compiler"
)
# Fortran compiler
IF
(
NOT CMAKE_Fortran_COMPILER
)
SET
(
ANDROID_Fortran_COMPILER
"
${
ANDROID_TOOLCHAIN_PREFIX
}
gfortran"
)
ELSE
()
GET_FILENAME_COMPONENT
(
ANDROID_Fortran_COMPILER_PATH
${
CMAKE_Fortran_COMPILER
}
)
SET
(
ANDROID_Fortran_COMPILER
${
ANDROID_Fortran_COMPILER_PATH
}
)
ENDIF
()
IF
(
NOT EXISTS
${
ANDROID_Fortran_COMPILER
}
)
SET
(
ANDROID_Fortran_COMPILER
""
)
ENDIF
()
SET
(
CMAKE_C_COMPILER
${
ANDROID_C_COMPILER
}
CACHE PATH
"C compiler"
FORCE
)
SET
(
CMAKE_CXX_COMPILER
${
ANDROID_CXX_COMPILER
}
CACHE PATH
"CXX compiler"
FORCE
)
SET
(
CMAKE_Fortran_COMPILER
${
ANDROID_Fortran_COMPILER
}
CACHE PATH
"Fortran compiler"
FORCE
)
# Toolchain and ABI specific flags.
SET
(
ANDROID_COMPILER_FLAGS
"-ffunction-sections -fdata-sections -finline-limit=64"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录