Fix build_init vcxproj to correctly detect changes in config.h.
authorlateralusX <lateralusx.github@gmail.com>
Wed, 28 Dec 2016 15:50:54 +0000 (16:50 +0100)
committerlateralusX <lateralusx.github@gmail.com>
Wed, 28 Dec 2016 15:50:54 +0000 (16:50 +0100)
build_init project doesn't detect changes done in config.h. This is needed in order
for build_init to replace config.h with winconfig.h and backup cygconfig.h. This is
normally an issue if you do a reconfigure and build using make and then msbuild. The msbuild
will then fail, since config.h is still the cygwin version. Solution is to do a rebuild all
that will trigger build_init. This fix will make sure that build_init gets invoked if there has been a change to config.h.

There was also a very old issue with the first copy of config.h -> cygconfig.h. This is only done
if there is no cygconfig.h in the directory. This means that the cygconfig.h will not be update until
deleted and a new build_init has been invoked. This fix will make sure cygconfig.h is always updated
if config.h is the cygwin generated version (not already replaced with winconfig.h).

msvc/backup-config-files.ps1 [new file with mode: 0644]
msvc/build-init.vcxproj
msvc/build-init.vcxproj.filters
msvc/mono.sln
msvc/winsetup.bat

diff --git a/msvc/backup-config-files.ps1 b/msvc/backup-config-files.ps1
new file mode 100644 (file)
index 0000000..691968e
--- /dev/null
@@ -0,0 +1,32 @@
+##############################################################################
+##
+## backup-config-files
+##
+##############################################################################
+
+<#
+
+.SYNOPSIS
+
+Backup mono build configuration files, if needed.
+
+#>
+
+param(
+
+    ## config header file.
+    $mono_config,
+
+    ## cygconfig header file.
+    $mono_cygconfig
+)
+
+$include_cygconfig = Get-Content $mono_config | Select-String -pattern '#include[ ]*\"cygconfig.h\"[ ]*'
+if($include_cygconfig -eq $null)
+{
+       ## Backup mono_config into mono_cygconfig, overweiring any existing file.
+       Write-Host "Backup " $mono_config " -> " $mono_cygconfig
+       Copy-Item $mono_config $mono_cygconfig -Force
+}
+
+exit 0;
index ee690bc78ca3e67ca0ebcfe4c8c70d57d0b6f3ac..e4bd714670e63581ec790a804e282bc56bdb1ee2 100644 (file)
       <Platform>x64</Platform>\r
     </ProjectConfiguration>\r
   </ItemGroup>\r
+  <ItemGroup>\r
+    <ClInclude Include="..\config.h" />\r
+    <ClInclude Include="..\eglib\config.h" />\r
+  </ItemGroup>\r
   <PropertyGroup Label="Globals">\r
     <ProjectGuid>{92AE7622-5F58-4234-9A26-9EC71876B3F4}</ProjectGuid>\r
     <RootNamespace>buildinit</RootNamespace>\r
       <Command>winsetup.bat</Command>\r
     </PostBuildEvent>\r
   </ItemDefinitionGroup>\r
-  <ItemGroup>\r
-  </ItemGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
   <ImportGroup Label="ExtensionTargets">\r
   </ImportGroup>\r
index ef1ebf5863085ff88d134e852a444e604664a72f..bcde289799bbc7396efdb4c44d411061fb708f4b 100644 (file)
@@ -1,2 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
\ No newline at end of file
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup>\r
+    <ClInclude Include="..\eglib\config.h" />\r
+    <ClInclude Include="..\config.h" />\r
+  </ItemGroup>\r
+</Project>
\ No newline at end of file
index 0dcd61f4c59cd4fde9fcf70ed3c7812c8c9ae067..9a8a64ddfd483c8783ce94f727adf73c4d1312f4 100644 (file)
@@ -1,6 +1,6 @@
 Microsoft Visual Studio Solution File, Format Version 12.00\r
 # Visual Studio 14\r
