changed vsproject generation to make c++ tests; put a hint in the .sln about lib vs. target; expand .proto includes

pull/2506/head
Michael Larson 10 years ago
parent b542c821d1
commit b19d4ebba0
  1. 27
      templates/vsprojects/vcxproj_defs.include
  2. 2
      tools/buildgen/plugins/generate_vsprojects.py

@ -12,19 +12,21 @@
if t.name == name:
target = t
if not configuration_type and target:
print target.name
if target.build == 'test' or target.build == 'tool':
configuration_type = 'Application'
if not configuration_type:
configuration_type = 'StaticLibrary'
if not project_guid:
project_guid = project.vs_project_guid
if target.build == 'test' and target.language == 'c++':
props.extend(['cpptest'])
if configuration_type == 'Application':
print target.build
if target.build == 'protoc':
props.extend(['protoc'])
else:
props.extend(['winsock', 'protobuf', 'zlib', 'openssl'])
if target.language == 'c++':
props.extend(['protobuf'])
props.extend(['global'])
%>\
<?xml version="1.0" encoding="utf-8"?>
@ -113,6 +115,13 @@ ${gen_package_props(packages)}\
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>${name}</TargetName>
% if "zlib" in packages:
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
% endif
% if "openssl" in packages:
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
% endif
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>${name}</TargetName>
@ -200,8 +209,20 @@ ${gen_package_props(packages)}\
% if project.get('src',[]):
<ItemGroup>
% for src_name in project.src:
% if src_name.endswith(".proto"):
<% src_name_parts = src_name.split(".") %>\
<ClCompile Include="${get_repo_root()}\${to_windows_path(src_name_parts[0] + ".pb.cc")}">
</ClCompile>
<ClInclude Include="${get_repo_root()}\${to_windows_path(src_name_parts[0] + ".pb.h")}">
</ClInclude>
<ClCompile Include="${get_repo_root()}\${to_windows_path(src_name_parts[0] + ".grpc.pb.cc")}">
</ClCompile>
<ClInclude Include="${get_repo_root()}\${to_windows_path(src_name_parts[0] + ".grpc.pb.h")}">
</ClInclude>
% else:
<ClCompile Include="${get_repo_root()}\${to_windows_path(src_name)}">
</ClCompile>
% endif
% endfor
</ItemGroup>
% elif configuration_type != 'StaticLibrary':
@ -230,4 +251,4 @@ ${gen_package_targets(packages)}\
</ImportGroup>
${gen_package_ensure(packages)}\
</Project>
</%def>\
</%def>\

@ -70,7 +70,7 @@ def mako_plugin(dictionary):
if project.get('vs_project_guid', None)]
projects = [project for project in projects
if project['language'] != 'c++' or project['build'] == 'all' or project['build'] == 'protoc']
if project['language'] != 'c++' or project['build'] == 'all' or project['build'] == 'protoc' or (project['language'] == 'c++' and (project['build'] == 'test' or project['build'] == 'private'))]
project_dict = dict([(p['name'], p) for p in projects])

Loading…
Cancel
Save