diff --git a/install_wolf.sh b/install_wolf.sh index 1ee168ae205f2ff7855f442664a448a98335a1ea..0c5325c0d4e7879ee4dd4e9afa9e4dc5db69673e 100755 --- a/install_wolf.sh +++ b/install_wolf.sh @@ -83,8 +83,9 @@ INSTALL_FALKO="undefined" INSTALL_CSM="undefined" DEPS_PATH="undefined" WOLF_PATH="undefined" +WOLF_BRANCH="main" -while getopts "ap:d:w:hf:c:" opt; do +while getopts "ap:d:w:hf:c:b:" opt; do case ${opt} in a) # install all plugins if [ "$INSTALL_PLUGINS" != "" ]; then @@ -151,6 +152,10 @@ while getopts "ap:d:w:hf:c:" opt; do exit 1 fi ;; + b) # branch to clone + WOLF_BRANCH=$OPTARG + func_echo "Set wolf branch: ${WOLF_BRANCH}" + ;; h ) # help usage exit 0 @@ -215,8 +220,19 @@ fi # ceres func_echo "Installing ceres 2.0 via source..." cd $DEPS_PATH -git clone --depth 1 -b 2.0.0 https://ceres-solver.googlesource.com/ceres-solver -cd ceres-solver + +FOLDER_NAME="ceres-solver" +if [ ! -d $FOLDER_NAME ]; +then + git clone --depth 1 -b 2.0.0 https://ceres-solver.googlesource.com/ceres-solver + cd $FOLDER_NAME +else + cd $FOLDER_NAME + git fetch --all + git checkout 2.0.0 + git pull +fi + mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=Release .. make -j$CORES @@ -226,8 +242,19 @@ func_make_install # spdlog func_echo "Installing spdlog 0.17 via source..." cd $DEPS_PATH -git clone --depth 1 -b v0.17.0 https://github.com/gabime/spdlog.git -cd spdlog + +FOLDER_NAME="spdlog" +if [ ! -d $FOLDER_NAME ]; +then + git clone --depth 1 -b v0.17.0 https://github.com/gabime/spdlog.git + cd $FOLDER_NAME +else + cd $FOLDER_NAME + git fetch --all + git checkout v0.17.0 + git pull +fi + mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -fPIC" .. make -j$CORES @@ -255,8 +282,18 @@ func_echo "wolf folder path: $WOLF_PATH" # CORE ----------------------------------------------------- func_echo "Cloning wolf core..." cd $WOLF_PATH -git clone -b main https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/wolf.git -cd wolf + +FOLDER_NAME="wolf" +if [ ! -d $FOLDER_NAME ]; +then + git clone -b $WOLF_BRANCH https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/wolf.git + cd $FOLDER_NAME +else + cd $FOLDER_NAME + git fetch --all + git checkout $WOLF_BRANCH + git pull +fi func_echo "Compiling wolf core..." mkdir -p build && cd build @@ -284,8 +321,18 @@ if [ $INSTALL_IMU == "y" ]; then func_echo "Cloning plugin imu..." cd $WOLF_PATH - git clone -b main https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/imu.git - cd imu + + FOLDER_NAME="imu" + if [ ! -d $FOLDER_NAME ]; + then + git clone -b $WOLF_BRANCH https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/imu.git + cd $FOLDER_NAME + else + cd $FOLDER_NAME + git fetch --all + git checkout $WOLF_BRANCH + git pull + fi func_echo "Compiling plugin imu..." mkdir -p build && cd build @@ -315,8 +362,17 @@ if [ $INSTALL_GNSS == "y" ]; then func_echo "Installing plugin gnss dependencies..." cd $DEPS_PATH - git clone https://gitlab.iri.upc.edu/mobile_robotics/gauss_project/gnss_utils.git - cd gnss_utils + + FOLDER_NAME="gnss_utils" + if [ ! -d $FOLDER_NAME ]; + then + git clone https://gitlab.iri.upc.edu/mobile_robotics/gauss_project/gnss_utils.git + cd $FOLDER_NAME + else + cd $FOLDER_NAME + git pull + fi + git submodule update --init mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DEMOS=ON -DBUILD_TESTS=ON .. @@ -326,8 +382,18 @@ if [ $INSTALL_GNSS == "y" ]; then func_echo "Cloning plugin gnss..." cd $WOLF_PATH - git clone -b main https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/gnss.git - cd gnss + + FOLDER_NAME="gnss" + if [ ! -d $FOLDER_NAME ]; + then + git clone -b $WOLF_BRANCH https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/gnss.git + cd $FOLDER_NAME + else + cd $FOLDER_NAME + git fetch --all + git checkout $WOLF_BRANCH + git pull + fi func_echo "Compiling plugin gnss..." mkdir -p build && cd build @@ -376,8 +442,17 @@ if [ $INSTALL_LASER == "y" ]; then sudo apt install -y libgsl-dev fi cd $DEPS_PATH - git clone https://gitlab.iri.upc.edu/labrobotica/algorithms/csm.git - cd csm + + FOLDER_NAME="csm" + if [ ! -d $FOLDER_NAME ]; + then + git clone https://gitlab.iri.upc.edu/labrobotica/algorithms/csm.git + cd $FOLDER_NAME + else + cd $FOLDER_NAME + git pull + fi + mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=Release .. make -j$CORES @@ -398,8 +473,17 @@ if [ $INSTALL_LASER == "y" ]; then fi if [ $INSTALL_FALKO == "y" ]; then cd $DEPS_PATH - git clone https://gitlab.iri.upc.edu/labrobotica/algorithms/falkolib.git - cd falkolib + + FOLDER_NAME="falkolib" + if [ ! -d $FOLDER_NAME ]; + then + git clone https://gitlab.iri.upc.edu/labrobotica/algorithms/falkolib.git + cd $FOLDER_NAME + else + cd $FOLDER_NAME + git pull + fi + mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=Release .. make -j$CORES @@ -411,8 +495,17 @@ if [ $INSTALL_LASER == "y" ]; then # LASER_SCAN_UTILS func_echo "Installing laser_scan_utils (required)..." cd $DEPS_PATH - git clone https://gitlab.iri.upc.edu/labrobotica/algorithms/laser_scan_utils.git - cd laser_scan_utils + + FOLDER_NAME="laser_scan_utils" + if [ ! -d $FOLDER_NAME ]; + then + git clone https://gitlab.iri.upc.edu/labrobotica/algorithms/laser_scan_utils.git + cd $FOLDER_NAME + else + cd $FOLDER_NAME + git pull + fi + mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=Release .. make -j$CORES @@ -423,8 +516,18 @@ if [ $INSTALL_LASER == "y" ]; then # PLUGIN func_echo "Cloning plugin laser..." cd $WOLF_PATH - git clone -b main https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/laser.git - cd laser + + FOLDER_NAME="laser" + if [ ! -d $FOLDER_NAME ]; + then + git clone -b $WOLF_BRANCH https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/laser.git + cd $FOLDER_NAME + else + cd $FOLDER_NAME + git fetch --all + git checkout $WOLF_BRANCH + git pull + fi func_echo "Compiling plugin laser..." mkdir -p build && cd build @@ -464,8 +567,18 @@ if [ $INSTALL_VISION == "y" ]; then func_echo "Cloning plugin vision..." cd $WOLF_PATH - git clone -b main https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/vision.git - cd vision + + FOLDER_NAME="vision" + if [ ! -d $FOLDER_NAME ]; + then + git clone -b $WOLF_BRANCH https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/vision.git + cd $FOLDER_NAME + else + cd $FOLDER_NAME + git fetch --all + git checkout $WOLF_BRANCH + git pull + fi func_echo "Compiling plugin vision..." mkdir -p build && cd build @@ -497,8 +610,17 @@ if [ $INSTALL_VISION == "y" ]; then func_echo "Installing plugin apriltag dependencies..." cd $DEPS_PATH - git clone https://github.com/AprilRobotics/apriltag apriltaglib - cd apriltaglib + + FOLDER_NAME="apriltaglib" + if [ ! -d $FOLDER_NAME ]; + then + git clone https://github.com/AprilRobotics/apriltag apriltaglib + cd $FOLDER_NAME + else + cd $FOLDER_NAME + git pull + fi + mkdir -p build && cd build cmake -DCMAKE_BUILD_TYPE=Release .. make -j$CORES @@ -507,8 +629,18 @@ if [ $INSTALL_VISION == "y" ]; then func_echo "Cloning plugin apriltag..." cd $WOLF_PATH - git clone -b main https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/apriltag.git - cd apriltag + + FOLDER_NAME="apriltag" + if [ ! -d $FOLDER_NAME ]; + then + git clone -b $WOLF_BRANCH https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/apriltag.git + cd $FOLDER_NAME + else + cd $FOLDER_NAME + git fetch --all + git checkout $WOLF_BRANCH + git pull + fi func_echo "Compiling plugin apriltag..." mkdir -p build && cd build @@ -543,8 +675,18 @@ if [ $INSTALL_IMU == "y" ]; then func_echo "Cloning plugin bodydynamics..." cd $WOLF_PATH - git clone -b main https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/bodydynamics.git - cd bodydynamics + + FOLDER_NAME="bodydynamics" + if [ ! -d $FOLDER_NAME ]; + then + git clone -b $WOLF_BRANCH https://gitlab.iri.upc.edu/mobile_robotics/wolf_projects/wolf_lib/plugins/bodydynamics.git + cd $FOLDER_NAME + else + cd $FOLDER_NAME + git fetch --all + git checkout $WOLF_BRANCH + git pull + fi func_echo "Compiling plugin bodydynamics..." mkdir -p build && cd build