From 31e40652a975c8b633224d0bba3f90a840b9d693 Mon Sep 17 00:00:00 2001
From: Jan Tattermusch <jtattermusch@google.com>
Date: Wed, 11 Feb 2015 14:23:38 -0800
Subject: [PATCH] fixes to make shared libraries build

---
 .../vs2013/grpc_csharp_ext_shared.vcxproj.template         | 2 +-
 templates/vsprojects/vs2013/grpc_shared.vcxproj.template   | 2 +-
 templates/vsprojects/vs2013/vcxproj_defs.include           | 7 ++++++-
 vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj           | 2 ++
 vsprojects/vs2013/grpc_shared.vcxproj                      | 3 +++
 5 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/templates/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj.template b/templates/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj.template
index d389792c45..45f37a8c47 100644
--- a/templates/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj.template
+++ b/templates/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj.template
@@ -1,2 +1,2 @@
 <%namespace file="vcxproj_defs.include" import="gen_project"/>\
-${gen_project('grpc_csharp_ext', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{C26D04A8-37C6-44C7-B458-906C9FCE928C}')}
+${gen_project('grpc_csharp_ext', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{C26D04A8-37C6-44C7-B458-906C9FCE928C}', additional_props = ['winsock'])}
diff --git a/templates/vsprojects/vs2013/grpc_shared.vcxproj.template b/templates/vsprojects/vs2013/grpc_shared.vcxproj.template
index 55c2da4533..890189c28d 100644
--- a/templates/vsprojects/vs2013/grpc_shared.vcxproj.template
+++ b/templates/vsprojects/vs2013/grpc_shared.vcxproj.template
@@ -1,2 +1,2 @@
 <%namespace file="vcxproj_defs.include" import="gen_project"/>\
-${gen_project('grpc', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}', additional_props = ['ssl', 'winsock'])}
+${gen_project('grpc', libs, targets, configuration_type = 'DynamicLibrary', project_guid = '{F2EE8FDB-F1E0-43A0-A297-6F255BB52AAA}', additional_props = ['ssl', 'winsock'], depends_on_zlib = True)}
diff --git a/templates/vsprojects/vs2013/vcxproj_defs.include b/templates/vsprojects/vs2013/vcxproj_defs.include
index bb75803772..c8e6fd3c06 100644
--- a/templates/vsprojects/vs2013/vcxproj_defs.include
+++ b/templates/vsprojects/vs2013/vcxproj_defs.include
@@ -1,6 +1,6 @@
 <%def name="to_windows_path(path)">${path.replace('/','\\')}</%def>\
 <%def name="get_subsystem(is_library)">${'Windows' if is_library else 'Console'}</%def>\
-<%def name="gen_project(name, libs, targets, configuration_type = 'StaticLibrary', project_guid = None, additional_props = [])">\
+<%def name="gen_project(name, libs, targets, configuration_type = 'StaticLibrary', project_guid = None, additional_props = [], depends_on_zlib = False)">\
 % for project in vsprojects:
   % if project.name == name:
 <?xml version="1.0" encoding="utf-8"?>
@@ -112,6 +112,11 @@
       <Project>${vsproject_dict[dep].vs_project_guid}</Project>
     </ProjectReference>
     % endfor
+    % if depends_on_zlib:
+    <ProjectReference Include="third_party\zlibvc.vcxproj">
+      <Project>{8fd826f8-3739-44e6-8cc8-997122e53b8d}</Project>
+    </ProjectReference>
+    % endif
   </ItemGroup>
   % endif
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
diff --git a/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj b/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj
index 1ae420e27e..6ad268e0e9 100644
--- a/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj
+++ b/vsprojects/vs2013/grpc_csharp_ext_shared.vcxproj
@@ -35,10 +35,12 @@
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="global.props" />
+    <Import Project="winsock.props" />
   </ImportGroup>
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
     <Import Project="global.props" />
+    <Import Project="winsock.props" />
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup />
diff --git a/vsprojects/vs2013/grpc_shared.vcxproj b/vsprojects/vs2013/grpc_shared.vcxproj
index a6a2caadad..5388646767 100644
--- a/vsprojects/vs2013/grpc_shared.vcxproj
+++ b/vsprojects/vs2013/grpc_shared.vcxproj
@@ -411,6 +411,9 @@
     <ProjectReference Include="gpr.vcxproj">
       <Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project>
     </ProjectReference>
+    <ProjectReference Include="third_party\zlibvc.vcxproj">
+      <Project>{8fd826f8-3739-44e6-8cc8-997122e53b8d}</Project>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
-- 
GitLab