Created
July 24, 2016 17:47
-
-
Save donglixp/b9fb8b343776d2fb93bddff813ceb180 to your computer and use it in GitHub Desktop.
thpp installation: build.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# | |
# Copyright (c) 2014, Facebook, Inc. | |
# All rights reserved. | |
# | |
# This source code is licensed under the BSD-style license found in the | |
# LICENSE file in the root directory of this source tree. An additional grant | |
# of patent rights can be found in the PATENTS file in the same directory. | |
# | |
# | |
set -o pipefail | |
echo "If you don't have folly or thrift installed, try doing" | |
echo " THPP_NOFB=1 ./build.sh" | |
if [ ! -z "$THPP_NOFB" ]; then | |
FB="-DNO_THRIFT=ON -DNO_FOLLY=ON" | |
fi | |
if [[ ! -r ./Tensor.h ]]; then | |
echo "Please run from the thpp subdirectory." >&2 | |
exit 1 | |
fi | |
if [[ "$OSTYPE" == "linux-gnu" ]]; then | |
SHA="sha1sum" | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
SHA="shasum" | |
fi | |
rm -rf gtest-1.7.0 gtest-1.7.0.zip | |
# curl -JLOk https://googletest.googlecode.com/files/gtest-1.7.0.zip | |
wget https://googletest.googlecode.com/files/gtest-1.7.0.zip | |
if [[ $($SHA -b gtest-1.7.0.zip | cut -d' ' -f1) != \ | |
'f85f6d2481e2c6c4a18539e391aa4ea8ab0394af' ]]; then | |
echo "Invalid gtest-1.7.0.zip file" >&2 | |
exit 1 | |
fi | |
unzip gtest-1.7.0.zip | |
# Build in a separate directory | |
mkdir -p build | |
cd build | |
export CMAKE_LIBRARY_PATH=$(dirname $(which th))/../lib | |
# Configure | |
cmake $FB -DCMAKE_INSTALL_PREFIX:PATH=/afs/inf.ed.ac.uk/user/s14/s1478528/usr -DCMAKE_C_COMPILER=/opt/rh/devtoolset-3/root/usr/bin/gcc -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-3/root/usr/bin/g++ -DGLOG_INCLUDE_DIR=/afs/inf.ed.ac.uk/user/s14/s1478528/usr/include -DGLOG_LIBRARY=/afs/inf.ed.ac.uk/user/s14/s1478528/usr/lib .. | |
# Make | |
make | |
# Run tests | |
ctest | |
# Install | |
make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment