Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

[develop] CMAKE version check before dependencies are installed #7553

Merged
merged 7 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/.build_vars
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export LIB_DIR=${EOSIO_INSTALL_DIR}/lib
export DATA_DIR=${EOSIO_INSTALL_DIR}/data

# CMAKE
export CMAKE_REQUIRED_VERSION=$(cat $REPO_ROOT/CMakeLists.txt | grep -E "cmake_minimum_required\([[:blank:]]*VERSION" | tail -1 | sed 's/.*VERSION //g' | cut -d\) -f1 | sed 's/ //g')
NorseGaud marked this conversation as resolved.
Show resolved Hide resolved
export CMAKE_VERSION_MAJOR=3
export CMAKE_VERSION_MINOR=13
export CMAKE_VERSION_PATCH=2
Expand Down
7 changes: 6 additions & 1 deletion scripts/eosio_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ execute cd $REPO_ROOT
ensure-submodules-up-to-date

# Check if cmake already exists
( [[ -z "${CMAKE}" ]] && [[ ! -z $(command -v cmake 2>/dev/null) ]] ) && export CMAKE=$(command -v cmake 2>/dev/null)
( [[ -z "${CMAKE}" ]] && [[ ! -z $(command -v cmake 2>/dev/null) ]] ) && export CMAKE=$(command -v cmake 2>/dev/null) && export CMAKE_CURRENT_VERSION=$($CMAKE --version | grep -E "cmake version[[:blank:]]*" | sed 's/.*cmake version //g')
# If it exists, check that it's > required version
if [[ ! -z $CMAKE_CURRENT_VERSION ]] && [[ $( echo $CURRENT_CMAKE_VERSION | awk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }' ) < $( echo $CMAKE_REQUIRED_VERSION | awk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }' ) ]]; then
echo "${COLOR_YELLOW}The currently installed cmake version ($CMAKE_CURRENT_VERSION) is less than the required version ($CMAKE_REQUIRED_VERSION). We will be installing $CMAKE_VERSION.${COLOR_NC}"
export CMAKE=
fi

# Use existing cmake on system (either global or specific to eosio)
# Setup based on architecture
Expand Down
2 changes: 1 addition & 1 deletion tests/bash-bats/eosio_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TEST_LABEL="[eosio_build]"
run bash -c "printf \"y\ny\ny\nn\nn\n\" | ./${SCRIPT_LOCATION}"
[[ ! -z $(echo "${output}" | grep "Unable to find .* compiler") ]] || exit
fi
fi
fi

cd ./scripts # Also test that we can run the script from a directory other than the root
run bash -c "./eosio_build.sh -y -P"
Expand Down
3 changes: 3 additions & 0 deletions tests/bash-bats/modules/cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ load ../helpers/functions
touch $CMAKE
run bash -c " ./$SCRIPT_LOCATION -y -P"
[[ ! -z $(echo "${output}" | grep "Executing: bash -c ${HOME}/cmake") ]] || exit
export CMAKE_CURRENT_VERSION=3.7.1
run bash -c " ./$SCRIPT_LOCATION -y -P"
[[ ! -z $(echo "${output}" | grep "We will be installing $CMAKE_VERSION") ]] || exit
# Testing for if cmake doesn't exist to be sure it's set properly
export CMAKE=
run bash -c "./$SCRIPT_LOCATION -y -P"
Expand Down