diff --git a/README.md b/README.md index d975d3730569dd503b781531a1f2de78de018056..b6ae2beed999d146c64ffc9ee495373d9b77a175 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,24 @@ This project is used to develop the next version deep learning freamwork for mob [Used model in development](https://mms-mis.cdn.bcebos.com/paddle-mobile/models.zip) +## cross-compilation to android + +* NDK is required +* ANDROID_NDK environment variable is required + +```bash +sh build.sh android +``` + +## build for x86 +paddle-mobile is to run on arm platform. x86 only used to test not arm assembly code. So do not recommend compiling x86. + +Now only support osx. + +``` +sh build.sh mac +``` + ## Old Version of Mobile-Deep-Learning The old version of MDL was I moved to here [Mobile-Deep-Learning](https://github.com/allonli/mobile-deep-learning) diff --git a/build.sh b/build.sh index 51ee36401ac8a92ff909884075a7ed862787cb97..dc31f3b47f47975309e46c063bee142d1cc1a14f 100755 --- a/build.sh +++ b/build.sh @@ -1,39 +1,7 @@ -#!/bin/bash - -build_for_linux() { - if [ ! `which brew` ]; then - echo "building failed! homebrew not found, please install homebrew." - return - fi - if [ ! `which cmake` ]; then - echo "installing cmake." - brew install cmake - if [ ! $? ]; then - echo "cmake install failed." - return - fi - fi - PLATFORM="x86" - MODE="Release" - CXX_FLAGS="-std=c++11 -O3 -s" - BUILD_DIR=build/release/"${PLATFORM}" - mkdir -p ${BUILD_DIR}/build - - mkdir -p ${BUILD_DIR}/test - cp -r test/models ${BUILD_DIR}/test/models - - cmake . \ - -B"${BUILD_DIR}" \ - -DCMAKE_BUILD_TYPE="${MODE}" \ - -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" \ - -DIS_MAC=true - - cd ${BUILD_DIR} - make -j 8 -} +#!/usr/bin/env bash build_for_mac() { - if [ ! `which brew` ]; then + if [ ! `which brew` ]; then echo "building failed! homebrew not found, please install homebrew." return fi @@ -65,8 +33,8 @@ build_for_mac() { } build_for_android() { - if [ -z "${NDK_ROOT}" ]; then - echo "NDK_ROOT not found!" + if [ -z "${ANDROID_NDK}" ]; then + echo "ANDROID_NDK not found!" exit -1 fi @@ -148,4 +116,4 @@ else else build_error fi -fi \ No newline at end of file +fi