| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 1 | :: |
| 2 | :: Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | :: you may not use this file except in compliance with the License. |
| 4 | :: You may obtain a copy of the License at |
| 5 | :: |
| 6 | :: http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | :: |
| 8 | :: Unless required by applicable law or agreed to in writing, software |
| 9 | :: distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | :: See the License for the specific language governing permissions and |
| 12 | :: limitations under the License. |
| 13 | :: |
| 14 | |
| 15 | :: |
| 16 | :: Appveyor script for MSVC |
| 17 | :: |
| 18 | |
| 19 | :: |
| 20 | :: Installs (or builds) third party packages we need |
| 21 | :: |
| 22 | |
| 23 | @ECHO ON |
| 24 | SETLOCAL EnableDelayedExpansion |
| 25 | |
| 26 | CD build\appveyor || EXIT /B |
| 27 | |
| 28 | SET APPVEYOR_SCRIPTS=%APPVEYOR_BUILD_FOLDER%\build\appveyor |
| 29 | SET BUILDDIR=%APPVEYOR_BUILD_FOLDER%\..\build\%PROFILE%\%PLATFORM% |
| 30 | SET INSTDIR=%APPVEYOR_BUILD_FOLDER%\..\install\%PROFILE%\%PLATFORM% |
| 31 | SET SRCDIR=%APPVEYOR_BUILD_FOLDER% |
| 32 | |
| 33 | |
| Gregg Donovan | 62ec929 | 2026-01-29 16:51:37 -0500 | [diff] [blame] | 34 | IF "%PROFILE%" == "MSVC2017" ( |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 35 | IF "%PLATFORM%" == "x86" ( |
| 36 | CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" || EXIT /B |
| 37 | ) ELSE ( |
| 38 | CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" || EXIT /B |
| 39 | ) |
| 40 | ) ELSE IF "%PROFILE%" == "MSVC2019" ( |
| 41 | IF "%PLATFORM%" == "x86" ( |
| 42 | CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" || EXIT /B |
| 43 | ) ELSE ( |
| 44 | CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" || EXIT /B |
| 45 | ) |
| Gregg Donovan | 62ec929 | 2026-01-29 16:51:37 -0500 | [diff] [blame] | 46 | ) ELSE IF "%PROFILE%" == "MSVC2022" ( |
| 47 | IF "%PLATFORM%" == "x86" ( |
| 48 | CALL "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" || EXIT /B |
| 49 | ) ELSE ( |
| 50 | CALL "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" || EXIT /B |
| 51 | ) |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 52 | ) ELSE ( |
| 53 | ECHO Unsupported PROFILE=%PROFILE% or PLATFORM=%PLATFORM% |
| 54 | EXIT /B 1 |
| 55 | ) |
| 56 | |
| Carel Combrink | f9449ea | 2025-11-11 08:33:41 +0200 | [diff] [blame] | 57 | :: Put back the @ECHO since vcvars*.bat above disables it |
| 58 | @ECHO ON |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 59 | |
| 60 | :: compiler and generator detection |
| Gregg Donovan | 62ec929 | 2026-01-29 16:51:37 -0500 | [diff] [blame] | 61 | :: VS2017 uses "Generator Win64" syntax, VS2019+ use "-A x64" flag |
| 62 | IF /i "%PLATFORM%" == "x64" ( |
| 63 | SET GENARCH= Win64 |
| 64 | SET CMAKE_ARCH_FLAG=-A x64 |
| 65 | ) ELSE ( |
| 66 | SET GENARCH= |
| 67 | SET CMAKE_ARCH_FLAG=-A Win32 |
| 68 | ) |
| 69 | IF "%PROFILE%" == "MSVC2017" ( |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 70 | SET GENERATOR=Visual Studio 15 2017!GENARCH! |
| 71 | SET COMPILER=vc141 |
| Gregg Donovan | 62ec929 | 2026-01-29 16:51:37 -0500 | [diff] [blame] | 72 | SET CMAKE_ARCH_FLAG= |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 73 | ) ELSE IF "%PROFILE%" == "MSVC2019" ( |
| Gregg Donovan | 62ec929 | 2026-01-29 16:51:37 -0500 | [diff] [blame] | 74 | SET GENERATOR=Visual Studio 16 2019 |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 75 | SET COMPILER=vc142 |
| Gregg Donovan | 62ec929 | 2026-01-29 16:51:37 -0500 | [diff] [blame] | 76 | ) ELSE IF "%PROFILE%" == "MSVC2022" ( |
| 77 | SET GENERATOR=Visual Studio 17 2022 |
| 78 | SET COMPILER=vc143 |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 79 | ) ELSE ( |
| 80 | ECHO [error] unable to determine the CMake generator and compiler to use from MSVC profile %PROFILE% |
| 81 | EXIT /B 1 |
| 82 | ) |
| 83 | |
| 84 | :: PLATFORM is x86 or x64 |
| 85 | :: NORM_PLATFORM is 32 or 64 |
| 86 | IF "%PLATFORM%" == "x86" ( |
| 87 | SET NORM_PLATFORM=32 |
| 88 | ) ELSE ( |
| 89 | SET NORM_PLATFORM=64 |
| 90 | ) |
| 91 | |
| 92 | :: FindBoost needs forward slashes so cmake doesn't see something as an escaped character |
| 93 | SET BOOST_ROOT=C:/Libraries/boost_%BOOST_VERSION:.=_% |
| 94 | SET BOOST_LIBRARYDIR=!BOOST_ROOT!/lib%NORM_PLATFORM%-msvc-%COMPILER:~-3,2%.%COMPILER:~-1,1% |
| 95 | SET OPENSSL_ROOT=C:\OpenSSL-Win%NORM_PLATFORM% |
| 96 | SET WIN3P=%APPVEYOR_BUILD_FOLDER%\thirdparty |
| 97 | |
| 98 | IF "%PYTHON_VERSION%" == "" ( |
| 99 | SET WITH_PYTHON=OFF |
| Carel Combrink | f9449ea | 2025-11-11 08:33:41 +0200 | [diff] [blame] | 100 | SET CMAKE_PYTHON_OPTS="" |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 101 | ) ELSE ( |
| 102 | SET WITH_PYTHON=ON |
| 103 | IF /i "%PLATFORM%" == "x64" (SET PTEXT=-x64) |
| Carel Combrink | f9449ea | 2025-11-11 08:33:41 +0200 | [diff] [blame] | 104 | SET PYTHON_ROOT=C:\Python%PYTHON_VERSION:.=%!PTEXT! |
| 105 | SET PATH=!PYTHON_ROOT!\scripts;!PYTHON_ROOT!;!PATH! |
| Gregg Donovan | 62ec929 | 2026-01-29 16:51:37 -0500 | [diff] [blame] | 106 | SET CMAKE_PYTHON_OPTS=-DPython3_FIND_STRATEGY=LOCATION -DPython3_ROOT=!PYTHON_ROOT! -DPython3_EXECUTABLE=!PYTHON_ROOT!\python.exe |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 107 | ) |
| 108 | |
| 109 | IF "%CONFIGURATION%" == "Debug" (SET ZLIB_LIB_SUFFIX=d) |
| 110 | |
| 111 | IF NOT "%QT_VERSION%" == "" ( |
| 112 | IF /i "%PLATFORM%" == "x64" (SET QTEXT=_64) |
| 113 | SET PATH=C:\Qt\%QT_VERSION%\%PROFILE%!QTEXT!\bin;!PATH! |
| 114 | ) |
| 115 | |
| Carel Combrink | f9449ea | 2025-11-11 08:33:41 +0200 | [diff] [blame] | 116 | @ECHO OFF |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 117 | CALL win_showenv.bat || EXIT /B |
| 118 | MKDIR "%WIN3P%" || EXIT /B |
| Carel Combrink | f9449ea | 2025-11-11 08:33:41 +0200 | [diff] [blame] | 119 | @ECHO ON |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 120 | |
| 121 | choco feature enable -n allowGlobalConfirmation || EXIT /B |
| 122 | |
| 123 | :: Things to install when NOT running in appveyor: |
| 124 | IF "%APPVEYOR_BUILD_ID%" == "" ( |
| Gregg Donovan | 62ec929 | 2026-01-29 16:51:37 -0500 | [diff] [blame] | 125 | choco upgrade -y chocolatey || EXIT /B |
| 126 | choco install -y curl || EXIT /B |
| 127 | choco install -y 7zip || EXIT /B |
| 128 | choco install -y python3 || EXIT /B |
| 129 | choco install -y openssl.light || EXIT /B |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 130 | ) |
| 131 | |
| Gregg Donovan | 62ec929 | 2026-01-29 16:51:37 -0500 | [diff] [blame] | 132 | choco install -y jdk8 || EXIT /B |
| 133 | choco install -y winflexbison3 || EXIT /B |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 134 | |
| 135 | :: zlib - not available through chocolatey |
| 136 | CD "%APPVEYOR_SCRIPTS%" || EXIT /B |
| 137 | call build-zlib.bat || EXIT /B |
| 138 | |
| 139 | :: libevent - not available through chocolatey |
| 140 | CD "%APPVEYOR_SCRIPTS%" || EXIT /B |
| 141 | call build-libevent.bat || EXIT /B |
| 142 | |
| Gregg Donovan | 62ec929 | 2026-01-29 16:51:37 -0500 | [diff] [blame] | 143 | :: python packages (ensure we use the configured Python) |
| 144 | IF "%WITH_PYTHON%" == "ON" ( |
| 145 | "!PYTHON_ROOT!\python.exe" -m ensurepip --upgrade || EXIT /B |
| 146 | "!PYTHON_ROOT!\python.exe" -m pip install --upgrade pip setuptools wheel || EXIT /B |
| 147 | "!PYTHON_ROOT!\python.exe" -m pip ^ |
| 148 | install backports.ssl_match_hostname ^ |
| 149 | ipaddress ^ |
| 150 | tornado>=6.3.0 ^ |
| 151 | twisted>=24.3.0 ^ |
| 152 | zope.interface>=6.1 || EXIT /B |
| 153 | ) |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 154 | |
| 155 | :: Adobe Flex SDK 4.6 for ActionScript |
| 156 | MKDIR "C:\Adobe\Flex\SDK\4.6" || EXIT /B |
| Sven Roederer | 32b58e5 | 2024-07-18 15:25:33 +0200 | [diff] [blame] | 157 | appveyor DownloadFile https://fpdownload.adobe.com/pub/flex/sdk/builds/flex4.6/flex_sdk_4.6.0.23201B.zip -FileName C:\Adobe\Flex\SDK\4.6\SDK.zip || EXIT /B |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 158 | CD "C:\Adobe\Flex\SDK\4.6" || EXIT /B |
| 159 | 7z x SDK.zip || EXIT /B |
| 160 | SETX FLEX_HOME "C:\Adobe\Flex\SDK\4.6" |
| 161 | |
| 162 | |
| 163 | :: |
| 164 | :: Configure and build our software with cmake |
| 165 | :: |
| 166 | |
| 167 | MKDIR "%BUILDDIR%" || EXIT /B |
| 168 | CD "%BUILDDIR%" || EXIT /B |
| 169 | |
| 170 | :: When libraries cannot be found, things might have been updated |
| 171 | :: so uncomment this and submit a pull request to see what's there |
| 172 | :: now... |
| 173 | :: DIR C:\Libraries |
| 174 | :: DIR C:\Libraries\boost_1_69_0\lib* |
| 175 | :: DIR C:\Libraries\boost_1_68_0\lib* |
| 176 | :: DIR C:\Libraries\boost_1_67_0\lib* |
| 177 | :: DIR C:\Libraries\boost_1_66_0\lib* |
| 178 | :: DIR C:\Libraries\boost_1_65_0\lib* |
| 179 | :: DIR C:\Libraries\boost_1_64_0\lib* |
| 180 | :: DIR C:\Libraries\boost_1_63_0\lib* |
| 181 | :: DIR C:\Libraries\boost_1_62_0\lib* |
| 182 | :: DIR C:\Libraries\boost_1_61_0\lib* |
| 183 | :: DIR C:\Libraries\boost_1_60_0\lib* |
| 184 | |
| 185 | cmake.exe "%SRCDIR%" ^ |
| Gregg Donovan | 62ec929 | 2026-01-29 16:51:37 -0500 | [diff] [blame] | 186 | -G"%GENERATOR%" %CMAKE_ARCH_FLAG% ^ |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 187 | -DBISON_EXECUTABLE="C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_bison.exe" ^ |
| 188 | -DBOOST_ROOT="%BOOST_ROOT%" ^ |
| 189 | -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ^ |
| 190 | -DBUILD_SHARED_LIBS="%BUILD_SHARED_LIBS%" ^ |
| 191 | -DCMAKE_BUILD_TYPE="%CONFIGURATION%" ^ |
| 192 | -DCMAKE_INSTALL_PREFIX="%INSTDIR%" ^ |
| 193 | -DFLEX_EXECUTABLE="C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_flex.exe" ^ |
| 194 | -DLIBEVENT_ROOT="%WIN3P%\libevent-%LIBEVENT_VERSION%-stable" ^ |
| 195 | -DOPENSSL_ROOT_DIR="%OPENSSL_ROOT%" ^ |
| 196 | -DOPENSSL_USE_STATIC_LIBS=OFF ^ |
| 197 | -DZLIB_LIBRARY="%WIN3P%\zlib-inst\lib\zlib%ZLIB_LIB_SUFFIX%.lib" ^ |
| 198 | -DZLIB_ROOT="%WIN3P%\zlib-inst" ^ |
| Carel Combrink | f9449ea | 2025-11-11 08:33:41 +0200 | [diff] [blame] | 199 | -DWITH_PYTHON=%WITH_PYTHON% %CMAKE_PYTHON_OPTS% || EXIT /B |
| Mario Emmenlauer | ffc7bb9 | 2021-08-05 17:23:35 +0200 | [diff] [blame] | 200 | |
| 201 | cmake.exe --build . --config "%CONFIGURATION%" || EXIT /B |
| 202 | |
| 203 | cmake.exe --install . --config "%CONFIGURATION%" || EXIT /B |
| 204 | |
| 205 | :: |
| 206 | :: Execute our tests |
| 207 | :: |
| 208 | |
| 209 | :: Add directories to the path to find DLLs of third party libraries so tests run properly! |
| 210 | SET PATH=%BOOST_LIBRARYDIR:/=\%;%OPENSSL_ROOT%\bin;%WIN3P%\zlib-inst\bin;%PATH% |
| 211 | SET DISABLED_TESTS_COMMAND=--exclude-regex '%DISABLED_TESTS%' |
| 212 | |
| 213 | ctest.exe --build-config %CONFIGURATION% --timeout 300 --extra-verbose %DISABLED_TESTS_COMMAND% || EXIT /B |