Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
毕竟曾有刹那
Mace
提交
f76207d3
Mace
项目概览
毕竟曾有刹那
/
Mace
与 Fork 源项目一致
Fork自
Xiaomi / Mace
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f76207d3
编写于
9月 16, 2019
作者:
L
liyin
提交者:
叶剑武
10月 28, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Used shared libc library
上级
61c71eaa
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
50 addition
and
198 deletion
+50
-198
third_party/gflags/gflags.cmake
third_party/gflags/gflags.cmake
+1
-2
third_party/protobuf/protobuf.cmake
third_party/protobuf/protobuf.cmake
+1
-1
tools/clear_workspace.sh
tools/clear_workspace.sh
+2
-1
tools/cmake-build-aarch64-linux-gnu-full.sh
tools/cmake-build-aarch64-linux-gnu-full.sh
+0
-19
tools/cmake-build-android-arm64-v8a-cpu.sh
tools/cmake-build-android-arm64-v8a-cpu.sh
+0
-24
tools/cmake-build-android-arm64-v8a-full.sh
tools/cmake-build-android-arm64-v8a-full.sh
+0
-24
tools/cmake-build-android-armeabi-v7a-cpu.sh
tools/cmake-build-android-armeabi-v7a-cpu.sh
+0
-25
tools/cmake-build-android-armeabi-v7a-full.sh
tools/cmake-build-android-armeabi-v7a-full.sh
+0
-25
tools/cmake-build-arm-linux-gnueabihf-full.sh
tools/cmake-build-arm-linux-gnueabihf-full.sh
+0
-19
tools/cmake-build-host.sh
tools/cmake-build-host.sh
+0
-14
tools/cmake-build-standalone-lib.sh
tools/cmake-build-standalone-lib.sh
+0
-24
tools/cmake/cmake-build-arm64-v8a.sh
tools/cmake/cmake-build-arm64-v8a.sh
+1
-1
tools/cmake/cmake-build-armeabi-v7a.sh
tools/cmake/cmake-build-armeabi-v7a.sh
+1
-1
tools/python/run_target.py
tools/python/run_target.py
+1
-1
tools/python/utils/device.py
tools/python/utils/device.py
+43
-17
未找到文件。
third_party/gflags/gflags.cmake
浏览文件 @
f76207d3
...
...
@@ -24,12 +24,11 @@ ExternalProject_Add(
UPDATE_COMMAND
""
BUILD_BYPRODUCTS
${
GFLAGS_LIBRARIES
}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
GFLAGS_INSTALL_DIR
}
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
-DCMAKE_CXX_COMPILER_LAUNCHER=
${
CMAKE_CXX_COMPILER_LAUNCHER
}
-DCMAKE_C_COMPILER_LAUNCHER=
${
CMAKE_C_COMPILER_LAUNCHER
}
-DBUILD_STATIC_LIBS=ON
-DBUILD_TESTING=OFF
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_GENERATOR=
${
CMAKE_GENERATOR
}
${
THIRD_PARTY_EXTRA_CMAKE_ARGS
}
)
...
...
third_party/protobuf/protobuf.cmake
浏览文件 @
f76207d3
...
...
@@ -33,7 +33,7 @@ ExternalProject_Add(
BUILD_BYPRODUCTS
${
PROTOBUF_LITE_LIBRARIES
}
SOURCE_DIR
"
${
PROTOBUF_SRCS_DIR
}
/src/protobuf"
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
../protobuf/cmake/
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
-DCMAKE_BUILD_TYPE=
Release
-DCMAKE_CXX_COMPILER_LAUNCHER=
${
CMAKE_CXX_COMPILER_LAUNCHER
}
-DCMAKE_C_COMPILER_LAUNCHER=
${
CMAKE_C_COMPILER_LAUNCHER
}
-DCMAKE_INSTALL_PREFIX=
${
PROTOBUF_INSTALL_DIR
}
...
...
tools/clear_workspace.sh
浏览文件 @
f76207d3
...
...
@@ -5,7 +5,8 @@ rm -rf mace/codegen/engine
rm
-rf
mace/codegen/opencl
for
d
in
build/
*
;
do
if
[[
"
$d
"
!=
"build/cmake-build*"
]]
;
then
if
[[
"
$d
"
!=
"build/cmake-build"
]]
;
then
echo
"remove
$d
"
rm
-rf
"
$d
"
fi
done
tools/cmake-build-aarch64-linux-gnu-full.sh
已删除
100755 → 0
浏览文件 @
61c71eaa
#!/usr/bin/env sh
set
-e
# build for arm linux aarch64
BUILD_DIR
=
cmake-build/aarch64-linux-gnu-full
rm
-rf
${
BUILD_DIR
}
&&
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DCROSSTOOL_ROOT
=
${
LINARO_AARCH64_LINUX_GNU
}
\
-DCMAKE_TOOLCHAIN_FILE
=
../../cmake/toolchains/aarch64-linux-gnu.cmake
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
ON
\
-DMACE_ENABLE_OPENCL
=
ON
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DCMAKE_INSTALL_PREFIX
=
install
\
../..
make
-j6
VERBOSE
=
1
&&
make
install
cd
../..
tools/cmake-build-android-arm64-v8a-cpu.sh
已删除
100755 → 0
浏览文件 @
61c71eaa
#!/usr/bin/env sh
set
-e
# build for android arm64-v8a
BUILD_DIR
=
cmake-build/android-arm64-v8a-cpu
rm
-rf
${
BUILD_DIR
}
&&
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DANDROID_ABI
=
"arm64-v8a"
\
-DCMAKE_TOOLCHAIN_FILE
=
${
ANDROID_NDK_HOME
}
/build/cmake/android.toolchain.cmake
\
-DANDROID_NATIVE_API_LEVEL
=
14
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DCMAKE_ANDROID_STL_TYPE
=
c++_shared
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
OFF
\
-DMACE_ENABLE_OPENCL
=
OFF
\
-DMACE_ENABLE_HEXAGON_DSP
=
OFF
\
-DMACE_ENABLE_HEXAGON_HTA
=
OFF
\
-DMACE_ENABLE_MTK_APU
=
OFF
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DCMAKE_INSTALL_PREFIX
=
install
\
../..
make
-j6
VERBOSE
=
1
&&
make
install
cd
../..
tools/cmake-build-android-arm64-v8a-full.sh
已删除
100755 → 0
浏览文件 @
61c71eaa
#!/usr/bin/env sh
set
-e
# build for android arm64-v8a
BUILD_DIR
=
cmake-build/android-arm64-v8a-full
rm
-rf
${
BUILD_DIR
}
&&
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DANDROID_ABI
=
"arm64-v8a"
\
-DCMAKE_TOOLCHAIN_FILE
=
${
ANDROID_NDK_HOME
}
/build/cmake/android.toolchain.cmake
\
-DANDROID_NATIVE_API_LEVEL
=
28
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DCMAKE_ANDROID_STL_TYPE
=
c++_shared
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
ON
\
-DMACE_ENABLE_OPENCL
=
ON
\
-DMACE_ENABLE_HEXAGON_DSP
=
ON
\
-DMACE_ENABLE_HEXAGON_HTA
=
OFF
\
-DMACE_ENABLE_MTK_APU
=
ON
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DCMAKE_INSTALL_PREFIX
=
install
\
../..
make
-j6
VERBOSE
=
1
&&
make
install
cd
../..
tools/cmake-build-android-armeabi-v7a-cpu.sh
已删除
100755 → 0
浏览文件 @
61c71eaa
#!/usr/bin/env sh
set
-e
# build for android armeabi-v7a
BUILD_DIR
=
cmake-build/android-armeabi-v7a-cpu
rm
-rf
${
BUILD_DIR
}
&&
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DANDROID_ABI
=
"armeabi-v7a"
\
-DANDROID_ARM_NEON
=
ON
\
-DCMAKE_TOOLCHAIN_FILE
=
${
ANDROID_NDK_HOME
}
/build/cmake/android.toolchain.cmake
\
-DANDROID_NATIVE_API_LEVEL
=
14
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DCMAKE_ANDROID_STL_TYPE
=
c++_shared
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
OFF
\
-DMACE_ENABLE_OPENCL
=
OFF
\
-DMACE_ENABLE_HEXAGON_DSP
=
OFF
\
-DMACE_ENABLE_HEXAGON_HTA
=
OFF
\
-DMACE_ENABLE_MTK_APU
=
OFF
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DCMAKE_INSTALL_PREFIX
=
install
\
../..
make
-j6
VERBOSE
=
1
&&
make
install
cd
../..
tools/cmake-build-android-armeabi-v7a-full.sh
已删除
100755 → 0
浏览文件 @
61c71eaa
#!/usr/bin/env sh
set
-e
# build for android armeabi-v7a
BUILD_DIR
=
cmake-build/android-armeabi-v7a-full
rm
-rf
${
BUILD_DIR
}
&&
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DANDROID_ABI
=
"armeabi-v7a"
\
-DANDROID_ARM_NEON
=
ON
\
-DCMAKE_TOOLCHAIN_FILE
=
${
ANDROID_NDK_HOME
}
/build/cmake/android.toolchain.cmake
\
-DANDROID_NATIVE_API_LEVEL
=
28
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DCMAKE_ANDROID_STL_TYPE
=
c++_shared
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
ON
\
-DMACE_ENABLE_OPENCL
=
ON
\
-DMACE_ENABLE_HEXAGON_DSP
=
ON
\
-DMACE_ENABLE_HEXAGON_HTA
=
OFF
\
-DMACE_ENABLE_MTK_APU
=
OFF
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DCMAKE_INSTALL_PREFIX
=
install
\
../..
make
-j6
VERBOSE
=
1
&&
make
install
cd
../..
tools/cmake-build-arm-linux-gnueabihf-full.sh
已删除
100755 → 0
浏览文件 @
61c71eaa
#!/usr/bin/env sh
set
-e
# build for arm linux gnueabihf
BUILD_DIR
=
cmake-build/arm-linux-gnueabihf-full
rm
-rf
${
BUILD_DIR
}
&&
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DCROSSTOOL_ROOT
=
${
LINARO_ARM_LINUX_GNUEABIHF
}
\
-DCMAKE_TOOLCHAIN_FILE
=
cmake/toolchains/arm-linux-gnueabihf.cmake
\
-DCMAKE_BUILD_TYPE
=
Release
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
ON
\
-DMACE_ENABLE_OPENCL
=
ON
\
-DMACE_ENABLE_OPT_SIZE
=
ON
\
-DMACE_ENABLE_OBFUSCATE
=
ON
\
-DCMAKE_INSTALL_PREFIX
=
install
\
../..
make
-j6
VERBOSE
=
1
&&
make
install
cd
../..
tools/cmake-build-host.sh
已删除
100755 → 0
浏览文件 @
61c71eaa
#!/usr/bin/env sh
set
-e
# build for host
BUILD_DIR
=
cmake-build/host
rm
-rf
${
BUILD_DIR
}
&&
mkdir
-p
${
BUILD_DIR
}
&&
cd
${
BUILD_DIR
}
cmake
-DMACE_ENABLE_NEON
=
OFF
\
-DMACE_ENABLE_QUANTIZE
=
OFF
\
-DMACE_ENABLE_OPENCL
=
ON
\
-DCMAKE_INSTALL_PREFIX
=
install
\
../..
make
-j6
VERBOSE
=
1
&&
make
install
cd
../..
tools/cmake-build-standalone-lib.sh
已删除
100755 → 0
浏览文件 @
61c71eaa
#!/usr/bin/env sh
set
-e
# build for local host
sh tools/cmake-build-host.sh
# Nuild for Android arm64-v8a with NEON
sh tools/cmake-build-android-arm64-v8a-cpu.sh
# Build for Android arm64-v8a with NEON, Quantize, OpenCL, Hexagon HTA, Hexagon DSP
sh tools/cmake-build-android-arm64-v8a-full.sh
# Nuild for Android armeabi-v7a with NEON
sh tools/cmake-build-android-armeabi-v7a-cpu.sh
# Build for Android armeabi-v7a with NEON, Quantize, OpenCL, Hexagon HTA, Hexagon DSP
sh tools/cmake-build-android-armeabi-v7a-full.sh
# Build for arm-linux-gnueabihf with NEON, Quantize, OpenCL
sh tools/cmake-build-arm-linux-gnueabihf-full.sh
# Build for aarch64-linux-gnu with NEON, Quantize, OpenCL
sh tools/cmake-build-aarch64-linux-gnu-full.sh
tools/cmake/cmake-build-arm64-v8a.sh
浏览文件 @
f76207d3
...
...
@@ -31,7 +31,7 @@ cmake -DANDROID_ABI="arm64-v8a" \
-DCMAKE_TOOLCHAIN_FILE
=
${
ANDROID_NDK_HOME
}
/build/cmake/android.toolchain.cmake
\
-DANDROID_NATIVE_API_LEVEL
=
28
\
-DCMAKE_BUILD_TYPE
=
Release
\
-D
CMAKE_ANDROID_STL_TYPE
=
c++_shared
\
-D
ANDROID_STL
=
c++_shared
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
ON
\
-DMACE_ENABLE_OPENCL
=
${
MACE_ENABLE_OPENCL
}
\
...
...
tools/cmake/cmake-build-armeabi-v7a.sh
浏览文件 @
f76207d3
...
...
@@ -33,7 +33,7 @@ cmake -DANDROID_ABI="armeabi-v7a" \
-DCMAKE_TOOLCHAIN_FILE
=
${
ANDROID_NDK_HOME
}
/build/cmake/android.toolchain.cmake
\
-DANDROID_NATIVE_API_LEVEL
=
28
\
-DCMAKE_BUILD_TYPE
=
Release
\
-D
CMAKE_ANDROID_STL_TYPE
=
c++_shared
\
-D
ANDROID_STL
=
c++_shared
\
-DMACE_ENABLE_NEON
=
ON
\
-DMACE_ENABLE_QUANTIZE
=
ON
\
-DMACE_ENABLE_OPENCL
=
${
MACE_ENABLE_OPENCL
}
\
...
...
tools/python/run_target.py
浏览文件 @
f76207d3
...
...
@@ -48,7 +48,7 @@ def run_target(target_abi, install_dir, target_obj, device_ids="all"):
# reinstall target
print
(
"Install target from %s to %s"
%
(
target_obj
.
path
,
install_dir
))
device_target
=
dev
.
install
(
target_obj
,
install_dir
)
device_target
=
dev
.
install
(
target_obj
,
install_dir
,
install_deps
=
True
)
print
(
device_target
)
# run on device
...
...
tools/python/utils/device.py
浏览文件 @
f76207d3
...
...
@@ -16,6 +16,7 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
copy
import
os
import
re
import
subprocess
...
...
@@ -60,10 +61,11 @@ def execute(cmd, verbose=True):
class
Device
(
object
):
def
__init__
(
self
,
device_id
):
def
__init__
(
self
,
device_id
,
target_abi
):
self
.
_device_id
=
device_id
self
.
_target_abi
=
target_abi
def
install
(
self
,
target
,
install_dir
):
def
install
(
self
,
target
,
install_dir
,
install_deps
=
False
):
pass
def
run
(
self
,
target
):
...
...
@@ -80,14 +82,14 @@ class Device(object):
class
HostDevice
(
Device
):
def
__init__
(
self
,
device_id
):
super
(
HostDevice
,
self
).
__init__
(
device_id
)
def
__init__
(
self
,
device_id
,
target_abi
):
super
(
HostDevice
,
self
).
__init__
(
device_id
,
target_abi
)
@
staticmethod
def
list_devices
():
return
[
"host"
]
def
install
(
self
,
target
,
install_dir
):
def
install
(
self
,
target
,
install_dir
,
install_deps
=
False
):
install_dir
=
os
.
path
.
abspath
(
install_dir
)
if
install_dir
.
strip
()
and
install_dir
!=
os
.
path
.
dirname
(
target
.
path
):
...
...
@@ -119,8 +121,8 @@ class HostDevice(Device):
class
AndroidDevice
(
Device
):
def
__init__
(
self
,
device_id
):
super
(
AndroidDevice
,
self
).
__init__
(
device_id
)
def
__init__
(
self
,
device_id
,
target_abi
):
super
(
AndroidDevice
,
self
).
__init__
(
device_id
,
target_abi
)
@
staticmethod
def
list_devices
():
...
...
@@ -134,7 +136,7 @@ class AndroidDevice(Device):
return
devices
def
install
(
self
,
target
,
install_dir
):
def
install
(
self
,
target
,
install_dir
,
install_deps
=
False
):
install_dir
=
os
.
path
.
abspath
(
install_dir
)
sn
=
self
.
_device_id
...
...
@@ -149,12 +151,36 @@ class AndroidDevice(Device):
for
lib
in
target
.
libs
:
execute
(
"adb -s %s push %s %s"
%
(
sn
,
lib
,
install_dir
),
False
)
target
.
path
=
"%s/%s"
%
(
install_dir
,
os
.
path
.
basename
(
target
.
path
))
target
.
libs
=
[
"%s/%s"
%
(
install_dir
,
os
.
path
.
basename
(
lib
))
for
lib
in
target
.
libs
]
target
.
envs
.
append
(
"LD_LIBRARY_PATH=%s"
%
install_dir
)
device_target
=
copy
.
deepcopy
(
target
)
device_target
.
path
=
"%s/%s"
%
(
install_dir
,
os
.
path
.
basename
(
target
.
path
))
device_target
.
libs
=
[
"%s/%s"
%
(
install_dir
,
os
.
path
.
basename
(
lib
))
for
lib
in
target
.
libs
]
device_target
.
envs
.
append
(
"LD_LIBRARY_PATH=%s"
%
install_dir
)
return
target
if
install_deps
:
self
.
install_common_libs_for_target
(
target
,
install_dir
)
return
device_target
def
install_common_libs_for_target
(
self
,
target
,
install_dir
):
sn
=
self
.
_device_id
dep_so_libs
=
execute
(
os
.
environ
[
"ANDROID_NDK_HOME"
]
+
"/ndk-depends "
+
target
.
path
)
lib_file
=
""
for
dep
in
dep_so_libs
.
split
(
"
\n
"
):
if
dep
==
"libgnustl_shared.so"
:
lib_file
=
"%s/sources/cxx-stl/gnu-libstdc++/4.9/libs/"
\
"%s/libgnustl_shared.so"
\
%
(
os
.
environ
[
"ANDROID_NDK_HOME"
],
self
.
_target_abi
)
elif
dep
==
"libc++_shared.so"
:
lib_file
=
"%s/sources/cxx-stl/llvm-libc++/libs/"
\
"%s/libc++_shared.so"
\
%
(
os
.
environ
[
"ANDROID_NDK_HOME"
],
self
.
_target_abi
)
if
lib_file
:
execute
(
"adb -s %s push %s %s"
%
(
sn
,
lib_file
,
install_dir
),
False
)
def
run
(
self
,
target
):
tmpdirname
=
tempfile
.
mkdtemp
()
...
...
@@ -198,8 +224,8 @@ class AndroidDevice(Device):
class
ArmLinuxDevice
(
Device
):
devices
=
{}
def
__init__
(
self
,
device_id
):
super
(
ArmLinuxDevice
,
self
).
__init__
(
device_id
)
def
__init__
(
self
,
device_id
,
target_abi
):
super
(
ArmLinuxDevice
,
self
).
__init__
(
device_id
,
target_abi
)
@
staticmethod
def
list_devices
():
...
...
@@ -215,7 +241,7 @@ class ArmLinuxDevice(Device):
def
set_devices
(
devices
):
ArmLinuxDevice
.
devices
=
devices
def
install
(
self
,
target
,
install_dir
):
def
install
(
self
,
target
,
install_dir
,
install_deps
=
False
):
install_dir
=
os
.
path
.
abspath
(
install_dir
)
ip
=
self
.
_device_id
...
...
@@ -260,7 +286,7 @@ def device_class(target_abi):
def
crete_device
(
target_abi
,
device_id
=
None
):
return
device_class
(
target_abi
)(
device_id
)
return
device_class
(
target_abi
)(
device_id
,
target_abi
)
def
choose_devices
(
target_abi
,
target_ids
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录