mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
ci: Fix the Visual Studio verification on AppVeyor CI
The Unix paths in Bash do not mix well with the Windows paths in CMake. The uppercase and the lowercase environment variables do not mix well in MSBuild. Et cetera. On AppVeyor CI, verification of Windows builds with the Visual Studio toolchain used to work, perhaps due to one or more lucky coincidences, but it stopped working after an upgrade on the AppVeyor CI site. Update ci_cmake.sh as follows: * Use POSIX commands like "mkdir" and "rm" instead of CMake commands like "make_directory" and "remove_directory". * Avoid using absolute paths in the CMake command line; use relative paths that are accessible from both Bash and Windows. * Clean up incidental mixtures of Windows and Bash-on-Windows environment variables like {$TEMP,$Temp,$temp} and {$TMP,$Tmp,$tmp}.
This commit is contained in:
parent
c3f209178b
commit
c2e2cd2ec5
@ -15,6 +15,8 @@ readonly CI_SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
readonly CI_SRCDIR="$(dirname "$CI_SCRIPTDIR")"
|
||||
readonly CI_BUILDDIR="$CI_SRCDIR/out/cmake.build"
|
||||
readonly CI_INSTALLDIR="$CI_SRCDIR/out/cmake.install"
|
||||
readonly CI_SRCDIR_REL_BUILDDIR="../.."
|
||||
readonly CI_INSTALLDIR_REL_BUILDDIR="../../out/cmake.install"
|
||||
|
||||
function ci_info {
|
||||
printf >&2 "%s: %s\\n" "$CI_SCRIPTNAME" "$*"
|
||||
@ -74,7 +76,6 @@ function ci_build_cmake {
|
||||
[[ $CI_AR ]] && ALL_CMAKE_VARS+=(-DCMAKE_AR="$CI_AR")
|
||||
[[ $CI_RANLIB ]] && ALL_CMAKE_VARS+=(-DCMAKE_RANLIB="$CI_RANLIB")
|
||||
ALL_CMAKE_VARS+=(-DCMAKE_BUILD_TYPE="$CI_CMAKE_BUILD_TYPE")
|
||||
ALL_CMAKE_VARS+=(-DCMAKE_INSTALL_PREFIX="$CI_INSTALLDIR")
|
||||
ALL_CMAKE_VARS+=(-DCMAKE_VERBOSE_MAKEFILE=ON)
|
||||
[[ $CI_NO_TEST ]] && ALL_CMAKE_VARS+=(-DPNG_TESTS=OFF)
|
||||
ALL_CMAKE_VARS+=($CI_CMAKE_VARS)
|
||||
@ -85,12 +86,20 @@ function ci_build_cmake {
|
||||
ci_spawn export CMAKE_GENERATOR="$CI_CMAKE_GENERATOR"
|
||||
[[ $CI_CMAKE_GENERATOR_PLATFORM ]] &&
|
||||
ci_spawn export CMAKE_GENERATOR_PLATFORM="$CI_CMAKE_GENERATOR_PLATFORM"
|
||||
# Fix the build environment, if necessary.
|
||||
[[ $CI_CMAKE_GENERATOR == "Visual Studio "* ]] && {
|
||||
# Clean up incidental mixtures of Windows and Bash-on-Windows
|
||||
# environment variables, to avoid confusing MSBuild.
|
||||
[[ $TEMP && ( $Temp || $temp ) ]] && unset TEMP
|
||||
[[ $TMP && ( $Tmp || $tmp ) ]] && unset TMP
|
||||
}
|
||||
# Build and install.
|
||||
ci_spawn "$CI_CMAKE" -E remove_directory "$CI_BUILDDIR"
|
||||
ci_spawn "$CI_CMAKE" -E remove_directory "$CI_INSTALLDIR"
|
||||
ci_spawn "$CI_CMAKE" -E make_directory "$CI_BUILDDIR"
|
||||
ci_spawn rm -fr "$CI_BUILDDIR" "$CI_INSTALLDIR"
|
||||
ci_spawn mkdir -p "$CI_BUILDDIR"
|
||||
ci_spawn cd "$CI_BUILDDIR"
|
||||
ci_spawn "$CI_CMAKE" "${ALL_CMAKE_VARS[@]}" "$CI_SRCDIR"
|
||||
ci_spawn "$CI_CMAKE" "${ALL_CMAKE_VARS[@]}" \
|
||||
-DCMAKE_INSTALL_PREFIX="$CI_INSTALLDIR_REL_BUILDDIR" \
|
||||
"$CI_SRCDIR_REL_BUILDDIR"
|
||||
ci_spawn "$CI_CMAKE" --build . \
|
||||
--config "$CI_CMAKE_BUILD_TYPE" \
|
||||
"${ALL_CMAKE_BUILD_FLAGS[@]}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user