mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Ensure CMakeLists.txt and include versions match.
This causes the release script to abort if the Ceres version in the headers, command line, and CMake files don't match. Change-Id: I38c4f1b4ebf3499d2ba4f698fa3f4936538c3de7
This commit is contained in:
+26
-2
@@ -47,11 +47,35 @@ VERSION=$(grep 'SET(CERES_VERSION' CMakeLists.txt | \
|
||||
ABI_VERSION=$(grep 'SET(CERES_ABI_VERSION' CMakeLists.txt | \
|
||||
sed -e 's/SET(CERES_ABI_VERSION //' | \
|
||||
sed -e 's/)//')
|
||||
VERSION_IN_HEADER=$(grep '#define CERES_VERSION' include/ceres/ceres.h | \
|
||||
sed -e 's/#define CERES_VERSION //')
|
||||
ABI_VERSION_IN_HEADER=$(grep '#define CERES_ABI_VERSION' \
|
||||
include/ceres/ceres.h | \
|
||||
sed -e 's/#define CERES_ABI_VERSION //')
|
||||
GIT_COMMIT=$(git log -1 HEAD |grep commit)
|
||||
|
||||
if [[ $1 != $VERSION ]] ; then
|
||||
echo "ERROR: Version $1 does not match CERES_VERSION in CMakeLists.txt."
|
||||
echo " which is $VERSION. You may not be in the toplevel source dir."
|
||||
echo "ERROR: Version from the command line $1 does not match CERES_VERSION"
|
||||
echo " in CMakeLists.txt, which is $VERSION. You may not be in the "
|
||||
echo " toplevel source dir."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $VERSION_IN_HEADER != $VERSION ]] ; then
|
||||
echo "ERROR: CERES_VERSION version from include/ceres/ceres.h, which is"
|
||||
echo " $VERSION_IN_HEADER, does not match the ABI version"
|
||||
echo " from the toplevel CMakeLists.txt, which is $ABI_VERSION."
|
||||
echo " You may not be in the toplevel source directory, or the"
|
||||
echo " versions are out of sync."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $ABI_VERSION_IN_HEADER != $ABI_VERSION ]] ; then
|
||||
echo "ERROR: CERES_ABI_VERSION from include/ceres/ceres.h, which is"
|
||||
echo " $ABI_VERSION_IN_HEADER, does not match the ABI version"
|
||||
echo " from the toplevel CMakeLists.txt, which is $ABI_VERSION."
|
||||
echo " You may not be in the toplevel source directory, or the"
|
||||
echo " versions are out of sync."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user