Merge pull request #18 from P-N-L/feature/fix-vs17-builds

Feature/fix vs17 builds
This commit is contained in:
Brian Gladman 2020-04-08 14:11:31 +01:00 committed by GitHub
commit f76ffd7758
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 23 deletions

View File

@ -5,14 +5,23 @@ rem %2 = last two digits of the Visual Studio version number (e.g. 17)
set vs_ver=%2
set str=%~1
rem delete anything from the path before 'msvc'
rem delete anything from the path before the FINAL 'msvc'
:dele
set str=%str:~1%
set str2=%str:~0,4%
if "%str2%" NEQ "msvc" goto dele
if "%str%" EQU "" (
goto dele_done
) else if "%str2%" EQU "msvc" (
set str_confirmed=%str%
)
goto dele
:dele_done
set str=%str_confirmed%
echo "Final subpath %str%"
rem we now have: msvc.\vs<nn>\<project_directory>\<win32|x64>\<debug|release>\mpir.<lib|dll>
rem extract: project_directory, platform (plat=<win32|x64>), configuration (conf=<debug|release>) and file name
rem extract: project_directory, platform (plat=<win32|x64>), configuration (conf=<debug|release>) and file name
set file=
for /f "tokens=1,2,3,4,5,6 delims=\" %%a in ("%str%") do set tloc=%%c&set plat=%%d&set conf=%%e&set file=%%f
@ -38,7 +47,7 @@ set bin_dir="..\%extn%\%plat%\%conf%\"
set hdr_dir="..\%extn%\%plat%\%conf%\"
rem output parametrers for the MPIR tests
if /i "%filename%" EQU "mpirxx" goto skip
if /i "%filename%" EQU "mpirxx" goto skip
echo (set ldir=%loc%) > output_params.bat
echo (set libr=%extn%) >> output_params.bat
echo (set plat=%plat%) >> output_params.bat
@ -55,7 +64,7 @@ exit /b 0
rem copy binaries to final bin_dirination directory
rem %1 = target (build output) directory
rem %2 = binary destination directory
rem %3 = configuration (debug/release)
rem %3 = configuration (debug/release)
rem %4 = library (lib/dll)
rem %5 = file name
:copyb
@ -65,7 +74,7 @@ if "%4" EQU "dll" (
copy %1mpir.lib %2mpir.lib > nul 2>&1
if exist %1mpir.pdb (copy %1mpir.pdb %2mpir.pdb > nul 2>&1)
) else if "%4" EQU "lib" (
if "%5" EQU "mpir" (
if "%5" EQU "mpir" (
if exist %1mpir.lib (
copy %1mpir.lib %2mpir.lib > nul 2>&1
if exist %1mpir.pdb (copy %1mpir.pdb %2mpir.pdb > nul 2>&1)

View File

@ -6,25 +6,29 @@ rem %4 = configuration (Release|Debug)
rem %5 = Windows SDK Version
rem %6 = build tests (|+tests)
setlocal ENABLEDELAYEDEXPANSION
rem Visual Studio version (2013, 2015 or 2017)
set vs_version=2017
rem find the MSBUILD installation directory
if "%vs_version%" EQU "2013" (
set msbdir="C:\Program Files (x86)\MSBuild\12.0\Bin"
if NOT DEFINED msbdir (
if "%vs_version%" EQU "2013" (
set msbdir="C:\Program Files (x86)\MSBuild\12.0\Bin"
) else if "%vs_version%" EQU "2015" (
set msbdir="C:\Program Files (x86)\MSBuild\14.0\Bin"
set msbdir="C:\Program Files (x86)\MSBuild\14.0\Bin"
) else if "%vs_version%" EQU "2017" (
set vsw_exe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
for /f "usebackq tokens=*" %%i in (`%vsw_exe% -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set InstallDir=%%i
)
if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
set msbdir="%InstallDir%\MSBuild\15.0\Bin"
)
set vsw_exe="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
for /f "usebackq tokens=*" %%i in (`!vsw_exe! -latest -products * -requires Microsoft.Component.MSBuild -property installationPath`) do (
set InstallDir=%%i
)
if exist "!InstallDir!\MSBuild\15.0\Bin\MSBuild.exe" (
set msbdir="!InstallDir!\MSBuild\15.0\Bin"
)
) else (
echo "Visual Studio %vs_version% is not supported" & exit /b %errorlevel%
echo "Visual Studio %vs_version% is not supported" & exit /b %errorlevel%
)
)
if "%4" NEQ "" if "%3" NEQ "" if "%2" NEQ "" if "%1" NEQ "" goto cont
call :get_architectures -
@ -39,24 +43,27 @@ if /i "%2" EQU "DLL" (set libp=dll) else (if /i "%2" EQU "LIB" (set libp=lib) el
if /i "%3" EQU "x64" (set plat=x64) else (if /i "%3" EQU "Win32" (set plat=win32) else (call :seterr & echo ERROR: platform is "Win32" or "x64" ^(not "%3"^) & exit /b %errorlevel%))
if /i "%4" EQU "Debug" (set conf=Debug) else (if /i "%4" EQU "Release" (set conf=Release) else (call :seterr & echo ERROR: configuration is "Release" or "Debug" ^(not "%4"^) & exit /b %errorlevel%))
if /i "%5" NEQ "" if "%5" EQU "+tests" (set run_tests=y) else (set win_sdk=%5)
if /i "%6" NEQ "" if "%6" EQU "+tests" (set run_tests=y)
if /i "%6" NEQ "" if "%6" EQU "+tests" (set run_tests=y)
set src=%libp%_mpir_%1
rem This is the Visual Studio build directory (within the MPIR directory)
rem This is the Visual Studio build directory (within the MPIR directory)
set srcdir=.
echo %msbdir%\msbuild.exe /p:Platform=%plat% /p:Configuration=%conf% /p:"Windows%20SDK%20Version=%win_sdk%" %srcdir%\%src%\%src%.vcxproj
%msbdir%\msbuild.exe /p:Platform=%plat% /p:Configuration=%conf% /p:"Windows%20SDK%20Version=%win_sdk%" %srcdir%\%src%\%src%.vcxproj
echo !msbdir!\msbuild.exe /p:Platform=%plat% /p:Configuration=%conf% /p:"Windows%20SDK%20Version=%win_sdk%" %srcdir%\%src%\%src%.vcxproj
!msbdir!\msbuild.exe /p:Platform=%plat% /p:Configuration=%conf% /p:"Windows%20SDK%20Version=%win_sdk%" %srcdir%\%src%\%src%.vcxproj
if %errorlevel% NEQ 0 (echo ERROR: msbuild failed for main project with exit code %errorlevel% & exit /b %errorlevel%)
if /i "%libp%" == "LIB" (
%msbdir%\msbuild.exe /p:Platform=%plat% /p:Configuration=%conf% /p:"Windows%20SDK%20Version=%win_sdk%" %srcdir%\lib_mpir_cxx\lib_mpir_cxx.vcxproj
!msbdir!\msbuild.exe /p:Platform=%plat% /p:Configuration=%conf% /p:"Windows%20SDK%20Version=%win_sdk%" %srcdir%\lib_mpir_cxx\lib_mpir_cxx.vcxproj
if %errorlevel% NEQ 0 (echo ERROR: msbuild failed for lib project with exit code %errorlevel% & exit /b %errorlevel%)
)
if /i "%run_tests%" NEQ "" (
for /d %%d in (.\mpir-tests\*) do (
for %%f in (%%d\*.vcxproj) do (
%msbdir%\msbuild.exe /property:SolutionDir=..\..\ /property:OutDir=..\..\%plat%\%conf%\ /p:Platform=%plat% /p:Configuration=%conf% /p:"Windows%20SDK%20Version=%win_sdk%" %%f
!msbdir!\msbuild.exe /property:SolutionDir=..\..\ /property:OutDir=..\..\%plat%\%conf%\ /p:Platform=%plat% /p:Configuration=%conf% /p:"Windows%20SDK%20Version=%win_sdk%" %%f
if %errorlevel% NEQ 0 (echo ERROR: msbuild failed for test project %%f with exit code %errorlevel% & exit /b %errorlevel%)
)
)
)