mpir/build.vc/gen_test_config_props.bat

73 lines
2.6 KiB
Batchfile
Raw Normal View History

2015-07-22 17:39:24 -04:00
@echo off
2015-11-19 11:30:52 -05:00
rem %1 = plat
rem %2 = conf
rem %3 = output directory
2015-07-22 17:39:24 -04:00
rem output_params.bat contains:
rem (set ldir=architecture)
rem (set libr=lib)
rem (set plat=x64)
rem (set conf=Release)
2015-07-27 10:33:56 -04:00
set prefix=..\..\
2015-07-22 17:39:24 -04:00
call :clrerr
2015-07-27 10:33:56 -04:00
if exist output_params.bat (call output_params.bat) else (call :seterr & echo ERROR: 'output_params.bat' not found & exit /b %errorlevel%)
2015-07-22 17:39:24 -04:00
set lib_dir=%prefix%%ldir%\%plat%\%conf%
2015-11-19 11:30:52 -05:00
2015-07-22 17:39:24 -04:00
if /i "%plat%" EQU "" (call :seterr & echo ERROR: 'output_params.bat' is corrupt & exit /b %errorlevel%)
if /i "%1" NEQ "%plat%" goto bad_config
if /i "%2" NEQ "%conf%" goto bad_config
set rt_lib=MultiThreaded
if /i "%conf%" EQU "Debug" (set rt_lib=%rt_lib%Debug)
if /i "%libr%" EQu "DLL" (set rt_lib=%rt_lib%DLL)
echo ^<?xml version="1.0" encoding="utf-8"?^> >tmp.props
echo ^<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"^> >>tmp.props
echo ^<PropertyGroup Label="UserMacros"^> >>tmp.props
echo ^<MPDIR^>%prefix%%ldir%%plat%\%conf%\^</MPDIR^> >>tmp.props
if /i "%libr%" EQU "LIB" (
echo ^<MPLIBS^>%prefix%%ldir%%plat%\%conf%\mpir.lib;%prefix%lib_mpir_cxx\%plat%\%conf%\mpirxx.lib^</MPLIBS^> >>tmp.props
) else (
echo ^<MPLIBS^>%prefix%%ldir%%plat%\%conf%\mpir.lib^</MPLIBS^> >>tmp.props
)
2015-07-22 17:39:24 -04:00
echo ^</PropertyGroup^> >>tmp.props
echo ^<ItemDefinitionGroup^> >>tmp.props
echo ^<ClCompile^> >>tmp.props
echo ^<RuntimeLibrary^>%rt_lib%^</RuntimeLibrary^> >>tmp.props
echo ^<AdditionalIncludeDirectories^>$(MPDIR);$(SolutionDir)..\tests^</AdditionalIncludeDirectories^> >>tmp.props
if /i "%libr%" EQU "DLL" (
echo ^<PreprocessorDefinitions^>__GMP_LIBGMP_DLL^</PreprocessorDefinitions^> >>tmp.props
)
echo ^</ClCompile^> >>tmp.props
echo ^<Link^> >>tmp.props
echo ^<AdditionalDependencies^>$(MPLIBS);$(OutDir)\add-test-lib.lib;%%(AdditionalDependencies)^</AdditionalDependencies^> >>tmp.props
echo ^</Link^> >>tmp.props
echo ^</ItemDefinitionGroup^> >>tmp.props
echo ^<ItemGroup^> >>tmp.props
echo ^<BuildMacro Include="MPDIR"^> >>tmp.props
echo ^<Value^>$(MPDIR)^</Value^> >>tmp.props
echo ^<EnvironmentVariable^>true^</EnvironmentVariable^> >>tmp.props
echo ^</BuildMacro^> >>tmp.props
echo ^<BuildMacro Include="MPLIBS"^> >>tmp.props
echo ^<Value^>$(MPLIBS)^</Value^> >>tmp.props
echo ^<EnvironmentVariable^>true^</EnvironmentVariable^> >>tmp.props
echo ^</BuildMacro^> >>tmp.props
echo ^</ItemGroup^> >>tmp.props
echo ^</Project^> >>tmp.props
2015-11-19 11:30:52 -05:00
call out_copy_rename tmp.props ..\build.vc%3 test-config.props verb
2015-07-22 17:39:24 -04:00
del tmp.props
goto clrerr
:bad_config
call :seterr
exit /b %errorlevel%
:clrerr
exit /b 0
:seterr
exit /b 1