|
17 | 17 | cd `dirname $0`
|
18 | 18 |
|
19 | 19 | GTEST_PATH=googletest
|
| 20 | +USE_LATEST_GTEST="false" |
20 | 21 |
|
21 |
| -# Use latest Google Test for Ubuntu 20.04 |
22 |
| -# TODO: switch all OS builds to Google Test located in third_party/googletest submodule |
23 |
| -if [ -f /etc/os-release ]; then |
| 22 | +echo "Not an ios build. Check for newer googletest requirement" |
| 23 | +OS_NAME=`uname -s` |
| 24 | + |
| 25 | +#TODO: switch all OS builds to Google Test located in third_party/googletest submodule |
| 26 | +if [[ ${IOS_BUILD} == "NO" ]]; then |
| 27 | +case "$OS_NAME" in |
| 28 | +Darwin) |
| 29 | + mac_os_ver=$(sw_vers -productVersion) |
| 30 | + IFS='.' read -r -a mac_ver_first_octet <<< "$mac_os_ver" |
| 31 | + # Use new Google Test on macOS 11.0 or higher ; old one no longer compiles on 11.0 |
| 32 | + if [[ "$mac_ver_first_octet" -ge 11 ]] ; then |
| 33 | + echo "running on Mac OS 11.0 or higher" |
| 34 | + USE_LATEST_GTEST="true" |
| 35 | + else |
| 36 | + echo "running older MacOS $mac_os_ver" |
| 37 | + fi |
| 38 | + ;; |
| 39 | +Linux) |
24 | 40 | source /etc/os-release
|
| 41 | + echo $VERSION_ID |
25 | 42 | # Use new Google Test on latest Ubuntu 20.04 : old one no longer compiles on 20
|
26 | 43 | if [ "$VERSION_ID" == "20.04" ]; then
|
27 |
| - echo Running on Ubuntu 20.04 |
28 |
| - GTEST_PATH=third_party/googletest |
29 |
| - if [ ! "$(ls -A $GTEST_PATH)" ]; then |
30 |
| - echo Clone googletest from google/googletest:master ... |
31 |
| - git clone https://github.com/google/googletest $GTEST_PATH |
32 |
| - fi |
| 44 | + echo "Running on Ubuntu 20.04" |
| 45 | + USE_LATEST_GTEST="true" |
| 46 | + fi |
| 47 | + ;; |
| 48 | +esac |
| 49 | +fi |
| 50 | + |
| 51 | +if [ "$USE_LATEST_GTEST" == "true" ]; then |
| 52 | + echo "Using latest googletest" |
| 53 | + GTEST_PATH=third_party/googletest |
| 54 | + if [ ! "$(ls -A $GTEST_PATH/CMakeLists.txt)" ]; then |
| 55 | + echo Clone googletest from google/googletest:master ... |
| 56 | + rm -rf ${GTEST_PATH} #delete just if empty directory exists |
| 57 | + git clone https://github.com/google/googletest $GTEST_PATH |
| 58 | + else |
| 59 | + echo "Using existing googletest from thirdparty/" |
33 | 60 | fi
|
| 61 | +else |
| 62 | + echo "Using existing(older) googletest from repo root" |
34 | 63 | fi
|
35 | 64 |
|
36 | 65 | pushd $GTEST_PATH
|
|
0 commit comments