From 603cab73f23819979d867cab7b3284dfc85198fd Mon Sep 17 00:00:00 2001 From: Gabriel Nuetzi Date: Thu, 11 Apr 2019 23:50:13 +0200 Subject: [PATCH] [np] Replaced bash variables. --- clang-formatAll.sh | 12 ++++++------ cmake/parallelmake.sh | 4 ++-- travis/build.sh | 40 ++++++++++++++++++++-------------------- travis/install_dep.sh | 24 ++++++++++++------------ travis/install_linux.sh | 12 ++++++------ travis/install_osx.sh | 12 ++++++------ 6 files changed, 52 insertions(+), 52 deletions(-) diff --git a/clang-formatAll.sh b/clang-formatAll.sh index de59dbfc..6fcfb81a 100755 --- a/clang-formatAll.sh +++ b/clang-formatAll.sh @@ -3,9 +3,9 @@ export APPROXMVBB_REPO_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -find $APPROXMVBB_REPO_DIR/external -type f \( -name "*.hpp" -or -name "*.cpp" -or -name "*.h" -or -name "*.c" \) | xargs clang-format -i -find $APPROXMVBB_REPO_DIR/include -type f \( -name "*.hpp" -or -name "*.cpp" \) | xargs clang-format -i -find $APPROXMVBB_REPO_DIR/src -type f \( -name "*.hpp" -or -name "*.cpp" \) | xargs clang-format -i -find $APPROXMVBB_REPO_DIR/example -type f \( -name "*.hpp" -or -name "*.cpp" \) | xargs clang-format -i -find $APPROXMVBB_REPO_DIR/tests -type f \( -name "*.hpp" -or -name "*.cpp" \) | xargs clang-format -i -find $APPROXMVBB_REPO_DIR/benchmarks -type f \( -name "*.hpp" -or -name "*.cpp" \) | xargs clang-format -i +find ${APPROXMVBB_REPO_DIR}/external -type f \( -name "*.hpp" -or -name "*.cpp" -or -name "*.h" -or -name "*.c" \) | xargs clang-format -i +find ${APPROXMVBB_REPO_DIR}/include -type f \( -name "*.hpp" -or -name "*.cpp" \) | xargs clang-format -i +find ${APPROXMVBB_REPO_DIR}/src -type f \( -name "*.hpp" -or -name "*.cpp" \) | xargs clang-format -i +find ${APPROXMVBB_REPO_DIR}/example -type f \( -name "*.hpp" -or -name "*.cpp" \) | xargs clang-format -i +find ${APPROXMVBB_REPO_DIR}/tests -type f \( -name "*.hpp" -or -name "*.cpp" \) | xargs clang-format -i +find ${APPROXMVBB_REPO_DIR}/benchmarks -type f \( -name "*.hpp" -or -name "*.cpp" \) | xargs clang-format -i diff --git a/cmake/parallelmake.sh b/cmake/parallelmake.sh index a7144714..bc1f73e3 100644 --- a/cmake/parallelmake.sh +++ b/cmake/parallelmake.sh @@ -1,5 +1,5 @@ #!/bin/bash cores=$(grep -c ^processor /proc/cpuinfo) -echo "Building with $cores cores!" -make -j$cores "$@" +echo "Building with ${cores} cores!" +make -j${cores} "$@" exit \ No newline at end of file diff --git a/travis/build.sh b/travis/build.sh index 2505f005..d0380f7a 100644 --- a/travis/build.sh +++ b/travis/build.sh @@ -4,32 +4,32 @@ set -e -echo "On branch: $branchName" +echo "On branch: ${branchName}" # Check if we build the project -if [ "$BUILD_APPROXMVBB" == "OFF" ]; then +if [ "${BUILD_APPROXMVBB}" == "OFF" ]; then echo "Do not build ApproxMVBB!" return fi -cd $ROOT_PATH +cd ${ROOT_PATH} export CXX_FLAGS="-std=c++11" export CXX_LINKER_FLAGS="" -if [ -z "$BUILD_TYPE" ]; then export BUILD_TYPE=Release; fi +if [ -z "${BUILD_TYPE}" ]; then export BUILD_TYPE=Release; fi # make ApproxMVBB echo "Build ApproxMVBB:" -cd $CHECKOUT_PATH +cd ${CHECKOUT_PATH} ### init submodules #git submodule init #git submodule update ## only for hig perf. tests ##- cd addtional/tests/files; cat Lucy* | tar xz -if [ ! -d $ROOT_PATH/build ]; then mkdir $ROOT_PATH/build; fi -cd $ROOT_PATH/build -cmake $CHECKOUT_PATH -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ +if [ ! -d ${ROOT_PATH}/build ]; then mkdir ${ROOT_PATH}/build; fi +cd ${ROOT_PATH}/build +cmake ${CHECKOUT_PATH} -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DCMAKE_VERBOSE_MAKEFILE=ON \ -ApproxMVBB_USE_OPENMP=OFF \ -DApproxMVBB_FORCE_MSGLOG_LEVEL=2 @@ -39,28 +39,28 @@ cat ./CMakeCache.txt | grep "ApproxMVBB_" make VERBOSE=1 make install -cd $ROOT_PATH +cd ${ROOT_PATH} -if [[ $branchName == "unitTests" ]]; then +if [[ ${branchName} == "unitTests" ]]; then echo "ApproxMVBB: Run unit tests!" - cd $ROOT_PATH/build + cd ${ROOT_PATH}/build make build_and_test else # make install and library usage! echo "Install and test if ApproxMVBB links:" - mkdir $ROOT_PATH/buildLibUsage - cd $ROOT_PATH/buildLibUsage - INSTALL="$ROOT_PATH/build/install/share/ApproxMVBB/cmake" - echo "Install dir= $INSTALL" - cmake $CHECKOUT_PATH/example/libraryUsage -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" \ - -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + mkdir ${ROOT_PATH}/buildLibUsage + cd ${ROOT_PATH}/buildLibUsage + INSTALL="${ROOT_PATH}/build/install/share/ApproxMVBB/cmake" + echo "Install dir= ${INSTALL}" + cmake ${CHECKOUT_PATH}/example/libraryUsage -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DCMAKE_VERBOSE_MAKEFILE=ON \ - -DApproxMVBB_DIR=$INSTALL + -DApproxMVBB_DIR=${INSTALL} make VERBOSE=1 - cd $ROOT_PATH + cd ${ROOT_PATH} fi diff --git a/travis/install_dep.sh b/travis/install_dep.sh index fc71fd34..3707d210 100644 --- a/travis/install_dep.sh +++ b/travis/install_dep.sh @@ -2,12 +2,12 @@ set -e # exit on errors -cd $ROOT_PATH +cd ${ROOT_PATH} -export APPROXMVBB_CACHE_SIGNATURE_FILE="$APPROXMVBB_CACHE_DIR/APPROXMVBB_DEPS_CACHE_SUCCESSFUL" +export APPROXMVBB_CACHE_SIGNATURE_FILE="${APPROXMVBB_CACHE_DIR}/APPROXMVBB_DEPS_CACHE_SUCCESSFUL" # Build the cache only -if [ ! -f "$APPROXMVBB_CACHE_SIGNATURE_FILE" ] ; then +if [ ! -f "${APPROXMVBB_CACHE_SIGNATURE_FILE}" ] ; then echo "ApproxMVBB Build: Build only dependencies! and CACHE them" @@ -18,13 +18,13 @@ if [ ! -f "$APPROXMVBB_CACHE_SIGNATURE_FILE" ] ; then cd ${ROOT_PATH}/eigen3 && hg update 3.3 mkdir ${ROOT_PATH}/eigen3Build cd ${ROOT_PATH}/eigen3Build - export EIGEN_ROOT_DIR=$INSTALL_PREFIX/include/eigen3 # no idea why this is needed? - cmake ../eigen3 -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" + export EIGEN_ROOT_DIR=${INSTALL_PREFIX}/include/eigen3 # no idea why this is needed? + cmake ../eigen3 -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" sudo make VERBOSE=1 install # Install meta ========================================================= git clone https://github.com/ericniebler/meta.git ${ROOT_PATH}/meta - sudo cp -r ${ROOT_PATH}/meta/include/* $INSTALL_PREFIX/include/ + sudo cp -r ${ROOT_PATH}/meta/include/* ${INSTALL_PREFIX}/include/ #ls -a /usr/local/include/meta # Install pugixml ===================================================== @@ -32,18 +32,18 @@ if [ ! -f "$APPROXMVBB_CACHE_SIGNATURE_FILE" ] ; then perl -pi -e 's/\/\/\s*#define\s*PUGIXML_HAS_LONG_LONG/#define PUGIXML_HAS_LONG_LONG/g' ${ROOT_PATH}/pugixml/src/pugiconfig.hpp mkdir ${ROOT_PATH}/pugixmlBuild cd ${ROOT_PATH}/pugixmlBuild - cmake ../pugixml -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" + cmake ../pugixml -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" sudo make VERBOSE=1 install - echo "successful" | sudo tee -a $APPROXMVBB_CACHE_SIGNATURE_FILE > /dev/null - echo "content in $APPROXMVBB_CACHE_DIR :" - ls -al $APPROXMVBB_CACHE_DIR + echo "successful" | sudo tee -a ${APPROXMVBB_CACHE_SIGNATURE_FILE} > /dev/null + echo "content in ${APPROXMVBB_CACHE_DIR} :" + ls -al ${APPROXMVBB_CACHE_DIR} else echo "ApproxMVBB Build: Use cached dependencies..." - echo "content in $APPROXMVBB_CACHE_DIR :" - ls -al $APPROXMVBB_CACHE_DIR/{bin,include,lib,share} + echo "content in ${APPROXMVBB_CACHE_DIR} :" + ls -al ${APPROXMVBB_CACHE_DIR}/{bin,include,lib,share} export BUILD_APPROXMVBB="ON" fi diff --git a/travis/install_linux.sh b/travis/install_linux.sh index 98866917..ecebb705 100644 --- a/travis/install_linux.sh +++ b/travis/install_linux.sh @@ -4,15 +4,15 @@ set -e # exit on error # "DEPENDECIES ========================================================================" -export INSTALL_PREFIX="$APPROXMVBB_CACHE_DIR" -export PATH="$INSTALL_PREFIX/bin:/usr/local/bin:$PATH" +export INSTALL_PREFIX="${APPROXMVBB_CACHE_DIR}" +export PATH="${INSTALL_PREFIX}/bin:/usr/local/bin:${PATH}" -cd $ROOT_PATH +cd ${ROOT_PATH} if [ -n "${GCC_VERSION}" ]; then # https://stackoverflow.com/questions/37603238/fsanitize-not-using-gold-linker-in-gcc-6-1 export CPPFLAGS="-fuse-ld=gold" - export CXXFLAGS="$CPPFLAGS" + export CXXFLAGS="${CPPFLAGS}" export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi if [ -n "${CLANG_VERSION}" ]; then @@ -28,9 +28,9 @@ cmake --version echo "cmake at $(which cmake)" -chmod +x $CHECKOUT_PATH/travis/install_dep.sh +chmod +x ${CHECKOUT_PATH}/travis/install_dep.sh # run the command in this process -> env varibales! -. $CHECKOUT_PATH/travis/install_dep.sh +. ${CHECKOUT_PATH}/travis/install_dep.sh # "DEPENDECIES COMPLETE =================================================================" set +e # exit on errors off \ No newline at end of file diff --git a/travis/install_osx.sh b/travis/install_osx.sh index 75021b7d..87d29dbb 100644 --- a/travis/install_osx.sh +++ b/travis/install_osx.sh @@ -4,11 +4,11 @@ set -e # exit on errors # "DEPENDECIES ========================================================================" -cd $ROOT_PATH +cd ${ROOT_PATH} #install prefix and path -export INSTALL_PREFIX="$APPROXMVBB_CACHE_DIR" -export PATH="$INSTALL_PREFIX/bin:$PATH" +export INSTALL_PREFIX="${APPROXMVBB_CACHE_DIR}" +export PATH="${INSTALL_PREFIX}/bin:${PATH}" brew update brew tap homebrew/versions @@ -20,7 +20,7 @@ brew link --overwrite gcc if [[ ${APPLE_CLANG} != "YES" ]]; then brew install llvm brew link --overwrite llvm - export PATH="/usr/local/opt/llvm/bin:$PATH" + export PATH="/usr/local/opt/llvm/bin:${PATH}" fi # Cmake @@ -35,8 +35,8 @@ echo "CC set to ${CC}" ${CXX} --version cmake --version -chmod +x $CHECKOUT_PATH/travis/install_dep.sh -. $CHECKOUT_PATH/travis/install_dep.sh +chmod +x ${CHECKOUT_PATH}/travis/install_dep.sh +. ${CHECKOUT_PATH}/travis/install_dep.sh # "DEPENDECIES COMPLETE ================================================================="