@@ -322,6 +322,8 @@ _installOrTools() {
322322 os=$1
323323 osVersion=$2
324324 arch=$3
325+ local skipSystemOrTools=$4
326+
325327 orToolsVersionBig=9.11
326328 orToolsVersionSmall=${orToolsVersionBig} .4210
327329
@@ -331,18 +333,20 @@ _installOrTools() {
331333 cd " ${baseDir} "
332334
333335 # Disable exit on error for 'find' command, as it might return non zero
334- set +euo pipefail
335- LIST=($( find /local* /opt* /lib* /usr* /bin* -type f -name " libortools.so*" 2> /dev/null) )
336- # Bring back exit on error
337- set -euo pipefail
338- # Return if right version of or-tools is installed
339- for lib in ${LIST[@]} ; do
340- if [[ " $lib " =~ .* " /libortools.so.${orToolsVersionSmall} " ]]; then
341- echo " OR-Tools is already installed"
342- CMAKE_PACKAGE_ROOT_ARGS+=" -D ortools_ROOT=$( realpath $( dirname $lib ) /..) "
343- return
344- fi
345- done
336+ if [[ " ${skipSystemOrTools} " == " false" ]]; then
337+ set +euo pipefail
338+ LIST=($( find /local* /opt* /lib* /usr* /bin* -type f -name " libortools.so*" 2> /dev/null) )
339+ # Bring back exit on error
340+ set -euo pipefail
341+ # Return if right version of or-tools is installed
342+ for lib in ${LIST[@]} ; do
343+ if [[ " $lib " =~ .* " /libortools.so.${orToolsVersionSmall} " ]]; then
344+ echo " OR-Tools is already installed"
345+ CMAKE_PACKAGE_ROOT_ARGS+=" -D ortools_ROOT=$( realpath $( dirname $lib ) /..) "
346+ return
347+ fi
348+ done
349+ fi
346350
347351 orToolsPath=${PREFIX:- " /opt/or-tools" }
348352 if [ " $( uname -m) " == " aarch64" ]; then
@@ -791,6 +795,11 @@ Usage: $0 -all
791795 # like working around a firewall. This opens
792796 # vulnerability to man-in-the-middle (MITM)
793797 # attacks.
798+ $0 -skip-system-or-tools
799+ # If true, does not perform a search of system
800+ # paths for a pre-installed or-tools library.
801+ # Instead, will install a separate version
802+ # of or-tools
794803 $0 -save-deps-prefixes=FILE
795804 # Dumps OpenROAD build arguments and variables
796805 # to FILE
@@ -813,6 +822,7 @@ equivalenceDeps="no"
813822CI=" no"
814823saveDepsPrefixes=" "
815824numThreads=$( nproc)
825+ skipSystemOrTools=" false"
816826# temp dir to download and compile
817827baseDir=$( mktemp -d /tmp/DependencyInstaller-XXXXXX)
818828
@@ -886,6 +896,9 @@ while [ "$#" -gt 0 ]; do
886896 alias wget=" wget --no-check-certificate"
887897 export GIT_SSL_NO_VERIFY=true
888898 ;;
899+ -skip-system-or-tools)
900+ skipSystemOrTools=" true"
901+ ;;
889902 -save-deps-prefixes=* )
890903 saveDepsPrefixes=$( realpath ${1#* =} )
891904 ;;
@@ -956,7 +969,7 @@ case "${os}" in
956969 else
957970 ubuntuVersion=20.04
958971 fi
959- _installOrTools " ubuntu" " ${ubuntuVersion} " " amd64"
972+ _installOrTools " ubuntu" " ${ubuntuVersion} " " amd64" ${skipSystemOrTools}
960973 fi
961974 ;;
962975 " Red Hat Enterprise Linux" | " Rocky Linux" | " AlmaLinux" )
@@ -982,10 +995,10 @@ case "${os}" in
982995 if [[ " ${option} " == " common" || " ${option} " == " all" ]]; then
983996 _installCommonDev
984997 if [[ " ${rhelVersion} " == " 8" ]]; then
985- _installOrTools " AlmaLinux" " 8.10" " x86_64"
998+ _installOrTools " AlmaLinux" " 8.10" " x86_64" ${skipSystemOrTools}
986999 fi
9871000 if [[ " ${rhelVersion} " == " 9" ]]; then
988- _installOrTools " rockylinux" " 9" " amd64"
1001+ _installOrTools " rockylinux" " 9" " amd64" ${skipSystemOrTools}
9891002 fi
9901003 fi
9911004 ;;
@@ -1012,7 +1025,7 @@ EOF
10121025 fi
10131026 if [[ " ${option} " == " common" || " ${option} " == " all" ]]; then
10141027 _installCommonDev
1015- _installOrTools " opensuse" " leap" " amd64"
1028+ _installOrTools " opensuse" " leap" " amd64" ${skipSystemOrTools}
10161029 fi
10171030 cat << EOF
10181031To enable GCC-11 you need to run:
@@ -1035,7 +1048,7 @@ EOF
10351048 fi
10361049 if [[ " ${option} " == " common" || " ${option} " == " all" ]]; then
10371050 _installCommonDev
1038- _installOrTools " debian" " ${debianVersion} " " amd64"
1051+ _installOrTools " debian" " ${debianVersion} " " amd64" ${skipSystemOrTools}
10391052 fi
10401053 ;;
10411054 * )
0 commit comments