Allow specifying cmake build directory in the build scripts

Summary: Closes https://github.com/caffe2/caffe2/pull/1496

Reviewed By: pietern

Differential Revision: D6379743

Pulled By: bddppq

fbshipit-source-id: 1cb2238e5708547767729de3ac1d3e1a76ed5ba1
This commit is contained in:
Junjie Bai
2017-11-20 20:19:13 -08:00
committed by Facebook Github Bot
parent 77b78935f2
commit 303ed8af44
7 changed files with 13 additions and 13 deletions

View File

@ -34,7 +34,7 @@ else
exit 1 exit 1
fi fi
# We are going to build the target into build_android. # We are going to build the target into build_android.
BUILD_ROOT=$CAFFE2_ROOT/build_android BUILD_ROOT=${BUILD_ROOT:-"$CAFFE2_ROOT/build_android"}
mkdir -p $BUILD_ROOT mkdir -p $BUILD_ROOT
echo "Build Caffe2 Android into: $BUILD_ROOT" echo "Build Caffe2 Android into: $BUILD_ROOT"
@ -46,7 +46,7 @@ $CAFFE2_ROOT/scripts/build_host_protoc.sh || exit 1
echo "Building caffe2" echo "Building caffe2"
cd $BUILD_ROOT cd $BUILD_ROOT
cmake .. \ cmake "$CAFFE2_ROOT" \
-DCMAKE_TOOLCHAIN_FILE=../third_party/android-cmake/android.toolchain.cmake \ -DCMAKE_TOOLCHAIN_FILE=../third_party/android-cmake/android.toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=../install \ -DCMAKE_INSTALL_PREFIX=../install \
-DANDROID_NDK=$ANDROID_NDK \ -DANDROID_NDK=$ANDROID_NDK \

View File

@ -14,7 +14,7 @@
set -e set -e
CAFFE2_ROOT="$( cd "$(dirname -- "$0")"/.. ; pwd -P)" CAFFE2_ROOT="$( cd "$(dirname -- "$0")"/.. ; pwd -P)"
BUILD_ROOT=$CAFFE2_ROOT/build_host_protoc BUILD_ROOT=${BUILD_ROOT:-"$CAFFE2_ROOT/build_host_protoc"}
mkdir -p $BUILD_ROOT/build mkdir -p $BUILD_ROOT/build
cd $BUILD_ROOT/build cd $BUILD_ROOT/build

View File

@ -17,7 +17,7 @@ BITCODE_FLAGS="-DCMAKE_C_FLAGS=-fembed-bitcode -DCMAKE_CXX_FLAGS=-fembed-bitcode
$CAFFE2_ROOT/scripts/build_host_protoc.sh --other-flags $BITCODE_FLAGS $CAFFE2_ROOT/scripts/build_host_protoc.sh --other-flags $BITCODE_FLAGS
# Now, actually build the iOS target. # Now, actually build the iOS target.
BUILD_ROOT=$CAFFE2_ROOT/build_ios BUILD_ROOT=${BUILD_ROOT:-"$CAFFE2_ROOT/build_ios"}
mkdir -p $BUILD_ROOT mkdir -p $BUILD_ROOT
cd $BUILD_ROOT cd $BUILD_ROOT
@ -71,7 +71,7 @@ fi
CMAKE_ARGS+=("-DCMAKE_C_FLAGS=-fembed-bitcode") CMAKE_ARGS+=("-DCMAKE_C_FLAGS=-fembed-bitcode")
CMAKE_ARGS+=("-DCMAKE_CXX_FLAGS=-fembed-bitcode") CMAKE_ARGS+=("-DCMAKE_CXX_FLAGS=-fembed-bitcode")
cmake .. \ cmake "$CAFFE2_ROOT" \
-DCMAKE_INSTALL_PREFIX=../install \ -DCMAKE_INSTALL_PREFIX=../install \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \ -DBUILD_SHARED_LIBS=OFF \

View File

@ -21,7 +21,7 @@ if [ -n "${USE_HOST_PROTOC:-}" ]; then
fi fi
# We are going to build the target into build. # We are going to build the target into build.
BUILD_ROOT="$CAFFE2_ROOT/build" BUILD_ROOT=${BUILD_ROOT:-"$CAFFE2_ROOT/build"}
mkdir -p "$BUILD_ROOT" mkdir -p "$BUILD_ROOT"
cd "$BUILD_ROOT" cd "$BUILD_ROOT"
echo "Building Caffe2 in: $BUILD_ROOT" echo "Building Caffe2 in: $BUILD_ROOT"
@ -36,7 +36,7 @@ if [ "$(uname)" == 'Darwin' ]; then
fi fi
# Now, actually build the target. # Now, actually build the target.
cmake .. \ cmake "$CAFFE2_ROOT" \
"${CMAKE_ARGS[@]}" \ "${CMAKE_ARGS[@]}" \
"$@" "$@"

