From 4b3c709a8c2b92c39554b7b7b55c3555b40879e4 Mon Sep 17 00:00:00 2001 From: Paul I Date: Tue, 27 Feb 2018 11:57:53 +0300 Subject: [PATCH] Remove environment settings from *.bat scripts (#342) --- .appveyor.yml | 32 ++++++++++++++++---------------- build.bat | 27 ++++++++------------------- prepare_r2.bat | 28 +++------------------------- 3 files changed, 27 insertions(+), 60 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index a288a192..9fea5c11 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -23,42 +23,42 @@ environment: VSVARSALLPATH: 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat' matrix: # Build: qmake vs2015 x86 shared - - BITS: 32 + - ARCH: x86 QMAKE: 1 # Build: qmake vs2015 x64 shared - - BITS: 64 + - ARCH: x64 QMAKE: 1 # Build: meson ninja x64 static - - BITS: 64 - ARCH: x64 + - ARCH: x64 MESON: 1 BACKEND: ninja install: - - cmd: set "PATH=%PYTHON%;%PATH%" + - cmd: set "PATH=%CD%;%PYTHON%;%PATH%" + - cmd: call "%VSVARSALLPATH%" %ARCH% + - cmd: if "%ARCH%" == "x64" ( set "PATH=%QT64PATH%\bin;%PATH%" && set "BITS=64" ) else ( set "PATH=%QT32PATH%\bin;%PATH%" && set "BITS=32" ) + - cmd: python -m pip install meson + - cmd: powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; wget %NINJA_URL% -OutFile ninja.zip" && unzip ninja.zip # Artifacts - - cmd: if defined MESON ( set "ARTIFACT_NAME=Cutter%BITS%_static" ) else ( set "ARTIFACT_NAME=Cutter%BITS%" ) - - cmd: if defined MESON ( set "ARTIFACT=dist%BITS%" ) else ( set "ARTIFACT=build%BITS%\cutter%BITS%" ) - # Meson specific - - cmd: if defined MESON ( if "%ARCH%" == "x64" ( set "PATH=%QT64PATH%\bin;%PATH%" ) else ( set "PATH=%QT32PATH%\bin;%PATH%" ) ) - - cmd: if defined MESON ( python -m pip install meson ) - - cmd: if defined MESON ( if "%BACKEND%" == "ninja" ( powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; wget %NINJA_URL% -OutFile ninja.zip" && unzip ninja.zip ) ) + - cmd: if defined MESON ( set "ARTIFACT_NAME=Cutter_%ARCH%_static" ) else ( set "ARTIFACT_NAME=Cutter_%ARCH%" ) + - cmd: if defined MESON ( set "ARTIFACT_PATH=dist%BITS%" ) else ( set "ARTIFACT_PATH=build%BITS%\cutter" ) before_build: - - cmd: if defined QMAKE ( prepare_r2.bat %BITS% ) - - cmd: if defined MESON ( git submodule update --init ) + - cmd: git submodule update --init + - cmd: if defined QMAKE ( prepare_r2.bat ) + # Build config build_script: - - cmd: if defined QMAKE ( build.bat %BITS% ) - - cmd: if defined MESON ( call "%VSVARSALLPATH%" %ARCH% && python meson.py --dist=%ARTIFACT% --backend=%BACKEND% ) + - cmd: if defined QMAKE ( build.bat ) + - cmd: if defined MESON ( python meson.py --dist=%ARTIFACT_PATH% --backend=%BACKEND% ) # Tests test: off # Artifacts artifacts: - - path: "%ARTIFACT%" + - path: "%ARTIFACT_PATH%" name: "%ARTIFACT_NAME%" deploy: diff --git a/build.bat b/build.bat index f6c821ae..21ea4ec7 100644 --- a/build.bat +++ b/build.bat @@ -1,23 +1,13 @@ @ECHO off SETLOCAL ENABLEDELAYEDEXPANSION -IF NOT DEFINED QT32PATH SET QT32PATH=C:\Qt\5.9.2\msvc2015 -IF NOT DEFINED QT64PATH SET QT64PATH=C:\Qt\5.9.2\msvc2015_64 -IF NOT DEFINED VSVARSALLPATH SET VSVARSALLPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat - -IF "%1" == "32" ( - SET "PATH=%QT32PATH%\bin;%PATH%" - CALL "%VSVARSALLPATH%" x86 - SET MSBUILDPLATFORM=Win32 -) ELSE IF "%1" == "64" ( - SET "PATH=%QT64PATH%\bin;%PATH%" - CALL "%VSVARSALLPATH%" x64 +IF "%Platform%" == "X64" ( SET MSBUILDPLATFORM=x64 + SET BITS=64 ) ELSE ( - ECHO Usage: %0 {32^|64} - EXIT /B 1 + SET MSBUILDPLATFORM=Win32 + SET BITS=32 ) -SET BITS=%1 ECHO Preparing directory RMDIR /S /Q build%BITS% @@ -31,8 +21,7 @@ msbuild /m cutter.vcxproj /p:Configuration=Release;Platform=%MSBUILDPLATFORM% IF !ERRORLEVEL! NEQ 0 EXIT /B 1 ECHO Deploying cutter -MKDIR cutter%BITS% -MOVE release\cutter.exe cutter%BITS%\cutter.exe -XCOPY /S ..\dist%BITS% cutter%BITS%\ -windeployqt cutter%BITS%\cutter.exe -CD .. +MKDIR cutter +MOVE release\cutter.exe cutter\cutter.exe +XCOPY /S ..\dist%BITS% cutter\ +windeployqt cutter\cutter.exe diff --git a/prepare_r2.bat b/prepare_r2.bat index 2048a8b9..17b95f40 100644 --- a/prepare_r2.bat +++ b/prepare_r2.bat @@ -1,32 +1,10 @@ @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION -FOR %%i IN (python.exe) DO (IF NOT DEFINED PYTHON SET PYTHON=%%~dp$PATH:i) - -IF NOT DEFINED PYTHON SET PYTHON=C:\Program Files\Python36 -IF NOT DEFINED NINJA_URL SET NINJA_URL=https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip -IF NOT DEFINED VSVARSALLPATH SET VSVARSALLPATH=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat - -IF "%1" == "32" ( - CALL "%VSVARSALLPATH%" x86 -) ELSE IF "%1" == "64" ( - CALL "%VSVARSALLPATH%" x64 +IF "%Platform%" == "X64" ( + SET BITS=64 ) ELSE ( - ECHO Usage: %0 {32^|64} - EXIT /B 1 -) -SET BITS=%1 - -SET "PATH=%CD%;%PYTHON%;%PATH%" - -git submodule update --init - -ECHO Downloading meson and ninja -python -m pip install meson -IF !ERRORLEVEL! NEQ 0 EXIT /B 1 -IF NOT EXIST ninja.exe ( - powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; wget %NINJA_URL% -OutFile ninja.zip" && powershell -Command Expand-Archive .\ninja.zip -DestinationPath .\ && DEL ninja.zip - IF !ERRORLEVEL! NEQ 0 EXIT /B 1 + SET BITS=32 ) ECHO Building radare2 (%BITS%)