diff options
author | JosepMaJAZ <josepma@gmail.com> | 2019-12-21 16:18:58 +0100 |
---|---|---|
committer | JosepMaJAZ <josepma@gmail.com> | 2019-12-21 16:18:58 +0100 |
commit | fb6c7514c64519d40d859af1300ce94b2a05676b (patch) | |
tree | 9b486840dddda5640642fb8146270b1a2a737462 /build/appveyor | |
parent | 682409fd05ea2db36fc037a0c94748e831aed7a2 (diff) |
Changes to make appveyor script usable for developers.
- Autodetect Visual Studio version, edition or buildtools. Default to predefined buildtools as before, prefer 2017 to 2019 and Enterprise to Professional to Community. Explicit parameter to make VC 2019 to use VC 2017 (14.1) compiler.
- Autodetect path of 64bit binaries so no hardcoded path anymore.
- Two new parameters to skip build and run tests and skip installer generation.
- Install_buildenv first checks if path exists before checking if platform has 7zip.
- Added alternative using powershell if 7zip not found.
This is all complemented with a simple build.cmd that calls these two scripts which will be placed on the wiki.
Diffstat (limited to 'build/appveyor')
-rw-r--r-- | build/appveyor/build_mixxx.bat | 112 |
1 files changed, 76 insertions, 36 deletions
diff --git a/build/appveyor/build_mixxx.bat b/build/appveyor/build_mixxx.bat index 69e8371bf9..d04c601c05 100644 --- a/build/appveyor/build_mixxx.bat +++ b/build/appveyor/build_mixxx.bat @@ -1,5 +1,5 @@ -@echo on -SETLOCAL +@echo off +SETLOCAL ENABLEDELAYEDEXPANSION REM ================================== REM Path setup and initial checks @@ -14,38 +14,36 @@ SET "PROGRAMFILES_PATH=%ProgramFiles(x86)%" rem ====== Edit to suit your environment ========= SET VCVERSION=141 -SET "MSVC_PATH=%PROGRAMFILES_PATH%\Microsoft Visual Studio\2017\Community\VC" +SET PARAM_VCVARSVER=14.1 SET "BUILDTOOLS_PATH=%PROGRAMFILES_PATH%\Microsoft Visual Studio\2017\BuildTools\VC" SET BUILDTOOLS_SCRIPT=Auxiliary\Build\vcvarsall.bat -IF EXIST "%MSVC_PATH%" ( -echo Building with Microsoft Visual Studio 2017 Community Edition. -SET "BUILDTOOLS_PATH=%MSVC_PATH%" -) ELSE ( IF EXIST "%BUILDTOOLS_PATH%" ( -echo Building with Microsoft Visual Studio 2017 Build Tools. +echo Building with preconfigured path at: "%BUILDTOOLS_PATH%" ) ELSE ( +call :function_get_product +IF ERRORLEVEL 1 ( echo. -echo Could not find "%MSVC_PATH%" nor "%BUILDTOOLS_PATH%". -echo Edit the build_environment.bat file and/or install the required software +echo Could not find "%BUILDTOOLS_PATH%" and the detection of product didn't work +echo Edit the %~nx0 file and/or install the required software echo http://landinghub.visualstudio.com/visual-cpp-build-tools echo https://www.microsoft.com/en-us/download/details.aspx?id=8279 exit /b 1 ) -REM END EXIST BUILDTOOLS +REM END NO PRODUCT ) -REM END EXIST MSVC_PATH +REM END EXIST BUILDTOOLS_PATH REM Check whether we have a 64-bit compiler available. -REM TODO(rryan): Remove hard-coding of compiler version in this path? -IF EXIST "%BUILDTOOLS_PATH%\Tools\MSVC\14.15.26726\bin\Hostx64\x64\cl.exe" ( -echo Using 64-bit compiler. -SET COMPILER_X86=amd64_x86 -SET COMPILER_X64=amd64 -) ELSE ( +call :function_has_64bit +IF ERRORLEVEL 1 ( echo Using 32-bit compiler. SET COMPILER_X86=x86 SET COMPILER_X64=x86_amd64 +) ELSE ( +echo Using 64-bit compiler. +SET COMPILER_X86=amd64_x86 +SET COMPILER_X64=amd64 ) REM ================================== @@ -55,23 +53,42 @@ REM ^ is the escape character. if "%3" == "" ( echo Missing parameters. Usage: ^(Note: keep same case and order^) echo. - echo build_mixxx.bat x64^|x86 debug^|release^|release-fastbuild ^<winlib-path^> + echo build_mixxx.bat x64^|x86 debug^|release^|release-fastbuild ^<winlib-path^> [skiptest] [skipinstaller] + echo. + echo skiptest means that we don't want to build and execute the mixxx-test. + echo skipinstaller means that we don't want to generate the installer after the build. echo. - echo Example: build_mixxx.bat x64 release c:\mixxx\environments\msvc15-static-x86-release + echo Example: build_mixxx.bat x64 release c:\mixxx\environments\2.3-j00013-x64-release-static-36f44bd2-minimal exit /b 1 ) set MACHINE_X86="%1" == "x86" if "%2" == "release" ( set CONFIG_RELEASE=1==1 + set PARAM_OPTIMIZE=portable ) if "%2" == "release-fastbuild" ( set CONFIG_RELEASE=1==1 + set PARAM_OPTIMIZE=fastbuild ) if "%2" == "debug" ( set CONFIG_RELEASE=0==1 + set PARAM_OPTIMIZE=portable +) +if "%4" == "skiptest" ( + set PARAM_TEST=0 +) else ( + set PARAM_TEST=1 +) +if "%4" == "skipinstaller" ( + set PARAM_INSTALLER= +) else ( + if "%5" == "skipinstaller" ( + set PARAM_INSTALLER= + ) else ( + set PARAM_INSTALLER=makerelease + ) ) - set WINLIB_DIR=%3 SET BIN_DIR=%WINLIB_DIR%\bin @@ -96,9 +113,11 @@ exit /b 1 REM Everything prepared. Setup the compiler. if %MACHINE_X86% ( -call "%BUILDTOOLS_PATH%\%BUILDTOOLS_SCRIPT%" %COMPILER_X86% +call "%BUILDTOOLS_PATH%\%BUILDTOOLS_SCRIPT%" %COMPILER_X86% -vcvars_ver=%PARAM_VCVARSVER% +set MACHINE_TYPE=x86 ) else ( -call "%BUILDTOOLS_PATH%\%BUILDTOOLS_SCRIPT%" %COMPILER_X64% +call "%BUILDTOOLS_PATH%\%BUILDTOOLS_SCRIPT%" %COMPILER_X64% -vcvars_ver=%PARAM_VCVARSVER% +set MACHINE_TYPE=x86_64 ) REM Now build Mixxx. @@ -109,18 +128,6 @@ set BUILD_TYPE=release set BUILD_TYPE=debug ) -if %MACHINE_X86% ( -set MACHINE_TYPE=x86 -set DISTDIR=dist32 -) else ( -set MACHINE_TYPE=x86_64 -set DISTDIR=dist64 -) - -REM Clean up after old builds. -REM del /q /f *.exe *.msi 2>NUL -REM rmdir /s /q %DISTDIR% - rem /MP Use all CPU cores. rem /FS force synchronous PDB writes (prevents PDB corruption with /MP) rem /EHsc Do not handle SEH in try / except blocks. @@ -128,7 +135,7 @@ set CXXFLAGS=/MP /FS /EHsc set CFLAGS=/MP /FS /EHsc set PATH=%BIN_DIR%;%PATH% -scons.py mixxx makerelease toolchain=msvs winlib=%WINLIB_DIR% build=%BUILD_TYPE% staticlibs=1 staticqt=1 debug_assertions_fatal=1 verbose=0 machine=%MACHINE_TYPE% qtdir=%QTDIR% hss1394=1 mediafoundation=1 opus=1 localecompare=1 optimize=fastbuild virtualize=0 test=1 qt_sqlite_plugin=0 build_number_in_title_bar=0 bundle_pdbs=0 +scons.py %SCONS_NUMBER_PROCESSORS% mixxx %PARAM_INSTALLER% toolchain=msvs winlib=%WINLIB_DIR% build=%BUILD_TYPE% staticlibs=1 staticqt=1 debug_assertions_fatal=1 verbose=0 machine=%MACHINE_TYPE% qtdir=%QTDIR% hss1394=1 mediafoundation=1 opus=1 localecompare=1 optimize=%PARAM_OPTIMIZE% virtualize=0 test=%PARAM_TEST% qt_sqlite_plugin=0 build_number_in_title_bar=0 bundle_pdbs=0 IF ERRORLEVEL 1 ( echo ============================== @@ -144,3 +151,36 @@ exit /b 1 echo Mixxx built successfully ENDLOCAL ) +EXIT 0 + +:function_get_product +FOR %%Y IN (2019,2017) DO ( + FOR %%P IN (Community,Professional,Enterprise) DO ( + SET "LOCAL_VS_PATH=%PROGRAMFILES_PATH%\Microsoft Visual Studio\%%Y\%%P\VC" + IF EXIST "!LOCAL_VS_PATH!" ( + SET "BUILDTOOLS_PATH=!LOCAL_VS_PATH!" + ECHO Using Visual Studio %%Y %%P at: !LOCAL_VS_PATH! + EXIT /B 0 + ) + ) + REM FOR + SET "LOCAL_BT_PATH=%PROGRAMFILES_PATH%\Microsoft Visual Studio\%%Y\BuildTools\VC" + IF EXIST "!LOCAL_BT_PATH!" ( + SET "BUILDTOOLS_PATH=!LOCAL_BT_PATH!" + ECHO Using BuildTools %%Y at: !LOCAL_BT_PATH! + EXIT /B 0 + ) + REM BT +) +REM FOR +EXIT /B 1 + + +:function_has_64bit +FOR /F %%G IN ('dir "%BUILDTOOLS_PATH%\Tools\MSVC\%PARAM_VCVARSVER%*" /b /ad-h /o-n') DO ( + set "LOCAL_64_CL=%BUILDTOOLS_PATH%\Tools\MSVC\%%G\bin\Hostx64\x64\cl.exe" + if EXIST "!LOCAL_64_CL!" ( + EXIT /B 0 + ) +) +EXIT /B 1
\ No newline at end of file |