Visual Studio Projects: Change project file conversions adding XP support to be reasonably well behaved during a parallel build.

This commit is contained in:
Mark Pizzolato 2015-09-03 12:18:35 -07:00
parent 8bb494036c
commit 87b6dbaa6c
3 changed files with 37 additions and 27 deletions

View file

@ -26,6 +26,8 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
Description="Check for required build dependencies &amp; git commit id"
CommandLine="Pre-Build-Event.cmd $(InputFileName)"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
@ -105,6 +107,8 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
Description="Check for required build dependencies &amp; git commit id"
CommandLine="Pre-Build-Event.cmd $(InputFileName)"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"

View file

@ -124,7 +124,7 @@
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
OmitFramePointers="true" OmitFramePointers="true"
WholeProgramOptimization="true" WholeProgramOptimization="false"
AdditionalIncludeDirectories="./;../;../PDP11/;&quot;../../windows-build/winpcap/Wpdpack/Include&quot;;&quot;../../windows-build/PCRE/include/&quot;;&quot;../../windows-build/pthreads&quot;" AdditionalIncludeDirectories="./;../;../PDP11/;&quot;../../windows-build/winpcap/Wpdpack/Include&quot;;&quot;../../windows-build/PCRE/include/&quot;;&quot;../../windows-build/pthreads&quot;"
PreprocessorDefinitions="USE_SHARED;USE_DISPLAY;VM_PDP11;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;PTW32_STATIC_LIB;SIM_ASYNCH_IO;USE_READER_THREAD;SIM_NEED_GIT_COMMIT_ID;HAVE_PCREPOSIX_H;PCRE_STATIC" PreprocessorDefinitions="USE_SHARED;USE_DISPLAY;VM_PDP11;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;PTW32_STATIC_LIB;SIM_ASYNCH_IO;USE_READER_THREAD;SIM_NEED_GIT_COMMIT_ID;HAVE_PCREPOSIX_H;PCRE_STATIC"
StringPooling="true" StringPooling="true"

View file

@ -29,51 +29,57 @@ rem the current commit id is generated if git.exe is available in the
rem current path. rem current path.
rem - performing the activities which make the git repository commit id rem - performing the activities which make the git repository commit id
rem available in an include file during compiles. rem available in an include file during compiles.
rem - Converting Visual Studio Projects to a form which will produce
rem binaries which run on Windows XP if the current build environment
rem supports it and the correct components are installed.
rem rem
rem rem
if exist PlatformToolset.fix exit /b 1
if "%~x1" == ".vcproj" goto _done_xp_check if "%~x1" == ".vcproj" goto _done_xp_check
if not "%~x1" == ".vcxproj" goto _next_arg if not "%~x1" == ".vcxproj" goto _next_arg
findstr PlatformToolset %1 >NUL findstr PlatformToolset %1 >NUL
if ERRORLEVEL 1 goto _next_arg if ERRORLEVEL 1 goto _next_arg
findstr PlatformToolset %1 | findstr _xp >NUL findstr PlatformToolset %1 | findstr _xp >NUL
if not ERRORLEVEL 1 goto _done_xp_check if not ERRORLEVEL 1 goto _done_xp_check
echo *********************************************************
echo *********************************************************
echo warning: The %~n1.exe binary can't run on windows XP. echo warning: The %~n1.exe binary can't run on windows XP.
echo warning: Adding Windows XP suppport to all of the project files
echo *********************************************************
echo *********************************************************
set _XP_Support_Available= set _XP_Support_Available=
for /r "%PROGRAMDATA%" %%z in (packages\XPSupport\Win_XPSupport.msi) do if exist "%%z" set _XP_Support_Available=1 for /r "%PROGRAMDATA%" %%z in (packages\XPSupport\Win_XPSupport.msi) do if exist "%%z" set _XP_Support_Available=1
if "" == "%_XP_Support_Available%" goto _done_xp_check if "" == "%_XP_Support_Available%" goto _done_xp_check
if exist PlatformToolset.fix exit /b 1
echo. >>PlatformToolset.fix
if ERRORLEVEL 1 exit /B 1
set /a _SleepTime= 4 + %RANDOM% %% %NUMBER_OF_PROCESSORS%
ping -n %_SleepTime% localhost > NUL
echo warning: Adding Windows XP suppport to all project files at %TIME%
echo Set objFSO = CreateObject("Scripting.FileSystemObject") >>PlatformToolset.fix.vbs echo Set objFSO = CreateObject("Scripting.FileSystemObject") >>%1.fix.vbs
echo Set objFile = objFSO.OpenTextFile(Wscript.Arguments(0), 1) >>PlatformToolset.fix.vbs echo Set objFile = objFSO.OpenTextFile(Wscript.Arguments(0), 1) >>%1.fix.vbs
echo. >>PlatformToolset.fix.vbs echo. >>%1.fix.vbs
echo strText = objFile.ReadAll >>PlatformToolset.fix.vbs echo strText = objFile.ReadAll >>%1.fix.vbs
echo objFile.Close >>PlatformToolset.fix.vbs echo objFile.Close >>%1.fix.vbs
echo strNewText = Replace(strText, "</PlatformToolset>", "_xp</PlatformToolset>") >>PlatformToolset.fix.vbs echo strNewText = Replace(strText, "</PlatformToolset>", "_xp</PlatformToolset>") >>%1.fix.vbs
echo. >>PlatformToolset.fix.vbs echo. >>%1.fix.vbs
echo Set objFile = objFSO.OpenTextFile(Wscript.Arguments(0), 2) >>PlatformToolset.fix.vbs echo Set objFile = objFSO.OpenTextFile(Wscript.Arguments(0), 2) >>%1.fix.vbs
echo objFile.Write strNewText >>PlatformToolset.fix.vbs echo objFile.Write strNewText >>%1.fix.vbs
echo objFile.Close >>PlatformToolset.fix.vbs echo objFile.Close >>%1.fix.vbs
cd
for %%f in (*.vcxproj) do call :_Fix_PlatformToolset %%f call :_Fix_PlatformToolset %1 %1
del PlatformToolset.fix.vbs for %%f in (*.vcxproj) do call :_Fix_PlatformToolset %1 %%f
echo ********************************************************* call :_GitHooks
echo ********************************************************* del %1.fix.vbs
rem wait a bit here to allow a parallel build of the to complete additional projects
ping -n 10 localhost > NUL
del PlatformToolset.fix
echo Error: Reload the changed projects and start the build again echo Error: Reload the changed projects and start the build again
echo *********************************************************
echo *********************************************************
exit /B 1 exit /B 1
:_Fix_PlatformToolset :_Fix_PlatformToolset
findstr PlatformToolset %1 >NUL findstr PlatformToolset %2 >NUL
if ERRORLEVEL 1 exit /B 0 if ERRORLEVEL 1 exit /B 0
findstr PlatformToolset %1 | findstr _xp >NUL findstr PlatformToolset %2 | findstr _xp >NUL
if not ERRORLEVEL 1 exit /B 0 if not ERRORLEVEL 1 exit /B 0
echo Adding XP support to project %1 echo Adding XP support to project %2
cscript PlatformToolset.fix.vbs %1 > NUL 2>&1 cscript %1.fix.vbs %2 > NUL 2>&1
exit /B 0 exit /B 0
:_done_xp_check :_done_xp_check
shift shift