From 2570df515b89682ca5894a6d2fa1f5507118b097 Mon Sep 17 00:00:00 2001 From: Wilhelm Berg Date: Wed, 8 Aug 2018 17:31:09 +0200 Subject: [wip] Visual Studio 2017 build scripts --- .gitignore | 1 + scripts/windows-build-appveyor.bat | 59 ++++++++++++++++++++++++++++++++++++++ scripts/windows-build-local.bat | 29 +++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 scripts/windows-build-appveyor.bat create mode 100644 scripts/windows-build-local.bat diff --git a/.gitignore b/.gitignore index 48f3c06f3d..9459cafd58 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ test/fixtures/api/assets.zip test/fixtures/storage/assets.zip /.circle-week /vendor/.cache +/cmake.zip # Generated list files from code generation /scripts/generate-cmake-files.list diff --git a/scripts/windows-build-appveyor.bat b/scripts/windows-build-appveyor.bat new file mode 100644 index 0000000000..231f48dcb7 --- /dev/null +++ b/scripts/windows-build-appveyor.bat @@ -0,0 +1,59 @@ +@ECHO OFF +SETLOCAL +SET EL=0 + +ECHO Powershell version^: +powershell $PSVersionTable.PSVersion +IF %ERRORLEVEL% NEQ 0 ECHO powershell not availabe && GOTO ERROR + +FOR /F "tokens=*" %%i in ('powershell Get-ExecutionPolicy') do SET PSPOLICY=%%i +ECHO Powershell execution policy^: %PSPOLICY% +IF NOT "%PSPOLICY%"=="Unrestricted" powershell Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force +IF %ERRORLEVEL% NEQ 0 GOTO ERROR +FOR /F "tokens=*" %%i in ('powershell Get-ExecutionPolicy') do SET PSPOLICY=%%i +ECHO Powershell execution policy now is^: %PSPOLICY% + +IF NOT EXIST cmake.zip powershell Invoke-WebRequest $env:CMAKE_URL -OutFile $env:APPVEYOR_BUILD_FOLDER\\cmake.zip +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +IF NOT EXIST C:\%CMAKE_VERSION% 7z -y x cmake.zip -oC:\ | %windir%\system32\FIND "ing archive" +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +SET PATH=C:\%CMAKE_VERSION%\bin;%PATH% + +IF EXIST %APPVEYOR_BUILD_FOLDER%\build RMDIR /Q /S %APPVEYOR_BUILD_FOLDER%\build +IF %ERRORLEVEL% NEQ 0 GOTO ERROR +MKDIR %APPVEYOR_BUILD_FOLDER%\build +IF %ERRORLEVEL% NEQ 0 GOTO ERROR +CD %APPVEYOR_BUILD_FOLDER%\build +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +REM call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 +call "C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64 +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +cmake -G "Visual Studio 15 Win64" ^ +-DMBGL_PLATFORM=qt ^ +-DWITH_QT_DECODERS=ON ^ +-DWITH_QT_I18N=ON ^ +-DWITH_NODEJS=OFF ^ +-DCMAKE_BUILD_TYPE=Release ^ +-DCMAKE_PREFIX_PATH=C:\Qt\5.11.1\msvc2017_64\lib\cmake ^ +-DCMAKE_MAKE_PROGRAM="%APPVEYOR_BUILD_FOLDER%\platform\qt\ninja.exe" .. +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +REM cmake --build . -- -j %NUMBER_OF_PROCESSORS% +REM IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +GOTO DONE + +:ERROR +SET EL=%ERRORLEVEL% +ECHO ~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~ +ECHO ERRORLEVEL^: %EL% + +:DONE + +ECHO ~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~ + +EXIT /b %EL% diff --git a/scripts/windows-build-local.bat b/scripts/windows-build-local.bat new file mode 100644 index 0000000000..09e3938a2a --- /dev/null +++ b/scripts/windows-build-local.bat @@ -0,0 +1,29 @@ +@ECHO OFF +SETLOCAL +SET EL=0 + +REM this file is supposed to be called from the root of the repository +REM otherwise path references will not work + +IF NOT EXIST C:\Qt\5.11.1\msvc2017_64\lib SET EL=1 && ECHO QT not found && GOTO ERROR +SET PATH=C:\Program Files\7-Zip;%PATH% + +SET APPVEYOR_BUILD_FOLDER=%CD% +SET CMAKE_VERSION=cmake-3.10.1-win64-x64 +SET CMAKE_URL=https://cmake.org/files/v3.10/%CMAKE_VERSION%.zip + +CALL scripts\windows-build-appveyor.bat +IF %ERRORLEVEL% NEQ 0 GOTO ERROR + +GOTO DONE + +:ERROR +SET EL=%ERRORLEVEL% +ECHO ~~~~~~~~~~~~~~~~~~~ ERROR %~f0 ~~~~~~~~~~~~~~~~~~~ +ECHO ERRORLEVEL^: %EL% + +:DONE + +ECHO ~~~~~~~~~~~~~~~~~~~ DONE %~f0 ~~~~~~~~~~~~~~~~~~~ + +EXIT /b %EL% -- cgit v1.2.1