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 | |
| 34 | IF "%PROFILE%" == "MSVC2015" ( |
| 35 | IF "%PLATFORM%" == "x86" ( |
| 36 | CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 || EXIT /B |
| 37 | ) ELSE ( |
| 38 | CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 || EXIT /B |
| 39 | CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 || EXIT /B |
| 40 | ) |
| 41 | ) ELSE IF "%PROFILE%" == "MSVC2017" ( |
| 42 | IF "%PLATFORM%" == "x86" ( |
| 43 | CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" || EXIT /B |
| 44 | ) ELSE ( |
| 45 | CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" || EXIT /B |
| 46 | ) |
| 47 | ) ELSE IF "%PROFILE%" == "MSVC2019" ( |
| 48 | IF "%PLATFORM%" == "x86" ( |
| 49 | CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat" || EXIT /B |
| 50 | ) ELSE ( |
| 51 | CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat" || EXIT /B |
| 52 | ) |
| 53 | ) ELSE ( |
| 54 | ECHO Unsupported PROFILE=%PROFILE% or PLATFORM=%PLATFORM% |
| 55 | EXIT /B 1 |
| 56 | ) |
| 57 | |
| 58 | |
| 59 | :: compiler and generator detection |
| 60 | IF /i "%PLATFORM%" == "x64" SET GENARCH= Win64 |
| 61 | IF "%PROFILE%" == "MSVC2015" ( |
| 62 | SET GENERATOR=Visual Studio 14 2015!GENARCH! |
| 63 | SET COMPILER=vc140 |
| 64 | ) ELSE IF "%PROFILE%" == "MSVC2017" ( |
| 65 | SET GENERATOR=Visual Studio 15 2017!GENARCH! |
| 66 | SET COMPILER=vc141 |
| 67 | ) ELSE IF "%PROFILE%" == "MSVC2019" ( |
| 68 | SET GENERATOR=Visual Studio 16 2019!GENARCH! |
| 69 | SET COMPILER=vc142 |
| 70 | ) ELSE ( |
| 71 | ECHO [error] unable to determine the CMake generator and compiler to use from MSVC profile %PROFILE% |
| 72 | EXIT /B 1 |
| 73 | ) |
| 74 | |
| 75 | :: PLATFORM is x86 or x64 |
| 76 | :: NORM_PLATFORM is 32 or 64 |
| 77 | IF "%PLATFORM%" == "x86" ( |
| 78 | SET NORM_PLATFORM=32 |
| 79 | ) ELSE ( |
| 80 | SET NORM_PLATFORM=64 |
| 81 | ) |
| 82 | |
| 83 | :: FindBoost needs forward slashes so cmake doesn't see something as an escaped character |
| 84 | SET BOOST_ROOT=C:/Libraries/boost_%BOOST_VERSION:.=_% |
| 85 | SET BOOST_LIBRARYDIR=!BOOST_ROOT!/lib%NORM_PLATFORM%-msvc-%COMPILER:~-3,2%.%COMPILER:~-1,1% |
| 86 | SET OPENSSL_ROOT=C:\OpenSSL-Win%NORM_PLATFORM% |
| 87 | SET WIN3P=%APPVEYOR_BUILD_FOLDER%\thirdparty |
| 88 | |
| 89 | IF "%PYTHON_VERSION%" == "" ( |
| 90 | SET WITH_PYTHON=OFF |
| 91 | ) ELSE ( |
| 92 | SET WITH_PYTHON=ON |
| 93 | IF /i "%PLATFORM%" == "x64" (SET PTEXT=-x64) |
| 94 | SET PATH=C:\Python%PYTHON_VERSION:.=%!PTEXT!\scripts;C:\Python%PYTHON_VERSION:.=%!PTEXT!;!PATH! |
| 95 | ) |
| 96 | |
| 97 | IF "%CONFIGURATION%" == "Debug" (SET ZLIB_LIB_SUFFIX=d) |
| 98 | |
| 99 | IF NOT "%QT_VERSION%" == "" ( |
| 100 | IF /i "%PLATFORM%" == "x64" (SET QTEXT=_64) |
| 101 | SET PATH=C:\Qt\%QT_VERSION%\%PROFILE%!QTEXT!\bin;!PATH! |
| 102 | ) |
| 103 | |
| 104 | |
| 105 | CALL win_showenv.bat || EXIT /B |
| 106 | MKDIR "%WIN3P%" || EXIT /B |
| 107 | |
| 108 | choco feature enable -n allowGlobalConfirmation || EXIT /B |
| 109 | |
| 110 | :: Things to install when NOT running in appveyor: |
| 111 | IF "%APPVEYOR_BUILD_ID%" == "" ( |
| 112 | cup -y chocolatey || EXIT /B |
| 113 | cinst -y curl || EXIT /B |
| 114 | cinst -y 7zip || EXIT /B |
| 115 | cinst -y python3 || EXIT /B |
| 116 | cinst -y openssl.light || EXIT /B |
| 117 | ) |
| 118 | |
| 119 | cinst -y jdk8 || EXIT /B |
| 120 | cinst -y winflexbison3 || EXIT /B |
| 121 | |
| 122 | :: zlib - not available through chocolatey |
| 123 | CD "%APPVEYOR_SCRIPTS%" || EXIT /B |
| 124 | call build-zlib.bat || EXIT /B |
| 125 | |
| 126 | :: libevent - not available through chocolatey |
| 127 | CD "%APPVEYOR_SCRIPTS%" || EXIT /B |
| 128 | call build-libevent.bat || EXIT /B |
| 129 | |
| 130 | :: python packages (correct path to pip set above) |
| 131 | pip.exe ^ |
| 132 | install backports.ssl_match_hostname ^ |
| 133 | ipaddress ^ |
| 134 | six ^ |
| 135 | tornado ^ |
| 136 | twisted || EXIT /B |
| 137 | |
| 138 | :: Adobe Flex SDK 4.6 for ActionScript |
| 139 | MKDIR "C:\Adobe\Flex\SDK\4.6" || EXIT /B |
| 140 | appveyor DownloadFile http://download.macromedia.com/pub/flex/sdk/flex_sdk_4.6.zip -FileName C:\Adobe\Flex\SDK\4.6\SDK.zip || EXIT /B |
| 141 | CD "C:\Adobe\Flex\SDK\4.6" || EXIT /B |
| 142 | 7z x SDK.zip || EXIT /B |
| 143 | SETX FLEX_HOME "C:\Adobe\Flex\SDK\4.6" |
| 144 | |
| 145 | |
| 146 | :: |
| 147 | :: Configure and build our software with cmake |
| 148 | :: |
| 149 | |
| 150 | MKDIR "%BUILDDIR%" || EXIT /B |
| 151 | CD "%BUILDDIR%" || EXIT /B |
| 152 | |
| 153 | :: When libraries cannot be found, things might have been updated |
| 154 | :: so uncomment this and submit a pull request to see what's there |
| 155 | :: now... |
| 156 | :: DIR C:\Libraries |
| 157 | :: DIR C:\Libraries\boost_1_69_0\lib* |
| 158 | :: DIR C:\Libraries\boost_1_68_0\lib* |
| 159 | :: DIR C:\Libraries\boost_1_67_0\lib* |
| 160 | :: DIR C:\Libraries\boost_1_66_0\lib* |
| 161 | :: DIR C:\Libraries\boost_1_65_0\lib* |
| 162 | :: DIR C:\Libraries\boost_1_64_0\lib* |
| 163 | :: DIR C:\Libraries\boost_1_63_0\lib* |
| 164 | :: DIR C:\Libraries\boost_1_62_0\lib* |
| 165 | :: DIR C:\Libraries\boost_1_61_0\lib* |
| 166 | :: DIR C:\Libraries\boost_1_60_0\lib* |
| 167 | |
| 168 | cmake.exe "%SRCDIR%" ^ |
| 169 | -G"%GENERATOR%" ^ |
| 170 | -DBISON_EXECUTABLE="C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_bison.exe" ^ |
| 171 | -DBOOST_ROOT="%BOOST_ROOT%" ^ |
| 172 | -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ^ |
| 173 | -DBUILD_SHARED_LIBS="%BUILD_SHARED_LIBS%" ^ |
| 174 | -DCMAKE_BUILD_TYPE="%CONFIGURATION%" ^ |
| 175 | -DCMAKE_INSTALL_PREFIX="%INSTDIR%" ^ |
| 176 | -DFLEX_EXECUTABLE="C:\ProgramData\chocolatey\lib\winflexbison3\tools\win_flex.exe" ^ |
| 177 | -DLIBEVENT_ROOT="%WIN3P%\libevent-%LIBEVENT_VERSION%-stable" ^ |
| 178 | -DOPENSSL_ROOT_DIR="%OPENSSL_ROOT%" ^ |
| 179 | -DOPENSSL_USE_STATIC_LIBS=OFF ^ |
| 180 | -DZLIB_LIBRARY="%WIN3P%\zlib-inst\lib\zlib%ZLIB_LIB_SUFFIX%.lib" ^ |
| 181 | -DZLIB_ROOT="%WIN3P%\zlib-inst" ^ |
| 182 | -DWITH_PYTHON=%WITH_PYTHON% || EXIT /B |
| 183 | |
| 184 | cmake.exe --build . --config "%CONFIGURATION%" || EXIT /B |
| 185 | |
| 186 | cmake.exe --install . --config "%CONFIGURATION%" || EXIT /B |
| 187 | |
| 188 | :: |
| 189 | :: Execute our tests |
| 190 | :: |
| 191 | |
| 192 | :: Add directories to the path to find DLLs of third party libraries so tests run properly! |
| 193 | SET PATH=%BOOST_LIBRARYDIR:/=\%;%OPENSSL_ROOT%\bin;%WIN3P%\zlib-inst\bin;%PATH% |
| 194 | SET DISABLED_TESTS_COMMAND=--exclude-regex '%DISABLED_TESTS%' |
| 195 | |
| 196 | ctest.exe --build-config %CONFIGURATION% --timeout 300 --extra-verbose %DISABLED_TESTS_COMMAND% || EXIT /B |