-VisualStudioVersion = 14.0.25123.0\r
+VisualStudioVersion = 14.0.25420.1\r
 MinimumVisualStudioVersion = 10.0.40219.1\r
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EmbeddedSamples", "EmbeddedSamples", "{5FE09AA5-C3C9-45EA-A323-36A11B653CEC}"\r
 EndProject\r
@@ -12,12 +12,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{ECA11C76
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "genmdesc", "genmdesc.vcxproj", "{B7098DFA-31E6-4006-8A15-1C9A4E925149}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmono", "libmono.vcxproj", "{CB0D9E92-293C-439C-9AC7-C5F59B6E0771}"\r
        ProjectSection(ProjectDependencies) = postProject\r
                {EB56000B-C80B-4E8B-908D-D84D31B517D3} = {EB56000B-C80B-4E8B-908D-D84D31B517D3}\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {C36612BD-22D3-4B95-85E2-7FDC4FC5D739} = {C36612BD-22D3-4B95-85E2-7FDC4FC5D739}\r
                {8FC2B0C8-51AD-49DF-851F-5D01A77A75E4} = {8FC2B0C8-51AD-49DF-851F-5D01A77A75E4}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
@@ -26,44 +28,54 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmono", "libmono.vcxproj"
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-invoke", "test-invoke.vcxproj", "{C5639B3F-288A-4A4B-A4A5-C0D85834221D}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0771} = {CB0D9E92-293C-439C-9AC7-C5F59B6E0771}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "teste", "teste.vcxproj", "{6FDE4E5E-57D0-432F-A987-6C226A7827E4}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0771} = {CB0D9E92-293C-439C-9AC7-C5F59B6E0771}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono", "mono.vcxproj", "{A0EDDCD9-940F-432C-A28F-7EF322437D79}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0771} = {CB0D9E92-293C-439C-9AC7-C5F59B6E0771}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgc", "libgc.vcxproj", "{EB56000B-C80B-4E8B-908D-D84D31B517D3}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
+       EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "monodis", "monodis.vcxproj", "{37F50E5A-4818-46CF-81FE-4BB06DE5D42E}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0771} = {CB0D9E92-293C-439C-9AC7-C5F59B6E0771}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pedump", "pedump.vcxproj", "{84C7DB50-D6F8-4C47-B22C-6BB203AEB4D3}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0771} = {CB0D9E92-293C-439C-9AC7-C5F59B6E0771}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "monograph", "monograph.vcxproj", "{CA2A69D6-3B9D-45A5-8BF7-4E242E683122}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0771} = {CB0D9E92-293C-439C-9AC7-C5F59B6E0771}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-metadata", "test-metadata.vcxproj", "{C2EB666E-9146-4B7A-85F6-25F9EA313770}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0771} = {CB0D9E92-293C-439C-9AC7-C5F59B6E0771}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
@@ -75,38 +87,47 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eglib", "eglib.vcxproj", "{
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_eglib", "test_eglib.vcxproj", "{80A0620A-3478-4E1A-AA7C-0D2387B892AB}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0771} = {CB0D9E92-293C-439C-9AC7-C5F59B6E0771}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtest", "libtest.vcxproj", "{5A435710-E6D2-4DD4-9B3F-A7239A32C6F4}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0771} = {CB0D9E92-293C-439C-9AC7-C5F59B6E0771}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "monoposixhelper", "monoposixhelper.vcxproj", "{33014734-0F46-4099-9A21-0C989E428681}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jay", "..\mcs\jay\jay.vcxproj", "{5D485D32-3B9F-4287-AB24-C8DA5B89F537}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
+       EndProjectSection\r
 EndProject\r
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Profilers", "Profilers", "{4CFD7702-60B2-4E82-BFAD-FCBB53EB4DA2}"\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "profiler-vtune", "profiler-vtune.vcxproj", "{F51017F9-B7FB-4F87-B7B5-12799D965783}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {CB0D9E92-293C-439C-9AC7-C5F59B6E0771} = {CB0D9E92-293C-439C-9AC7-C5F59B6E0771}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmonoutils", "libmonoutils.vcxproj", "{8FC2B0C8-51AD-49DF-851F-5D01A77A75E4}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmonoruntime", "libmonoruntime.vcxproj", "{C36612BD-22D3-4B95-85E2-7FDC4FC5D739}"\r
        ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
                {158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}\r
        EndProjectSection\r
 EndProject\r
