MSVC 2010+ Projects: Update "Installation" Process
authorChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 9 Jun 2014 02:27:36 +0000 (10:27 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 9 Jun 2014 02:27:36 +0000 (10:27 +0800)
Currently, due to the way that Visual Studio 2010+ projects are handled,
the "install" project does not re-build upon changes to the sources, as it
does not believe that its dependencies have changed, although the changed
sources are automatically recompiled.  This means that if a part or more
of the solution does not build, or if the sources need some other fixes
or enhancements, the up-to-date build is not copied automatically, which
can be misleading.

Improve on the situation by forcing the "install" project to trigger its
rebuild, so that the updated binaries can be copied.  This does trigger an
MSBuild warning, but having that warning is way better than not having an
up-to-date build, especially during testing and development.

build/win32/vs10/glib-install.props
build/win32/vs10/install.vcxproj

index 0a55052..37b4c46 100644 (file)
@@ -4,28 +4,33 @@
     <Import Project="glib-build-defines.props" />
   </ImportGroup>
   <PropertyGroup Label="UserMacros">
+    <BinDir>$(SolutionDir)$(Configuration)\$(Platform)\bin</BinDir>
+    <InstalledDlls>$(BinDir)\$(GlibDllPrefix)glib(GlibDllSuffix).dll;$(BinDir)\$(GlibDllPrefix)gthread(GlibDllSuffix).dll;$(BinDir)\$(GlibDllPrefix)gmodule(GlibDllSuffix).dll;$(BinDir)\$(GlibDllPrefix)gobject(GlibDllSuffix).dll;$(BinDir)\$(GlibDllPrefix)gio(GlibDllSuffix).dll</InstalledDlls>
+    <InstalledBins>$(BinDir)\glib-genmarshal.exe;$(BinDir)\glib-compile-schemas.exe;$(BinDir)\gsettings.exe;$(BinDir)\glib-compile-resources.exe;$(BinDir)\gresource.exe;$(BinDir)\gio-querymodules.exe;$(BinDir)\gdbus.exe</InstalledBins>
+    <InstalledWin32Bins>$(BinDir)\gspawn-win32-helper.exe;$(BinDir)\gspawn-win32-helper-console.exe</InstalledWin32Bins>
+    <InstalledX64Bins>$(BinDir)\gspawn-win64-helper.exe;$(BinDir)\gspawn-win64-helper-console.exe</InstalledX64Bins>
     <GlibDoInstall>
 mkdir $(CopyDir)
 
 mkdir $(CopyDir)\bin
 
-copy $(SolutionDir)$(Configuration)\$(Platform)\bin\*.dll $(CopyDir)\bin
+copy $(BinDir)\*.dll $(CopyDir)\bin
 
-copy $(SolutionDir)$(Configuration)\$(Platform)\bin\glib-genmarshal.exe $(CopyDir)\bin
+copy $(BinDir)\glib-genmarshal.exe $(CopyDir)\bin
 
-copy $(SolutionDir)$(Configuration)\$(Platform)\bin\gspawn-win*-helper*.exe $(CopyDir)\bin
+copy $(BinDir)\gspawn-win*-helper*.exe $(CopyDir)\bin
 
-copy $(SolutionDir)$(Configuration)\$(Platform)\bin\glib-compile-schemas.exe $(CopyDir)\bin
+copy $(BinDir)\glib-compile-schemas.exe $(CopyDir)\bin
 
-copy $(SolutionDir)$(Configuration)\$(Platform)\bin\gsettings.exe $(CopyDir)\bin
+copy $(BinDir)\gsettings.exe $(CopyDir)\bin
 
-copy $(SolutionDir)$(Configuration)\$(Platform)\bin\glib-compile-resources.exe $(CopyDir)\bin
+copy $(BinDir)\glib-compile-resources.exe $(CopyDir)\bin
 
-copy $(SolutionDir)$(Configuration)\$(Platform)\bin\gresource.exe $(CopyDir)\bin
+copy $(BinDir)\gresource.exe $(CopyDir)\bin
 
-copy $(SolutionDir)$(Configuration)\$(Platform)\bin\gio-querymodules.exe $(CopyDir)\bin
+copy $(BinDir)\gio-querymodules.exe $(CopyDir)\bin
 
-copy $(SolutionDir)$(Configuration)\$(Platform)\bin\gdbus.exe $(CopyDir)\bin
+copy $(BinDir)\gdbus.exe $(CopyDir)\bin
 
 copy ..\..\..\gio\gdbus-2.0\codegen\gdbus-codegen.in $(CopyDir)\bin\gdbus-codegen
 
@@ -533,7 +538,7 @@ mkdir $(CopyDir)\lib\glib-$(ApiVersion)\include
 copy ..\..\..\glib\glibconfig.h $(CopyDir)\lib\glib-$(ApiVersion)\include
 
 
-copy $(SolutionDir)$(Configuration)\$(Platform)\bin\*-$(ApiVersion).lib $(CopyDir)\lib
+copy $(BinDir)\*-$(ApiVersion).lib $(CopyDir)\lib
 
 
 mkdir $(CopyDir)\share\glib-$(ApiVersion)\schemas
@@ -551,6 +556,21 @@ copy ..\..\..\gio\gdbus-2.0\codegen\*.py $(CopyDir)\share\glib-$(ApiVersion)\cod
     <_PropertySheetDisplayName>glibinstallprops</_PropertySheetDisplayName>
   </PropertyGroup>
   <ItemGroup>
+    <BuildMacro Include="BinDir">
+      <Value>$(BinDir)</Value>
+    </BuildMacro>
+    <BuildMacro Include="InstalledDlls">
+      <Value>$(InstalledDlls)</Value>
+    </BuildMacro>
+    <BuildMacro Include="InstalledBins">
+      <Value>$(InstalledBins)</Value>
+    </BuildMacro>
+    <BuildMacro Include="InstalledWin32Bins">
+      <Value>$(InstalledWin32Bins)</Value>
+    </BuildMacro>
+    <BuildMacro Include="InstalledX64Bins">
+      <Value>$(InstalledX64Bins)</Value>
+    </BuildMacro>
     <BuildMacro Include="GlibDoInstall">
       <Value>$(GlibDoInstall)</Value>
     </BuildMacro>
index 0663334..219ac40 100644 (file)
     <ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <PreBuildEvent>
-      <Command>$(GlibDoInstall)</Command>
-    </PreBuildEvent>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <PreBuildEvent>
-      <Command>$(GlibDoInstall)</Command>
-    </PreBuildEvent>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <PreBuildEvent>
-      <Command>$(GlibDoInstall)</Command>
-    </PreBuildEvent>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <PreBuildEvent>
-      <Command>$(GlibDoInstall)</Command>
-    </PreBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <CustomBuild Include="..\..\..\config.h.win32">
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Installing Build Results...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GlibDoInstall)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InstalledDlls);$(InstalledBins);$(InstalledWin32Bins);%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Installing Build Results...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GlibDoInstall)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(InstalledDlls);$(InstalledBins);$(InstalledX64Bins);%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Installing Build Results...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GlibDoInstall)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InstalledDlls);$(InstalledBins);$(InstalledWin32Bins);%(Outputs)</Outputs>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Installing Build Results...</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GlibDoInstall)</Command>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(InstalledDlls);$(InstalledBins);$(InstalledX64Bins);%(Outputs)</Outputs>
+    </CustomBuild>
+  </ItemGroup>
+  <ItemGroup>
     <ProjectReference Include="gio.vcxproj">
       <Project>{f3d1583c-5613-4809-bd98-7cc1c1276f92}</Project>
       <ReferenceOutputAssembly>false</ReferenceOutputAssembly>