From 41198e09b66bd5f99fcec9fe9f0d562f70559309 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 21 Jan 2026 16:41:42 +0100 Subject: [PATCH] appveyor: simplify job configuration Replace interim knobs with cmake options. Also: - use CMake env `CMAKE_GENERATOR` to select the generator. (with workaround to make it work with CMake <3.15.) - deduct some configuration from the job name. - drop unused test runner logic. - drop obsolete `BUILD_OPT` use. - tidy-up job names and sync them with GHA ones. - add newline between job configurations for readability. Closes #20390 --- appveyor.sh | 89 ++++++++++++--------------------- appveyor.yml | 139 +++++++++++++++++---------------------------------- 2 files changed, 79 insertions(+), 149 deletions(-) diff --git a/appveyor.sh b/appveyor.sh index 732d803d35..0701127c26 100644 --- a/appveyor.sh +++ b/appveyor.sh @@ -28,20 +28,25 @@ set -eux; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o pipefail # build -case "${TARGET:-}" in - *Win32) openssl_suffix='-Win32';; - *) openssl_suffix='-Win64';; -esac +if [ -n "${CMAKE_GENERATOR:-}" ]; then -if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2022' ]; then - openssl_root_win="C:/OpenSSL-v35${openssl_suffix}" - openssl_root="$(cygpath "${openssl_root_win}")" -elif [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2019' ]; then - openssl_root_win="C:/OpenSSL-v30${openssl_suffix}" - openssl_root="$(cygpath "${openssl_root_win}")" -fi + PRJ_CFG='Debug' + [[ "${APPVEYOR_JOB_NAME}" = *'Release'* ]] && PRJ_CFG='Release' + + # Configure OpenSSL + case "${CMAKE_GENERATE:-}" in + *Win32*) openssl_suffix='-Win32';; + *) openssl_suffix='-Win64';; + esac + + if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2022' ]; then + openssl_root_win="C:/OpenSSL-v35${openssl_suffix}" + openssl_root="$(cygpath "${openssl_root_win}")" + elif [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2019' ]; then + openssl_root_win="C:/OpenSSL-v30${openssl_suffix}" + openssl_root="$(cygpath "${openssl_root_win}")" + fi -if [ "${BUILD_SYSTEM}" = 'CMake' ]; then # Install custom cmake version if [ -n "${CMAKE_VERSION:-}" ]; then cmake_ver=$(printf '%02d%02d' \ @@ -64,9 +69,8 @@ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then for _chkprefill in '' ${CHKPREFILL:-}; do options='' [ "${_chkprefill}" = '_chkprefill' ] && options+=' -D_CURL_PREFILL=OFF' - [[ "${TARGET}" = *'ARM64'* ]] && SKIP_RUN='ARM64 architecture' - [ -n "${TOOLSET:-}" ] && options+=" -T ${TOOLSET}" - [ "${OPENSSL}" = 'ON' ] && options+=" -DOPENSSL_ROOT_DIR=${openssl_root_win}" + [[ "${CMAKE_GENERATE:-}" = *'-A ARM64'* ]] && SKIP_RUN='ARM64 architecture' + [[ "${CMAKE_GENERATE:-}" = *'-DCURL_USE_OPENSSL=ON'* ]] && options+=" -DOPENSSL_ROOT_DIR=${openssl_root_win}" if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2013' ]; then mkdir "_bld${_chkprefill}" cd "_bld${_chkprefill}" @@ -75,21 +79,16 @@ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then else options+=" -B _bld${_chkprefill}" options+=' -DCMAKE_VS_GLOBALS=TrackFileAccess=false' - options+=" -DCMAKE_UNITY_BUILD=${UNITY}" + options+=' -DCMAKE_UNITY_BUILD=ON' root='.' fi + # CMAKE_GENERATOR env requires CMake 3.15+, pass it manually to make it work with older versions. # shellcheck disable=SC2086 - time cmake -G "${PRJ_GEN}" ${TARGET} \ - -DCURL_WERROR=ON \ - -DBUILD_SHARED_LIBS="${SHARED}" \ + time cmake -G "${CMAKE_GENERATOR}" \ + -DENABLE_DEBUG=ON -DCURL_WERROR=ON \ -DCURL_STATIC_CRT=ON \ - -DENABLE_DEBUG="${DEBUG}" \ - -DENABLE_UNICODE="${ENABLE_UNICODE}" \ - -DHTTP_ONLY="${HTTP_ONLY}" \ - -DCURL_USE_SCHANNEL="${SCHANNEL}" \ - -DCURL_USE_OPENSSL="${OPENSSL}" \ - -DCURL_USE_LIBPSL=OFF \ - ${CMAKE_OPTIONS:-} \ + -DCURL_USE_SCHANNEL=ON -DCURL_USE_LIBPSL=OFF \ + ${CMAKE_GENERATE:-} \ ${options} \ || { cat "${root}"/_bld/CMakeFiles/CMake* 2>/dev/null; false; } [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2013' ] && cd .. @@ -99,12 +98,11 @@ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then false fi echo 'curl_config.h'; grep -F '#define' _bld/lib/curl_config.h | sort || true - # shellcheck disable=SC2086 - time cmake --build _bld --config "${PRJ_CFG}" --parallel 2 -- ${BUILD_OPT:-} - [ "${SHARED}" = 'ON' ] && PATH="$PWD/_bld/lib/${PRJ_CFG}:$PATH" - [ "${OPENSSL}" = 'ON' ] && { PATH="${openssl_root}:$PATH"; cp "${openssl_root}"/*.dll "_bld/src/${PRJ_CFG}"; } + time cmake --build _bld --config "${PRJ_CFG}" --parallel 2 + [[ "${CMAKE_GENERATE:-}" != *'-DBUILD_SHARED_LIBS=OFF'* ]] && PATH="$PWD/_bld/lib/${PRJ_CFG}:$PATH" + [[ "${CMAKE_GENERATE:-}" = *'-DCURL_USE_OPENSSL=ON'* ]] && { PATH="${openssl_root}:$PATH"; cp "${openssl_root}"/*.dll "_bld/src/${PRJ_CFG}"; } curl="_bld/src/${PRJ_CFG}/curl.exe" -elif [ "${BUILD_SYSTEM}" = 'VisualStudioSolution' ]; then +else ( cd projects/Windows ./generate.bat "${VC_VERSION}" @@ -126,42 +124,19 @@ fi # build tests -if [ "${TFLAGS}" != 'skipall' ] && \ - [ "${BUILD_SYSTEM}" = 'CMake' ]; then +if [ -n "${CMAKE_GENERATOR:-}" ] && [[ "${APPVEYOR_JOB_NAME}" = *'Build-tests'* ]]; then time cmake --build _bld --config "${PRJ_CFG}" --parallel 2 --target testdeps fi -# run tests - -if [ "${TFLAGS}" != 'skipall' ] && \ - [ "${TFLAGS}" != 'skiprun' ]; then - if [ -x "$(cygpath "${SYSTEMROOT}/System32/curl.exe")" ]; then - TFLAGS+=" -ac $(cygpath "${SYSTEMROOT}/System32/curl.exe")" - elif [ -x "$(cygpath 'C:/msys64/usr/bin/curl.exe')" ]; then - TFLAGS+=" -ac $(cygpath 'C:/msys64/usr/bin/curl.exe')" - fi - TFLAGS+=' -j0' - if [ "${BUILD_SYSTEM}" = 'CMake' ]; then - time cmake --build _bld --config "${PRJ_CFG}" --target test-ci - else - ( - TFLAGS="-a -p !flaky -r ${TFLAGS}" - cd _bld/tests - time ./runtests.pl - ) - fi -fi - # build examples -if [ "${EXAMPLES}" = 'ON' ] && \ - [ "${BUILD_SYSTEM}" = 'CMake' ]; then +if [ -n "${CMAKE_GENERATOR:-}" ] && [[ "${APPVEYOR_JOB_NAME}" = *'examples'* ]]; then time cmake --build _bld --config "${PRJ_CFG}" --parallel 2 --target curl-examples-build fi # disk space used du -sh .; echo; du -sh -t 250KB ./* -if [ "${BUILD_SYSTEM}" = 'CMake' ]; then +if [ -n "${CMAKE_GENERATOR:-}" ]; then echo; du -h -t 250KB _bld fi diff --git a/appveyor.yml b/appveyor.yml index 79eb9094b8..2b4ea3a021 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,128 +31,83 @@ version: 7.50.0.{build} environment: - BUILD_SYSTEM: CMake - UNITY: 'ON' - OPENSSL: 'OFF' - SCHANNEL: 'OFF' - ENABLE_UNICODE: 'OFF' - DEBUG: 'ON' - SHARED: 'OFF' - HTTP_ONLY: 'OFF' - TFLAGS: 'skiprun' - EXAMPLES: 'OFF' - CMAKE_OPTIONS: '' - matrix: - - # generated CMake-based Visual Studio builds + # CMake Visual Studio builds - job_name: 'CM VS2022, Release, x64, OpenSSL 3.5, Shared, Build-tests' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' - PRJ_GEN: 'Visual Studio 17 2022' - TARGET: '-A x64' - PRJ_CFG: Release - OPENSSL: 'ON' - SHARED: 'ON' + CMAKE_GENERATOR: 'Visual Studio 17 2022' + CMAKE_GENERATE: '-A x64 -DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON' + - job_name: 'CM VS2022, Release, arm64, Schannel, Static, !DEBUGBUILD, Build-tests' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' - PRJ_GEN: 'Visual Studio 17 2022' - TARGET: '-A ARM64' - PRJ_CFG: Release - SCHANNEL: 'ON' - DEBUG: 'OFF' + CMAKE_GENERATOR: 'Visual Studio 17 2022' + CMAKE_GENERATE: '-A ARM64 -DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=OFF' + - job_name: 'CM VS2010, Debug, x64, Schannel, Shared, Build-tests & examples' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2013' - PRJ_GEN: 'Visual Studio 10 2010' - TARGET: '-A x64' - PRJ_CFG: Debug - SCHANNEL: 'ON' - SHARED: 'ON' - EXAMPLES: 'ON' + CMAKE_GENERATOR: 'Visual Studio 10 2010' + CMAKE_GENERATE: '-A x64' + - job_name: 'CM VS2012, Release, x86, Schannel, Shared, Build-tests' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' - PRJ_GEN: 'Visual Studio 11 2012' - TARGET: '-A Win32' - PRJ_CFG: Release - SCHANNEL: 'ON' - SHARED: 'ON' - - job_name: 'CM VS2013, Debug, x64, Schannel, Shared, Build-only' + CMAKE_GENERATOR: 'Visual Studio 11 2012' + CMAKE_GENERATE: '-A Win32' + + - job_name: 'CM VS2013, Debug, x64, Schannel, Shared' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' CMAKE_VERSION: '3.18.4' - PRJ_GEN: 'Visual Studio 12 2013' - TARGET: '-A x64' - PRJ_CFG: Debug - SCHANNEL: 'ON' - SHARED: 'ON' - TFLAGS: 'skipall' - - job_name: 'CM VS2015, Debug, x64, Schannel, Static, Build-only' + CMAKE_GENERATOR: 'Visual Studio 12 2013' + CMAKE_GENERATE: '-A x64' + + - job_name: 'CM VS2015, Debug, x64, Schannel, Static' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' CMAKE_VERSION: '3.19.8' - PRJ_GEN: 'Visual Studio 14 2015' - TARGET: '-A x64' - PRJ_CFG: Debug - SCHANNEL: 'ON' - TFLAGS: 'skipall' - - job_name: 'CM VS2017, Debug, x64, Schannel, Shared, Build-only' + CMAKE_GENERATOR: 'Visual Studio 14 2015' + CMAKE_GENERATE: '-A x64 -DBUILD_SHARED_LIBS=OFF' + + - job_name: 'CM VS2017, Debug, x64, Schannel, Shared' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2017' CMAKE_VERSION: '3.20.6' - PRJ_GEN: 'Visual Studio 15 2017' - TARGET: '-A x64' - PRJ_CFG: Debug - SCHANNEL: 'ON' - SHARED: 'ON' - TFLAGS: 'skipall' + CMAKE_GENERATOR: 'Visual Studio 15 2017' + CMAKE_GENERATE: '-A x64' + - job_name: 'CM VS2019, Debug, x64, OpenSSL 3.0 + Schannel, Shared, !verbose, Build-tests' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2019' - PRJ_GEN: 'Visual Studio 16 2019' - TARGET: '-A x64' - PRJ_CFG: Debug - OPENSSL: 'ON' - SCHANNEL: 'ON' - SHARED: 'ON' - CMAKE_OPTIONS: '-DCURL_DISABLE_VERBOSE_STRINGS=ON' + CMAKE_GENERATOR: 'Visual Studio 16 2019' + CMAKE_GENERATE: '-A x64 -DCURL_USE_OPENSSL=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON' + - job_name: 'CM VS2022, Debug, x64, OpenSSL 3.5 + Schannel, Static, Unicode, Build-tests & examples, clang-cl' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' - PRJ_GEN: 'Visual Studio 17 2022' - TARGET: '-A x64' - PRJ_CFG: Debug - OPENSSL: 'ON' - SCHANNEL: 'ON' - ENABLE_UNICODE: 'ON' - EXAMPLES: 'ON' - TOOLSET: 'ClangCl' + CMAKE_GENERATOR: 'Visual Studio 17 2022' + CMAKE_GENERATE: '-A x64 -T ClangCl -DBUILD_SHARED_LIBS=OFF -DCURL_USE_OPENSSL=ON -DENABLE_UNICODE=ON' + - job_name: 'CM VS2022, Release, x64, Schannel, Shared, Unicode, !DEBUGBUILD, Build-tests' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' - PRJ_GEN: 'Visual Studio 17 2022' - TARGET: '-A x64' - PRJ_CFG: Release - SCHANNEL: 'ON' + CMAKE_GENERATOR: 'Visual Studio 17 2022' ENABLE_UNICODE: 'ON' - SHARED: 'ON' - DEBUG: 'OFF' - - job_name: 'CM VS2022, Debug, x64, no SSL, Static, Build-tests' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' - PRJ_GEN: 'Visual Studio 17 2022' - TARGET: '-A x64' - PRJ_CFG: Debug - - job_name: 'CM VS2022, Debug, x64, no SSL, Static, HTTP only, Build-tests' - APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' - PRJ_GEN: 'Visual Studio 17 2022' - TARGET: '-A x64' - PRJ_CFG: Debug - HTTP_ONLY: 'ON' + CMAKE_GENERATE: '-A x64 -DENABLE_UNICODE=ON -DENABLE_DEBUG=OFF' - # generated VisualStudioSolution-based builds + - job_name: 'CM VS2022, Debug, x64, !ssl, Static, Build-tests' + APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' + CMAKE_GENERATOR: 'Visual Studio 17 2022' + CMAKE_GENERATE: '-A x64 -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=OFF' - - job_name: 'VisualStudioSolution VS2010, Release, x86, Schannel, Build-only' + - job_name: 'CM VS2022, Debug, x64, !ssl, Static, HTTP-only, Build-tests' + APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022' + CMAKE_GENERATOR: 'Visual Studio 17 2022' + CMAKE_GENERATE: '-A x64 -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=OFF -DHTTP_ONLY=ON' + + # VisualStudioSolution builds + + - job_name: 'VisualStudioSolution VS2010, Release, x86, Schannel' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2013' - BUILD_SYSTEM: VisualStudioSolution PRJ_CFG: 'DLL Release - DLL Windows SSPI - DLL WinIDN' PLAT: 'Win32' VC_VERSION: VC10 - - job_name: 'VisualStudioSolution VS2013, Debug, x64, Schannel, Build-only' + + - job_name: 'VisualStudioSolution VS2013, Debug, x64, Schannel' APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2015' - BUILD_SYSTEM: VisualStudioSolution PRJ_CFG: 'DLL Debug - DLL Windows SSPI - DLL WinIDN' PLAT: 'x64' VC_VERSION: VC12