@@ -156,20 +177,38 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgcmonosgen", "libgcmonos
        EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-mini-regression-test", "mono-mini-regression-test.vcxproj", "{3E0D229E-C39F-4EDA-9A6A-A33ECEA0322D}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
+       EndProjectSection\r
 EndProject\r
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "jit", "jit", "{A0068765-334B-414C-8E21-8376CD2EC9F6}"\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmono-static", "libmono-static.vcxproj", "{CB0D9E92-293C-439C-9AC7-C5F59B6E0772}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
+       EndProjectSection\r
 EndProject\r
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "full-aot", "full-aot", "{BACF489E-EAEB-42BF-9E0A-C54D7CF455B4}"\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-full-aot-compile-test", "mono-full-aot-compile-test.vcxproj", "{C7D83158-4EB6-4409-8730-612AD45FAF6A}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
+       EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-full-aot-run-test", "mono-full-aot-run-test.vcxproj", "{6C64262B-077B-4E12-AF91-9409ECCB75F6}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
+       EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-testdriver-test", "mono-testdriver-test.vcxproj", "{7BECCFA0-28A0-4995-9856-558560F720E6}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
+       EndProjectSection\r
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mono-nunit-test", "mono-nunit-test.vcxproj", "{0046B994-40A8-4C64-AC9D-429DC9177B54}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+               {92AE7622-5F58-4234-9A26-9EC71876B3F4} = {92AE7622-5F58-4234-9A26-9EC71876B3F4}\r
+       EndProjectSection\r
 EndProject\r
 Global\r
        GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
@@ -431,9 +470,9 @@ Global
                {0046B994-40A8-4C64-AC9D-429DC9177B54} = {A0068765-334B-414C-8E21-8376CD2EC9F6}\r
        EndGlobalSection\r
        GlobalSection(ExtensibilityGlobals) = postSolution\r
-               AMDCaProjectFile = C:\Users\Owner\Development\monogit\mono\msvc\CodeAnalyst\mono.caw\r
-               AMDCaPersistentStartup = mono\r
                AMDCaPersistentConfig = Debug|Win32\r
+               AMDCaPersistentStartup = mono\r
+               AMDCaProjectFile = C:\Users\Owner\Development\monogit\mono\msvc\CodeAnalyst\mono.caw\r
        EndGlobalSection\r
        GlobalSection(DPCodeReviewSolutionGUID) = preSolution\r
                DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}\r
index f25016fd5f5e872c9e58c95ae6e5779cfb2d8e6d..e6afb26d8ff37979b08de265bda5f08c04d6ce23 100755 (executable)
@@ -12,19 +12,9 @@ SET VERSION_H=..\mono\mini\version.h
 
 ECHO Setting up Mono configuration headers...
 
-IF EXIST %CONFIG_H% (
-       IF NOT EXIST %CYG_CONFIG_H% (
-               ECHO copy %CONFIG_H% %CYG_CONFIG_H%
-               copy %CONFIG_H% %CYG_CONFIG_H%
-       )
-)
-
-IF EXIST %EGLIB_CONFIG_H% (
-       IF NOT EXIST %EGLIB_CYG_CONFIG_H% (
-               ECHO copy %EGLIB_CONFIG_H% %EGLIB_CYG_CONFIG_H%
-               copy %EGLIB_CONFIG_H% %EGLIB_CYG_CONFIG_H%
-       )
-)
+REM Backup existing config.h into cygconfig.h if its not already replaced.
+%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File backup-config-files.ps1 %CONFIG_H% %CYG_CONFIG_H% 2>&1
+%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File backup-config-files.ps1 %EGLIB_CONFIG_H% %EGLIB_CYG_CONFIG_H% 2>&1
 
 %windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-files.ps1 %WIN_CONFIG_H% %CONFIG_H% %CONFIGURE_AC% 2>&1