未验证 提交 431fc665 编写于 作者: L Liangliang He 提交者: GitHub

Merge pull request #48 from allen0125/suitable_macos

Fix build for Mac
......@@ -13,4 +13,8 @@ build/
docs/_build/
*.a
.vscode/
builds/
mace/examples/android/macelibrary/src/main/cpp/mace/
\.project/
......@@ -5,8 +5,8 @@ set -e -u -o pipefail
pushd ../../../
python tools/converter.py build --config=docs/getting_started/models/demo_app_models.yaml
cp -r build/mobilenet/include/ mace/examples/android/macelibrary/src/main/cpp/
cp -r build/mobilenet/lib/ mace/examples/android/macelibrary/src/main/cpp/
cp -r builds/mobilenet/include/ mace/examples/android/macelibrary/src/main/cpp/
cp -r builds/mobilenet/lib/ mace/examples/android/macelibrary/src/main/cpp/
popd
......
......@@ -35,10 +35,12 @@ from common import mace_check
from common import MaceLogger
from common import StringFormatter
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
################################
# common definitions
################################
BUILD_OUTPUT_DIR = 'build'
BUILD_OUTPUT_DIR = 'builds'
BUILD_DOWNLOADS_DIR = BUILD_OUTPUT_DIR + '/downloads'
PHONE_DATA_DIR = "/data/local/tmp/mace_run"
MODEL_OUTPUT_DIR_NAME = 'model'
......
......@@ -25,6 +25,7 @@ import subprocess
import sys
import time
import urllib
import platform
from enum import Enum
import common
......@@ -1056,10 +1057,15 @@ def merge_libs(target_soc,
mri_stream += "save\n"
mri_stream += "end\n"
which_sys = platform.system()
if which_sys == "Linux":
cmd = sh.Command("%s/toolchains/" % os.environ["ANDROID_NDK_HOME"] +
"aarch64-linux-android-4.9/prebuilt/linux-x86_64/" +
"bin/aarch64-linux-android-ar")
elif which_sys == "Darwin":
cmd = sh.Command("%s/toolchains/" % os.environ["ANDROID_NDK_HOME"] +
"aarch64-linux-android-4.9/prebuilt/darwin-x86_64/" +
"bin/aarch64-linux-android-ar")
cmd("-M", _in=mri_stream)
......@@ -1076,6 +1082,8 @@ def packaging_lib(libmace_output_dir, project_name):
print("Start packaging '%s' libs into %s" % (project_name,
tar_package_path))
which_sys = platform.system()
if which_sys == "Linux":
sh.tar(
"cvzf",
"%s" % tar_package_path,
......@@ -1083,6 +1091,14 @@ def packaging_lib(libmace_output_dir, project_name):
"--exclude",
"%s/_tmp" % project_dir,
_fg=True)
elif which_sys == "Darwin":
sh.tar(
"--exclude",
"%s/_tmp" % project_dir,
"-cvzf",
"%s" % tar_package_path,
glob.glob("%s/*" % project_dir),
_fg=True)
print("Packaging Done!\n")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册