Merged PR 1964543: Modify windows build scripts to set up MSVC environments for all Visual Studio 2017 versions

We used to require Visual Studio 2017 Enterprise to be installed. This change enables other versions of Visual Studio 2017, like Community.
This commit is contained in:
Ruben Guerrero Samaniego 2018-06-14 21:09:25 +00:00 коммит произвёл msftrubengu
Родитель 00f6d47495
Коммит c5a76f64c5
6 изменённых файлов: 77 добавлений и 86 удалений

Просмотреть файл

@ -32,7 +32,7 @@ list(APPEND RESOURCES_BLOCKMAP
"AppxPackaging/BlockMap/schema/BlockMapSchema2017.xsd")
# AppxManifests
if(HAVE_MSXML6)
if(XML_PARSER MATCHES msxml6)
# Used by AppxManifest and AppxBundleManifest
list(APPEND RESOURCES_APPXTYPES
"AppxPackaging/Manifest/Schema/2015/AppxManifestTypes.xsd")

Просмотреть файл

@ -1,46 +1,85 @@
@echo off
set build=%1
set val="-DUSE_VALIDATION_PARSER=off"
set zlib="-DUSE_SHARED_ZLIB=off"
:parseargs
IF /I "%~2" == "VALIDATE" (
set val="-DUSE_VALIDATION_PARSER=on"
if "%~1" == "" goto USAGE
if /I "%~1" == "--help" goto USAGE
if /I "%~1" == "-h" goto USAGE
if /I "%~1" == "/?" goto USAGE
:: Set up MSVC environment
:: Kudos to https://gist.github.com/AndrewPardoe/689a3b969670787d5dba538bb0a48a1e
pushd "%~dp0"
pushd %ProgramFiles(x86)%\"Microsoft Visual Studio"\Installer
for /f "usebackq tokens=*" %%i in (`vswhere -latest -prerelease -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
set VCINSTALLDIR=%%i\VC
)
IF /I "%~2" == "SHARED_ZLIB" (
popd
if exist %VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat (
if /I "%~1" == "x86" (
call "%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %1
) else (
if /I "%~1" == "x64" (
call "%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %1
) else goto USAGE
)
)
popd
set build="MinSizeRel"
set validationParser="-DUSE_VALIDATION_PARSER=off"
set zlib="-DUSE_SHARED_ZLIB=off"
set parser="-DXML_PARSER=msxml6"
:parseArgs
if /I "%~2" == "--debug" (
set build="Debug"
)
if /I "%~2" == "-d" (
set build="Debug"
)
if /I "%~2" == "--parser-xerces" (
set parser="-DXML_PARSER=xerces"
)
if /I "%~2" == "-px" (
set parser="-DXML_PARSER=xerces"
)
if /I "%~2" == "--validation-parser" (
set validationParser="-DUSE_VALIDATION_PARSER=on"
)
if /I "%~2" == "-vp" (
set validationParser="-DUSE_VALIDATION_PARSER=on"
)
if /I "%~2" == "--shared-zlib" (
set zlib="-DUSE_SHARED_ZLIB=on"
)
if /I "%~2" == "-sz" (
set zlib="-DUSE_SHARED_ZLIB=on"
)
shift /2
IF not "%~2"=="" goto parseargs
if not "%~2"=="" goto parseArgs
echo val = %val%
echo zlib = %zlib%
if not exist .vs md .vs
cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
IF /I "%build%" == "WIN32" (
echo calling makewin32.cmd %val% %zlib%
call makewin32.cmd %val% %zlib%
) ELSE (
IF /I "%build%" == "WIN32-x64" (
echo calling makewin32x64.cmd %val% %zlib%
call makewin32x64.cmd %val% %zlib%
) ELSE (
IF /I "%build%" == "WIN32chk" (
echo calling makewin32chk.cmd %val% %zlib%
call makewin32chk.cmd %val% %zlib%
) ELSE (
IF /I "%build%" == "WIN32-x64chk" (
echo calling makewin32x64chk.cmd %val% %zlib%
call makewin32x64chk.cmd %val% %zlib%
) ELSE (
goto FAIL
)
)
)
)
goto EXIT
:FAIL
echo specify one of [WIN32, WIN32-x64, WIN32chk, WIN32-x64chk] for 1st option. Required.
echo other options: VALIDATE to enable XML schema validation. SHARED_ZLIB to don't statically link zlib.
EXIT /B 0
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=%build% %validationParser% %zlib% %parser% -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=%build% %validationParser% %zlib% %parser% -G"NMake Makefiles" ..
nmake
goto Exit
:USAGE
echo Usage
echo:
echo makewin.cmd ^<x86^|x64^> [options]
echo:
echo Helper to build the MSIX SDK for Windows. Assumes the user has a version
echo of Visual Studio 2017 installed.
echo:
echo Options
echo --debug, -d = Build chk binary.
echo --parser-xerces, -px = use Xerces-C parser. Default MSXML6.
echo --validation-parser, -vp = enable XML schema validation.
echo --shared-zlib, -sz = don't statically link zlib.
echo --help, -h, /? = print this usage information and exit.
:Exit
echo done.
EXIT /B 0

Просмотреть файл

@ -1,12 +0,0 @@
REM HUZZA FOR: https://dmerej.info/blog/post/cmake-visual-studio-and-the-command-line/
if not exist .vs md .vs
cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
echo %cd%
set currentpath=%cd%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
cd /D %currentpath%
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 %2 -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 %2 -G"NMake Makefiles" ..
nmake

Просмотреть файл

@ -1,12 +0,0 @@
REM HUZZA FOR: https://dmerej.info/blog/post/cmake-visual-studio-and-the-command-line/
if not exist .vs md .vs
cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
echo %cd%
set currentpath=%cd%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
cd /D %currentpath%
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug %1 %2 -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug %1 %2 -G"NMake Makefiles" ..
nmake

Просмотреть файл

@ -1,12 +0,0 @@
REM HUZZA FOR: https://dmerej.info/blog/post/cmake-visual-studio-and-the-command-line/
if not exist .vs md .vs
cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
echo %cd%
set currentpath=%cd%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd /D %currentpath%
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 %2 -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=MinSizeRel %1 %2 -G"NMake Makefiles" ..
nmake

Просмотреть файл

@ -1,12 +0,0 @@
REM HUZZA FOR: https://dmerej.info/blog/post/cmake-visual-studio-and-the-command-line/
if not exist .vs md .vs
cd .vs
if exist CMakeFiles rd /s /q CMakeFiles
if exist CMakeCache.txt del CMakeCache.txt
echo %cd%
set currentpath=%cd%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd /D %currentpath%
echo cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug %1 %2 -G"NMake Makefiles" ..
cmake -DWIN32=on -DCMAKE_BUILD_TYPE=Debug %1 %2 -G"NMake Makefiles" ..
nmake