aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/makefile/build_all_ios.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/contrib/makefile/build_all_ios.sh')
-rwxr-xr-xtensorflow/contrib/makefile/build_all_ios.sh54
1 files changed, 43 insertions, 11 deletions
diff --git a/tensorflow/contrib/makefile/build_all_ios.sh b/tensorflow/contrib/makefile/build_all_ios.sh
index a49bbe4565..988e12b482 100755
--- a/tensorflow/contrib/makefile/build_all_ios.sh
+++ b/tensorflow/contrib/makefile/build_all_ios.sh
@@ -23,14 +23,29 @@ if [[ $(uname) != "Darwin" ]]; then
exit 1
fi
+usage() {
+ echo "Usage: $(basename "$0") [-a:T]"
+ echo "-a [build_arch] build only for specified arch x86_64 [default=all]"
+ echo "-T only build tensorflow (dont download other deps etc)"
+ exit 1
+}
+
+while getopts "a:T" opt_name; do
+ case "$opt_name" in
+ a) BUILD_ARCH="${OPTARG}";;
+ T) ONLY_MAKE_TENSORFLOW="true";;
+ *) usage;;
+ esac
+done
+shift $((OPTIND - 1))
+
+
# Make sure we're in the correct directory, at the root of the source tree.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd ${SCRIPT_DIR}/../../../
-
-# Remove any old files first.
-make -f tensorflow/contrib/makefile/Makefile clean
-rm -rf tensorflow/contrib/makefile/downloads
+source "${SCRIPT_DIR}/build_helper.subr"
+JOB_COUNT="${JOB_COUNT:-$(get_job_count)}"
# Setting a deployment target is required for building with bitcode,
# otherwise linking will fail with:
@@ -41,20 +56,37 @@ if [[ -n MACOSX_DEPLOYMENT_TARGET ]]; then
export MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)
fi
-# Pull down the required versions of the frameworks we need.
-tensorflow/contrib/makefile/download_dependencies.sh
+if [[ "${ONLY_MAKE_TENSORFLOW}" != "true" ]]; then
+ # Remove any old files first.
+ make -f tensorflow/contrib/makefile/Makefile clean
+ rm -rf tensorflow/contrib/makefile/downloads
-# Compile protobuf for the target iOS device architectures.
-tensorflow/contrib/makefile/compile_ios_protobuf.sh
+ # Pull down the required versions of the frameworks we need.
+ tensorflow/contrib/makefile/download_dependencies.sh
+
+ # Compile protobuf for the target iOS device architectures.
+ tensorflow/contrib/makefile/compile_ios_protobuf.sh
+fi
# Compile nsync for the target iOS device architectures.
# Don't use export var=`something` syntax; it swallows the exit status.
HOST_NSYNC_LIB=`tensorflow/contrib/makefile/compile_nsync.sh`
-TARGET_NSYNC_LIB=`tensorflow/contrib/makefile/compile_nsync.sh -t ios`
+if [[ -z "${BUILD_ARCH}" ]]; then
+ # No arch specified so build all architectures
+ TARGET_NSYNC_LIB=`tensorflow/contrib/makefile/compile_nsync.sh -t ios`
+else
+ # arch specified so build just that
+ TARGET_NSYNC_LIB=`tensorflow/contrib/makefile/compile_nsync.sh -t ios -a ${BUILD_ARCH}`
+fi
export HOST_NSYNC_LIB TARGET_NSYNC_LIB
-# Build the iOS TensorFlow libraries.
-tensorflow/contrib/makefile/compile_ios_tensorflow.sh "-O3"
+if [[ -z "${BUILD_ARCH}" ]]; then
+ # build the ios tensorflow libraries.
+ tensorflow/contrib/makefile/compile_ios_tensorflow.sh -f "-O3" -h $HOST_NSYNC_LIB -n $TARGET_NSYNC_LIB
+else
+ # arch specified so build just that
+ tensorflow/contrib/makefile/compile_ios_tensorflow.sh -f "-O3" -a "${BUILD_ARCH}" -h $HOST_NSYNC_LIB -n $TARGET_NSYNC_LIB
+fi
# Creates a static universal library in
# tensorflow/contrib/makefile/gen/lib/libtensorflow-core.a