View File

@ -9,7 +9,7 @@
CAFFE2_ROOT="$( cd "$(dirname -- "$0")"/.. ; pwd -P)" CAFFE2_ROOT="$( cd "$(dirname -- "$0")"/.. ; pwd -P)"
echo "Caffe2 codebase root is: $CAFFE2_ROOT" echo "Caffe2 codebase root is: $CAFFE2_ROOT"
BUILD_ROOT=$CAFFE2_ROOT/build BUILD_ROOT=${BUILD_ROOT:-"$CAFFE2_ROOT/build"}
mkdir -p $BUILD_ROOT mkdir -p $BUILD_ROOT
echo "Build Caffe2 raspbian into: $BUILD_ROOT" echo "Build Caffe2 raspbian into: $BUILD_ROOT"
@ -34,7 +34,7 @@ cd $BUILD_ROOT
# Note: you can add more dependencies above if you need libraries such as # Note: you can add more dependencies above if you need libraries such as
# leveldb, lmdb, etc. # leveldb, lmdb, etc.
cmake .. \ cmake "$CAFFE2_ROOT" \
-DCMAKE_VERBOSE_MAKEFILE=1 \ -DCMAKE_VERBOSE_MAKEFILE=1 \
-DCAFFE2_CPU_FLAGS="-mfpu=neon -mfloat-abi=hard" \ -DCAFFE2_CPU_FLAGS="-mfpu=neon -mfloat-abi=hard" \
|| exit 1 || exit 1

View File

@ -13,7 +13,7 @@
CAFFE2_ROOT="$( cd "$(dirname -- "$0")"/.. ; pwd -P)" CAFFE2_ROOT="$( cd "$(dirname -- "$0")"/.. ; pwd -P)"
echo "Caffe2 codebase root is: $CAFFE2_ROOT" echo "Caffe2 codebase root is: $CAFFE2_ROOT"
BUILD_ROOT=$CAFFE2_ROOT/build BUILD_ROOT=${BUILD_ROOT:-"$CAFFE2_ROOT/build"}
mkdir -p $BUILD_ROOT mkdir -p $BUILD_ROOT
echo "Build Caffe2 raspbian into: $BUILD_ROOT" echo "Build Caffe2 raspbian into: $BUILD_ROOT"
@ -52,7 +52,7 @@ cd $BUILD_ROOT
# CUDA_USE_STATIC_CUDA_RUNTIME needs to be set to off so that opencv can be # CUDA_USE_STATIC_CUDA_RUNTIME needs to be set to off so that opencv can be
# properly used. Otherwise, opencv will complain that opencv_dep_cudart cannot # properly used. Otherwise, opencv will complain that opencv_dep_cudart cannot
# be found. # be found.
cmake .. -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF \ cmake "$CAFFE2_ROOT" -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF \
|| exit 1 || exit 1
make -j 4 || exit 1 make -j 4 || exit 1

View File

@ -15,7 +15,7 @@ setup_environment(){
CAFFE2_ROOT="$( cd "$(dirname -- "$0")"/.. ; pwd -P)" CAFFE2_ROOT="$( cd "$(dirname -- "$0")"/.. ; pwd -P)"
echo "Caffe2 codebase root is: $CAFFE2_ROOT" echo "Caffe2 codebase root is: $CAFFE2_ROOT"
BUILD_ROOT=$CAFFE2_ROOT/build BUILD_ROOT=${BUILD_ROOT:-"$CAFFE2_ROOT/build"}
mkdir -p $BUILD_ROOT mkdir -p $BUILD_ROOT
echo "Build Caffe2 Tizen into: $BUILD_ROOT" echo "Build Caffe2 Tizen into: $BUILD_ROOT"
} }
@ -109,7 +109,7 @@ cd $BUILD_ROOT
# Note: add more dependencies above if you need libraries such as leveldb, lmdb, etc. # Note: add more dependencies above if you need libraries such as leveldb, lmdb, etc.
# If you have to disable a specific package due to a package absence # If you have to disable a specific package due to a package absence
# from https://git.tizen.org/cgit/, append -Dxxx_xxx=OFF option before executing cmake. # from https://git.tizen.org/cgit/, append -Dxxx_xxx=OFF option before executing cmake.
cmake .. \ cmake "$CAFFE2_ROOT" \
-DCMAKE_VERBOSE_MAKEFILE=1 \ -DCMAKE_VERBOSE_MAKEFILE=1 \
-DUSE_CUDA=OFF \ -DUSE_CUDA=OFF \
-DUSE_OPENCV=OFF \ -DUSE_OPENCV=OFF \