blob: d4d2896c651f38ad9b6dc49455fa63e84541d43a [file] [log] [blame]
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +02001::
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
24SETLOCAL EnableDelayedExpansion
25
26CD build\appveyor || EXIT /B
27
28SET APPVEYOR_SCRIPTS=%APPVEYOR_BUILD_FOLDER%\build\appveyor
29SET BUILDDIR=%APPVEYOR_BUILD_FOLDER%\..\build\%PROFILE%\%PLATFORM%
30SET INSTDIR=%APPVEYOR_BUILD_FOLDER%\..\install\%PROFILE%\%PLATFORM%
31SET SRCDIR=%APPVEYOR_BUILD_FOLDER%
32
33
Gregg Donovan62ec9292026-01-29 16:51:37 -050034IF "%PROFILE%" == "MSVC2017" (
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +020035 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 Donovan62ec9292026-01-29 16:51:37 -050046) 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 Emmenlauerffc7bb92021-08-05 17:23:35 +020052) ELSE (
53 ECHO Unsupported PROFILE=%PROFILE% or PLATFORM=%PLATFORM%
54 EXIT /B 1
55)
56
Carel Combrinkf9449ea2025-11-11 08:33:41 +020057:: Put back the @ECHO since vcvars*.bat above disables it
58@ECHO ON
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +020059
60:: compiler and generator detection
Gregg Donovan62ec9292026-01-29 16:51:37 -050061:: VS2017 uses "Generator Win64" syntax, VS2019+ use "-A x64" flag
62IF /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)
69IF "%PROFILE%" == "MSVC2017" (
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +020070 SET GENERATOR=Visual Studio 15 2017!GENARCH!
71 SET COMPILER=vc141
Gregg Donovan62ec9292026-01-29 16:51:37 -050072 SET CMAKE_ARCH_FLAG=
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +020073) ELSE IF "%PROFILE%" == "MSVC2019" (
Gregg Donovan62ec9292026-01-29 16:51:37 -050074 SET GENERATOR=Visual Studio 16 2019
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +020075 SET COMPILER=vc142
Gregg Donovan62ec9292026-01-29 16:51:37 -050076) ELSE IF "%PROFILE%" == "MSVC2022" (
77 SET GENERATOR=Visual Studio 17 2022
78 SET COMPILER=vc143
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +020079) 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
86IF "%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
93SET BOOST_ROOT=C:/Libraries/boost_%BOOST_VERSION:.=_%
94SET BOOST_LIBRARYDIR=!BOOST_ROOT!/lib%NORM_PLATFORM%-msvc-%COMPILER:~-3,2%.%COMPILER:~-1,1%
95SET OPENSSL_ROOT=C:\OpenSSL-Win%NORM_PLATFORM%
96SET WIN3P=%APPVEYOR_BUILD_FOLDER%\thirdparty
97
98IF "%PYTHON_VERSION%" == "" (
99 SET WITH_PYTHON=OFF
Carel Combrinkf9449ea2025-11-11 08:33:41 +0200100 SET CMAKE_PYTHON_OPTS=""
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +0200101) ELSE (
102 SET WITH_PYTHON=ON
103 IF /i "%PLATFORM%" == "x64" (SET PTEXT=-x64)
Carel Combrinkf9449ea2025-11-11 08:33:41 +0200104 SET PYTHON_ROOT=C:\Python%PYTHON_VERSION:.=%!PTEXT!
105 SET PATH=!PYTHON_ROOT!\scripts;!PYTHON_ROOT!;!PATH!
Gregg Donovan62ec9292026-01-29 16:51:37 -0500106 SET CMAKE_PYTHON_OPTS=-DPython3_FIND_STRATEGY=LOCATION -DPython3_ROOT=!PYTHON_ROOT! -DPython3_EXECUTABLE=!PYTHON_ROOT!\python.exe
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +0200107)
108
109IF "%CONFIGURATION%" == "Debug" (SET ZLIB_LIB_SUFFIX=d)
110
111IF 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 Combrinkf9449ea2025-11-11 08:33:41 +0200116@ECHO OFF
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +0200117CALL win_showenv.bat || EXIT /B
118MKDIR "%WIN3P%" || EXIT /B
Carel Combrinkf9449ea2025-11-11 08:33:41 +0200119@ECHO ON
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +0200120
121choco feature enable -n allowGlobalConfirmation || EXIT /B
122
123:: Things to install when NOT running in appveyor:
124IF "%APPVEYOR_BUILD_ID%" == "" (
Gregg Donovan62ec9292026-01-29 16:51:37 -0500125 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 Emmenlauerffc7bb92021-08-05 17:23:35 +0200130)
131
Gregg Donovan62ec9292026-01-29 16:51:37 -0500132choco install -y jdk8 || EXIT /B
133choco install -y winflexbison3 || EXIT /B
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +0200134
135:: zlib - not available through chocolatey
136CD "%APPVEYOR_SCRIPTS%" || EXIT /B
137call build-zlib.bat || EXIT /B
138
139:: libevent - not available through chocolatey
140CD "%APPVEYOR_SCRIPTS%" || EXIT /B
141call build-libevent.bat || EXIT /B
142
Gregg Donovan62ec9292026-01-29 16:51:37 -0500143:: python packages (ensure we use the configured Python)
144IF "%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 Emmenlauerffc7bb92021-08-05 17:23:35 +0200154
155:: Adobe Flex SDK 4.6 for ActionScript
156MKDIR "C:\Adobe\Flex\SDK\4.6" || EXIT /B
Sven Roederer32b58e52024-07-18 15:25:33 +0200157appveyor 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 Emmenlauerffc7bb92021-08-05 17:23:35 +0200158CD "C:\Adobe\Flex\SDK\4.6" || EXIT /B
1597z x SDK.zip || EXIT /B
160SETX FLEX_HOME "C:\Adobe\Flex\SDK\4.6"
161
162
163::
164:: Configure and build our software with cmake
165::
166
167MKDIR "%BUILDDIR%" || EXIT /B
168CD "%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
185cmake.exe "%SRCDIR%" ^
Gregg Donovan62ec9292026-01-29 16:51:37 -0500186 -G"%GENERATOR%" %CMAKE_ARCH_FLAG% ^
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +0200187 -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 Combrinkf9449ea2025-11-11 08:33:41 +0200199 -DWITH_PYTHON=%WITH_PYTHON% %CMAKE_PYTHON_OPTS% || EXIT /B
Mario Emmenlauerffc7bb92021-08-05 17:23:35 +0200200
201cmake.exe --build . --config "%CONFIGURATION%" || EXIT /B
202
203cmake.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!
210SET PATH=%BOOST_LIBRARYDIR:/=\%;%OPENSSL_ROOT%\bin;%WIN3P%\zlib-inst\bin;%PATH%
211SET DISABLED_TESTS_COMMAND=--exclude-regex '%DISABLED_TESTS%'
212
213ctest.exe --build-config %CONFIGURATION% --timeout 300 --extra-verbose %DISABLED_TESTS_COMMAND% || EXIT /B