Use folder checksum to determine if CMake needs to be re-run
This commit is contained in:
parent
c64a2f24ba
commit
9b1d307afc
|
@ -2,6 +2,11 @@
|
|||
|
||||
source $(dirname "$0")/Environment.sh
|
||||
|
||||
function get_source_code_checksum {
|
||||
local EXCLUDE='*__pycache__*'
|
||||
find ${LIBCARLA_ROOT_FOLDER}/* \! -path "${EXCLUDE}" -print0 | sha1sum | awk '{print $1}'
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# -- Parse arguments -----------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
@ -146,9 +151,19 @@ function build_libcarla {
|
|||
mkdir -p ${M_BUILD_FOLDER}
|
||||
pushd "${M_BUILD_FOLDER}" >/dev/null
|
||||
|
||||
if [ ! -f "build.ninja" ]; then
|
||||
CHECKSUM_FILE=checksum.txt
|
||||
|
||||
if [ ! -f "${CHECKSUM_FILE}" ] ; then
|
||||
NEEDS_CMAKE=true
|
||||
elif [ "$(cat ${CHECKSUM_FILE})" != "$(get_source_code_checksum)" ] ; then
|
||||
log "Re-running cmake, some files were added or removed."
|
||||
NEEDS_CMAKE=true
|
||||
else
|
||||
NEEDS_CMAKE=false
|
||||
fi
|
||||
|
||||
if ${NEEDS_CMAKE} ; then
|
||||
|
||||
set -e -x
|
||||
cmake \
|
||||
-G "Eclipse CDT4 - Ninja" \
|
||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-$1} \
|
||||
|
@ -160,6 +175,8 @@ set -e -x
|
|||
${CMAKE_EXTRA_OPTIONS} \
|
||||
${CARLA_ROOT_FOLDER}
|
||||
|
||||
get_source_code_checksum > ${CHECKSUM_FILE}
|
||||
|
||||
fi
|
||||
|
||||
ninja
|
||||
|
|
Loading…
Reference in New Issue