diff options
author | 2015-05-11 09:13:27 -0700 | |
---|---|---|
committer | 2015-05-11 09:13:27 -0700 | |
commit | 5b9e7430d9e056b393ea6aec199260d763840ba5 (patch) | |
tree | eec1d00f3f8c41435d7732d6694f8eca4d7b30ec /templates | |
parent | f7670f3054e4ed05715120728e345e4bb0a13d3d (diff) | |
parent | ad21fea239769e2a3be14ac56ee747eb0f3c13a3 (diff) |
Merge github.com:grpc/grpc into bye-bye-completion-queue-pie
Conflicts:
vsprojects/Grpc.mak
Diffstat (limited to 'templates')
18 files changed, 132 insertions, 42 deletions
diff --git a/templates/Makefile.template b/templates/Makefile.template index e446f2b40c..2c7767c2dc 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -56,6 +56,9 @@ endif ifeq ($(SYSTEM),MSYS) SYSTEM = MINGW32 endif +ifeq ($(SYSTEM),MINGW64) +SYSTEM = MINGW32 +endif ifndef BUILDDIR diff --git a/templates/vsprojects/Grpc.mak.template b/templates/vsprojects/Grpc.mak.template index 2c39ec8ca3..db3d1295ba 100644 --- a/templates/vsprojects/Grpc.mak.template +++ b/templates/vsprojects/Grpc.mak.template @@ -33,10 +33,19 @@ <%def name="to_windows_path(path)">${path.replace('/','\\')}</%def>\ <% disallowed_dependencies = set(['end2end_certs']) - buildable_targets = [ target for target in targets - if not disallowed_dependencies.intersection(target.deps) and + build_from_project_file = set(['gpr', + 'grpc', + 'grpc_unsecure', + 'gpr_test_util', + 'grpc_test_util', + 'grpc_test_util_unsecure', + ]) + buildable_targets = [ target for target in targets + libs + if not disallowed_dependencies.intersection(target.get('deps', [])) and + target.build in ['all', 'test', 'private', 'tool', 'benchmark'] and + target.language in ['c', 'c++'] and all([src.endswith('.c') for src in target.src]) and - 'windows' in target.platforms ] + 'windows' in target.get('platforms', ['windows']) ] c_test_targets = [ target for target in buildable_targets if target.build == 'test' and not target.language == 'c++' ] cxx_test_targets = [ target for target in buildable_targets if target.build == 'test' and target.language == 'c++' ] %>\ @@ -45,31 +54,40 @@ OUT_DIR=test_bin -CC=cl.exe -LINK=link.exe +CC=cl.exe /nologo +LINK=link.exe /nologo +LIBTOOL=lib.exe /nologo /nodefaultlib REPO_ROOT=.. -OPENSSL_INCLUDES = .\packages\${get_openssl()}\build\native\include\v120\Win32\Debug\static +OPENSSL_INCLUDES = .\packages\${get_openssl()}\build\native\include ZLIB_INCLUDES = .\packages\${get_zlib()}\build\native\include INCLUDES=/I$(REPO_ROOT) /I$(REPO_ROOT)\include /I$(OPENSSL_INCLUDES) /I$(ZLIB_INCLUDES) DEFINES=/D WIN32 /D _LIB /D _USE_32BIT_TIME_T /D _UNICODE /D UNICODE /D _CRT_SECURE_NO_WARNINGS -CFLAGS=/c $(INCLUDES) /nologo /Z7 /W3 /WX- /sdl $(DEFINES) /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- -LFLAGS=/DEBUG /INCREMENTAL /NOLOGO /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 +CFLAGS=/c $(INCLUDES) /Z7 /W3 /WX- /sdl $(DEFINES) /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TC /analyze- +LFLAGS=/DEBUG /INCREMENTAL /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 OPENSSL_LIBS=.\packages\${get_openssl()}\build\native\lib\v120\Win32\Debug\static\ssleay32.lib .\packages\${get_openssl()}\build\native\lib\v120\Win32\Debug\static\libeay32.lib WINSOCK_LIBS=ws2_32.lib +GENERAL_LIBS=advapi32.lib comdlg32.lib gdi32.lib kernel32.lib odbc32.lib odbccp32.lib ole32.lib oleaut32.lib shell32.lib user32.lib uuid.lib winspool.lib ZLIB_LIBS=.\packages\${get_zlib()}\build\native\lib\v120\Win32\Debug\static\cdecl\zlib.lib -LIBS=$(OPENSSL_LIBS) $(WINSOCK_LIBS) $(ZLIB_LIBS) +LIBS=$(OPENSSL_LIBS) $(ZLIB_LIBS) $(GENERAL_LIBS) $(WINSOCK_LIBS) -build_gpr_test_util: - msbuild grpc.sln /t:gpr_test_util /p:Configuration=Debug - -build_grpc_test_util: - msbuild grpc.sln /t:grpc_test_util /p:Configuration=Debug +all: buildtests $(OUT_DIR): mkdir $(OUT_DIR) +build_libs: \ +% for target in buildable_targets: +% if target.build == 'private' or target.build == 'all': +% if target.name in build_from_project_file: +build_${target.name} \ +% else: +Debug\${target.name}.lib \ +% endif +% endif +% endfor + buildtests: buildtests_c buildtests_cxx buildtests_c: \ @@ -87,24 +105,42 @@ ${target.name}.exe \ echo All tests built. % for target in buildable_targets: -${target.name}.exe: build_grpc_test_util $(OUT_DIR) +%if target.name in build_from_project_file: +build_${target.name}: + msbuild grpc.sln /t:${target.name} /p:Configuration=Debug /p:Linkage-grpc_dependencies_zlib=static +%else: +%if target.build == 'private': +Debug\${target.name}.lib: \ +%else: +${target.name}.exe: build_libs \ +%endif +$(OUT_DIR) echo Building ${target.name} $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ \ %for source in target.src: $(REPO_ROOT)\${to_windows_path(source)} \ %endfor +%if not target.src: +$(REPO_ROOT)\${to_windows_path('vsprojects/dummy.c')} \ +%endif +%if target.build == 'private': + $(LIBTOOL) /OUT:"Debug\${target.name}.lib" \ +%else: $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\${target.name}.exe" \ -%for dep in target.deps: +%for dep in target.get('deps', []): Debug\${dep}.lib \ %endfor $(LIBS) \ +%endif %for source in target.src: $(OUT_DIR)\${re.search('([^/]+)\.c$', source).group(1)}.obj \ %endfor +%if target.build != 'private': ${target.name}: ${target.name}.exe echo Running ${target.name} $(OUT_DIR)\${target.name}.exe - +%endif +%endif % endfor diff --git a/templates/vsprojects/generate_debug_projects.sh b/templates/vsprojects/generate_debug_projects.sh new file mode 100755 index 0000000000..3c40671c77 --- /dev/null +++ b/templates/vsprojects/generate_debug_projects.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# To properly use this, you'll need to add: +# +# "debug": true +# +# to build.json + +cd `dirname $0`/../.. + +./tools/buildgen/generate_projects.sh + +git diff | +grep \\+Project | +cut -d\" -f 4 | +sort -u | +grep _test$ | +while read p ; do + mkdir -p templates/vsprojects/$p + echo '<%namespace file="../vcxproj_defs.include" import="gen_project"/>${gen_project("'$p'", targets)}' > templates/vsprojects/$p/$p.vcxproj.template +done + +git diff | +grep \\+Project | +cut -d\" -f 4 | +sort -u | +grep -v _test$ | +while read p ; do + mkdir -p templates/vsprojects/$p + echo '<%namespace file="../vcxproj_defs.include" import="gen_project"/>${gen_project("'$p'", libs)}' > templates/vsprojects/$p/$p.vcxproj.template +done + +./tools/buildgen/generate_projects.sh diff --git a/templates/vsprojects/gpr/gpr.vcxproj.filters.template b/templates/vsprojects/gpr/gpr.vcxproj.filters.template index 1aeb3b1dd0..779a36bf0f 100644 --- a/templates/vsprojects/gpr/gpr.vcxproj.filters.template +++ b/templates/vsprojects/gpr/gpr.vcxproj.filters.template @@ -1,2 +1,2 @@ <%namespace file="../vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('gpr', libs, targets)} +${gen_filters('gpr', libs)} diff --git a/templates/vsprojects/gpr/gpr.vcxproj.template b/templates/vsprojects/gpr/gpr.vcxproj.template index b94266c776..ca217c2762 100644 --- a/templates/vsprojects/gpr/gpr.vcxproj.template +++ b/templates/vsprojects/gpr/gpr.vcxproj.template @@ -1,2 +1,2 @@ <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('gpr', libs, targets)} +${gen_project('gpr', libs)} diff --git a/templates/vsprojects/gpr_test_util/gpr_test_util.vcxproj.template b/templates/vsprojects/gpr_test_util/gpr_test_util.vcxproj.template index 42f4a248b8..d412d646e7 100644 --- a/templates/vsprojects/gpr_test_util/gpr_test_util.vcxproj.template +++ b/templates/vsprojects/gpr_test_util/gpr_test_util.vcxproj.template @@ -1,2 +1,2 @@ <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('gpr_test_util', libs, targets)}
\ No newline at end of file +${gen_project('gpr_test_util', libs)}
\ No newline at end of file diff --git a/templates/vsprojects/grpc++/grpc++.vcxproj.filters.template b/templates/vsprojects/grpc++/grpc++.vcxproj.filters.template index 818eb87c75..70e0a6c13b 100644 --- a/templates/vsprojects/grpc++/grpc++.vcxproj.filters.template +++ b/templates/vsprojects/grpc++/grpc++.vcxproj.filters.template @@ -1,2 +1,2 @@ <%namespace file="../vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('grpc++', libs, targets)} +${gen_filters('grpc++', libs)} diff --git a/templates/vsprojects/grpc++/grpc++.vcxproj.template b/templates/vsprojects/grpc++/grpc++.vcxproj.template index fb84a1a801..5f13591b2d 100644 --- a/templates/vsprojects/grpc++/grpc++.vcxproj.template +++ b/templates/vsprojects/grpc++/grpc++.vcxproj.template @@ -1,2 +1,2 @@ <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc++', libs, targets)}
\ No newline at end of file +${gen_project('grpc++', libs)}
\ No newline at end of file diff --git a/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters.template b/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters.template new file mode 100644 index 0000000000..465a3d76f5 --- /dev/null +++ b/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.filters.template @@ -0,0 +1,2 @@ +<%namespace file="../vcxproj.filters_defs.include" import="gen_filters"/>\ +${gen_filters('grpc++_unsecure', libs)} diff --git a/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.template b/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.template new file mode 100644 index 0000000000..62016ccc0a --- /dev/null +++ b/templates/vsprojects/grpc++_unsecure/grpc++_unsecure.vcxproj.template @@ -0,0 +1,2 @@ +<%namespace file="../vcxproj_defs.include" import="gen_project"/>\ +${gen_project('grpc++_unsecure', libs)}
\ No newline at end of file diff --git a/templates/vsprojects/grpc/grpc.vcxproj.filters.template b/templates/vsprojects/grpc/grpc.vcxproj.filters.template index a9575e935a..9607d23324 100644 --- a/templates/vsprojects/grpc/grpc.vcxproj.filters.template +++ b/templates/vsprojects/grpc/grpc.vcxproj.filters.template @@ -1,2 +1,2 @@ <%namespace file="../vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('grpc', libs, targets)} +${gen_filters('grpc', libs)} diff --git a/templates/vsprojects/grpc/grpc.vcxproj.template b/templates/vsprojects/grpc/grpc.vcxproj.template index 35ac30380e..a19214e0a4 100644 --- a/templates/vsprojects/grpc/grpc.vcxproj.template +++ b/templates/vsprojects/grpc/grpc.vcxproj.template @@ -1,2 +1,2 @@ <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc', libs, targets, packages=['openssl','zlib'])}
\ No newline at end of file +${gen_project('grpc', libs, packages=['openssl','zlib'])}
\ No newline at end of file diff --git a/templates/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj.template b/templates/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj.template index c1f23011b2..8a5f1ca5b7 100644 --- a/templates/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj.template +++ b/templates/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj.template @@ -1,2 +1,2 @@ <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_csharp_ext', libs, targets, configuration_type = 'DynamicLibrary', additional_props = ['winsock'], packages=['openssl','zlib'])} +${gen_project('grpc_csharp_ext', libs, configuration_type = 'DynamicLibrary', props = ['winsock'], packages=['openssl','zlib'])} diff --git a/templates/vsprojects/grpc_test_util/grpc_test_util.vcxproj.template b/templates/vsprojects/grpc_test_util/grpc_test_util.vcxproj.template index 4dd335505a..3781023837 100644 --- a/templates/vsprojects/grpc_test_util/grpc_test_util.vcxproj.template +++ b/templates/vsprojects/grpc_test_util/grpc_test_util.vcxproj.template @@ -1,2 +1,2 @@ <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_test_util', libs, targets)}
\ No newline at end of file +${gen_project('grpc_test_util', libs)}
\ No newline at end of file diff --git a/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters.template b/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters.template index a0c26df73b..aef6465915 100644 --- a/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters.template +++ b/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters.template @@ -1,2 +1,2 @@ <%namespace file="../vcxproj.filters_defs.include" import="gen_filters"/>\ -${gen_filters('grpc_unsecure', libs, targets)} +${gen_filters('grpc_unsecure', libs)} diff --git a/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.template b/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.template index 93b343eb45..fd827d191a 100644 --- a/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.template +++ b/templates/vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.template @@ -1,2 +1,2 @@ <%namespace file="../vcxproj_defs.include" import="gen_project"/>\ -${gen_project('grpc_unsecure', libs, targets, packages=['zlib'])}
\ No newline at end of file +${gen_project('grpc_unsecure', libs, packages=['zlib'])}
\ No newline at end of file diff --git a/templates/vsprojects/vcxproj.filters_defs.include b/templates/vsprojects/vcxproj.filters_defs.include index 646b17e9fe..787d66eeff 100644 --- a/templates/vsprojects/vcxproj.filters_defs.include +++ b/templates/vsprojects/vcxproj.filters_defs.include @@ -9,7 +9,7 @@ <%def name="to_windows_path(path)">${path.replace('/','\\')}</%def>\ <%def name="to_filter(path)">${calc_to_filter(path)}</%def>\ <%def name="filter_to_guid(proj, filter)">${re.sub('(........)(....)(....)(....)', r'\1-\2-\3-\4-', hashlib.md5(''.join([filter, proj])).hexdigest())}</%def>\ -<%def name="gen_filters(name, libs, targets)">\ +<%def name="gen_filters(name, collection)">\ % for project in vsprojects: % if project.name == name: <?xml version="1.0" encoding="utf-8"?> diff --git a/templates/vsprojects/vcxproj_defs.include b/templates/vsprojects/vcxproj_defs.include index af215d6a2a..628074c75f 100644 --- a/templates/vsprojects/vcxproj_defs.include +++ b/templates/vsprojects/vcxproj_defs.include @@ -2,9 +2,24 @@ <%def name="get_repo_root()">..\..</%def>\ <%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 = [], packages = [])">\ -% for project in vsprojects: - % if project.name == name: +<%def name="gen_project(name, collection, configuration_type = None, project_guid = None, props = [], packages = [])">\ +<% + for p in vsprojects: + if p.name == name: + project = p + for t in collection: + if t.name == name: + target = t + if not configuration_type: + configuration_type = 'StaticLibrary' + if not project_guid: + project_guid = project.vs_project_guid + if configuration_type == 'Application': + props.extend(['winsock', 'protobuf', 'zlib', 'openssl']) + if target.language == 'c++': + props.extend(['protobuf']) + props.extend(['global']) +%>\ <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> ${gen_package_props(packages)}\ @@ -66,29 +81,25 @@ ${gen_package_props(packages)}\ </ImportGroup> <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" /> - % for prop in additional_props: + % for prop in props: <Import Project="..\${prop}.props" /> % endfor </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\global.props" /> - % for prop in additional_props: + % for prop in props: <Import Project="..\${prop}.props" /> % endfor </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" /> - % for prop in additional_props: + % for prop in props: <Import Project="..\${prop}.props" /> % endfor </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="..\global.props" /> - % for prop in additional_props: + % for prop in props: <Import Project="..\${prop}.props" /> % endfor </ImportGroup> @@ -186,6 +197,11 @@ ${gen_package_props(packages)}\ </ClCompile> % endfor </ItemGroup> + % elif configuration_type != 'StaticLibrary': + <ItemGroup> + <ClCompile Include="${get_repo_root()}\${to_windows_path('vsprojects/dummy.c')}"> + </ClCompile> + </ItemGroup> % endif % if project.get('deps',[]): <ItemGroup> @@ -207,6 +223,4 @@ ${gen_package_targets(packages)}\ </ImportGroup> ${gen_package_ensure(packages)}\ </Project> - % endif -% endfor </%def>\
\ No newline at end of file |