Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
977e5afb
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
977e5afb
编写于
6月 04, 2020
作者:
G
Giles Payne
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add handling for Android "NDK (Side by side)"
上级
c3e8a82c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
4 deletion
+35
-4
platforms/android/build_sdk.py
platforms/android/build_sdk.py
+35
-4
未找到文件。
platforms/android/build_sdk.py
浏览文件 @
977e5afb
...
...
@@ -109,6 +109,10 @@ def copytree_smart(src, dst):
shutil
.
copy2
(
s
,
d
)
copy_recurse
(
''
)
def
get_highest_version
(
subdirs
):
return
max
(
subdirs
,
key
=
lambda
dir
:
[
int
(
comp
)
for
comp
in
os
.
path
.
split
(
dir
)[
-
1
].
split
(
'.'
)])
#===================================================================================================
class
ABI
:
...
...
@@ -162,8 +166,8 @@ class Builder:
if
os
.
path
.
exists
(
android_cmake
):
cmake_subdirs
=
[
f
for
f
in
os
.
listdir
(
android_cmake
)
if
check_executable
([
os
.
path
.
join
(
android_cmake
,
f
,
'bin'
,
'cmake'
),
'--version'
])]
if
len
(
cmake_subdirs
)
>
0
:
# there could be more than one -
just take the first one
cmake_from_sdk
=
os
.
path
.
join
(
android_cmake
,
cmake_subdirs
[
0
]
,
'bin'
,
'cmake'
)
# there could be more than one -
get the most recent
cmake_from_sdk
=
os
.
path
.
join
(
android_cmake
,
get_highest_version
(
cmake_subdirs
)
,
'bin'
,
'cmake'
)
log
.
info
(
"Using cmake from Android SDK: %s"
,
cmake_from_sdk
)
return
cmake_from_sdk
raise
Fail
(
"Can't find cmake"
)
...
...
@@ -311,6 +315,22 @@ class Builder:
else
:
shutil
.
move
(
src
,
dst
)
def
get_ndk_dir
():
# look to see if Android NDK is installed
android_sdk_ndk
=
os
.
path
.
join
(
os
.
environ
[
"ANDROID_SDK"
],
'ndk'
)
android_sdk_ndk_bundle
=
os
.
path
.
join
(
os
.
environ
[
"ANDROID_SDK"
],
'ndk-bundle'
)
if
os
.
path
.
exists
(
android_sdk_ndk
):
ndk_subdirs
=
[
f
for
f
in
os
.
listdir
(
android_sdk_ndk
)
if
os
.
path
.
exists
(
os
.
path
.
join
(
android_sdk_ndk
,
f
,
'package.xml'
))]
if
len
(
ndk_subdirs
)
>
0
:
# there could be more than one - get the most recent
ndk_from_sdk
=
os
.
path
.
join
(
android_sdk_ndk
,
get_highest_version
(
ndk_subdirs
))
log
.
info
(
"Using NDK (side-by-side) from Android SDK: %s"
,
ndk_from_sdk
)
return
ndk_from_sdk
if
os
.
path
.
exists
(
os
.
path
.
join
(
android_sdk_ndk_bundle
,
'package.xml'
)):
log
.
info
(
"Using NDK bundle from Android SDK: %s"
,
android_sdk_ndk_bundle
)
return
android_sdk_ndk_bundle
return
None
#===================================================================================================
...
...
@@ -349,12 +369,20 @@ if __name__ == "__main__":
raise
Fail
(
"SDK location not set. Either pass --sdk_path or set ANDROID_SDK environment variable"
)
# look for an NDK installed with the Android SDK
if
not
'ANDROID_NDK'
in
os
.
environ
and
'ANDROID_SDK'
in
os
.
environ
and
os
.
path
.
exists
(
os
.
path
.
join
(
os
.
environ
[
"ANDROID_SDK"
],
'ndk-bundle'
)):
os
.
environ
[
'ANDROID_NDK'
]
=
os
.
path
.
join
(
os
.
environ
[
"ANDROID_SDK"
],
'ndk-bundle'
)
if
not
'ANDROID_NDK'
in
os
.
environ
and
'ANDROID_SDK'
in
os
.
environ
:
sdk_ndk_dir
=
get_ndk_dir
()
if
sdk_ndk_dir
:
os
.
environ
[
'ANDROID_NDK'
]
=
sdk_ndk_dir
if
not
'ANDROID_NDK'
in
os
.
environ
:
raise
Fail
(
"NDK location not set. Either pass --ndk_path or set ANDROID_NDK environment variable"
)
show_samples_build_warning
=
False
#also set ANDROID_NDK_HOME (needed by the gradle build)
if
not
'ANDROID_NDK_HOME'
in
os
.
environ
and
'ANDROID_NDK'
in
os
.
environ
:
os
.
environ
[
'ANDROID_NDK_HOME'
]
=
os
.
environ
[
"ANDROID_NDK"
]
show_samples_build_warning
=
True
if
not
check_executable
([
'ccache'
,
'--version'
]):
log
.
info
(
"ccache not found - disabling ccache support"
)
args
.
no_ccache
=
True
...
...
@@ -411,5 +439,8 @@ if __name__ == "__main__":
log
.
info
(
"====="
)
log
.
info
(
"===== Build finished"
)
log
.
info
(
"====="
)
if
show_samples_build_warning
:
#give a hint how to solve "Gradle sync failed: NDK not configured."
log
.
info
(
"ANDROID_NDK_HOME environment variable required by the samples project is not set"
)
log
.
info
(
"SDK location: %s"
,
builder
.
resultdest
)
log
.
info
(
"Documentation location: %s"
,
builder
.
docdest
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录