From de4ffb00c303405b1624690ee5b8a1710715c17c Mon Sep 17 00:00:00 2001 From: Mateusz Tabaka Date: Thu, 18 Aug 2022 07:25:56 +0200 Subject: [PATCH] handle tbb library path like .../tbb/lib/intel64/gcc4.8 (#12611) --- scripts/setupvars/setupvars.sh | 44 +++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/scripts/setupvars/setupvars.sh b/scripts/setupvars/setupvars.sh index cd15e2a33d2..21339b55419 100755 --- a/scripts/setupvars/setupvars.sh +++ b/scripts/setupvars/setupvars.sh @@ -45,24 +45,36 @@ if [ -e "$INSTALLDIR/runtime" ]; then if [ -e "$HDDL_UNITE_DIR" ]; then export LD_LIBRARY_PATH=$HDDL_UNITE_DIR/lib:$HDDL_UNITE_DIR/thirdparty/XLink/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} fi -fi -if [ -e "$INSTALLDIR/runtime/3rdparty/tbb" ]; then - if [[ "$OSTYPE" == "darwin"* ]]; then - export DYLD_LIBRARY_PATH=$INSTALLDIR/runtime/3rdparty/tbb/lib:${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH} - fi - export LD_LIBRARY_PATH=$INSTALLDIR/runtime/3rdparty/tbb/lib:${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH} + if [ -e "$INSTALLDIR/runtime/3rdparty/tbb" ]; then + tbb_lib_path=$INSTALLDIR/runtime/3rdparty/tbb/lib + if [ -d $tbb_lib_path/$system_type ]; then + lib_path=$(find $tbb_lib_path/$system_type -name "libtbb*" | sort -r | head -n1) + if [ -n $lib_path ]; then + tbb_lib_path=$(dirname $lib_path) + fi + fi - if [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/TBB" ]; then - export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/TBB - elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/tbb" ]; then - export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/tbb - elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib64/cmake/TBB" ]; then - export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib64/cmake/TBB - elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/cmake" ]; then - export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/cmake - else - echo "TBB_DIR directory is not defined automatically by setupvars.sh. Please, set it manually to point to TBBConfig.cmake" + if ls $tbb_lib_path/libtbb* >/dev/null 2>&1; then + if [[ "$OSTYPE" == "darwin"* ]]; then + export DYLD_LIBRARY_PATH=$tbb_lib_path:${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH} + fi + export LD_LIBRARY_PATH=$tbb_lib_path:${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH} + else + echo "[setupvars.sh] WARNING: Directory with TBB libraries is not detected. Please, add TBB libraries to LD_LIBRARY_PATH / DYLD_LIBRARY_PATH manually" + fi + + if [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/TBB" ]; then + export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/TBB + elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/tbb" ]; then + export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/tbb + elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib64/cmake/TBB" ]; then + export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib64/cmake/TBB + elif [ -e "$INSTALLDIR/runtime/3rdparty/tbb/cmake" ]; then + export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/cmake + else + echo "[setupvars.sh] WARNING: TBB_DIR directory is not defined automatically by setupvars.sh. Please, set it manually to point to TBBConfig.cmake" + fi fi fi