[cmake] Cleanup and simplify the cmake build. (#34087)

Followup for https://github.com/grpc/grpc/pull/33803

More cmake cleanup. See commit descriptions for individual cleanup
items.
pull/34094/head
Jan Tattermusch 1 year ago committed by GitHub
parent 724ef464b2
commit 3a2bd221ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1109
      CMakeLists.txt
  2. 63
      Makefile
  3. 18
      build_handwritten.yaml
  4. 4
      src/c-ares/gen_build_yaml.py
  5. 77
      templates/CMakeLists.txt.template
  6. 11
      templates/Makefile.template
  7. 4
      templates/config.m4.template
  8. 3
      templates/config.w32.template
  9. 35
      templates/gRPC-C++.podspec.template
  10. 29
      templates/gRPC-Core.podspec.template
  11. 2
      templates/grpc.gyp.template
  12. 3
      templates/package.xml.template

1109
CMakeLists.txt generated

File diff suppressed because it is too large Load Diff

63
Makefile generated

@ -511,9 +511,6 @@ EMBED_CARES ?= broken
endif
ifeq ($(EMBED_CARES),true)
CARES_DEP = $(LIBDIR)/$(CONFIG)/libares.a
CARES_MERGE_OBJS = $(LIBARES_OBJS)
CARES_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libares.a
CPPFLAGS := -Ithird_party/cares/cares/include -Ithird_party/cares -Ithird_party/cares/cares $(CPPFLAGS)
endif
@ -654,7 +651,7 @@ shared_cxx: cache.mk
privatelibs: privatelibs_c privatelibs_cxx
privatelibs_c: $(LIBDIR)/$(CONFIG)/libz.a $(LIBDIR)/$(CONFIG)/libares.a
privatelibs_c: $(LIBDIR)/$(CONFIG)/libz.a $(LIBDIR)/$(CONFIG)/libcares.a
ifeq ($(EMBED_OPENSSL),true)
privatelibs_cxx:
else
@ -955,7 +952,7 @@ endif
# start of build recipe for library "grpc" (generated by makelib(lib) template function)
# deps: ['re2', 'upb_json_lib', 'upb_textformat_lib', 'z', 'grpc_abseil', 'cares', 'gpr', 'libssl', 'address_sorting']
# transitive_deps: ['address_sorting', 'gpr', 'grpc_abseil', 'z', 'upb_textformat_lib', 'upb_json_lib', 'upb', 'utf8_range_lib', 'upb_collections_lib', 're2', 'cares', 'libssl']
# transitive_deps: ['address_sorting', 'gpr', 'grpc_abseil', 'cares', 'z', 'upb_textformat_lib', 'upb_json_lib', 'upb', 'utf8_range_lib', 'upb_collections_lib', 're2', 'libssl']
LIBGRPC_SRC = \
src/core/ext/filters/backend_metrics/backend_metric_filter.cc \
src/core/ext/filters/census/grpc_context.cc \
@ -1816,29 +1813,29 @@ $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE
else
# static library for "grpc"
$(LIBDIR)/$(CONFIG)/libgrpc.a: $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(CARES_DEP) $(OPENSSL_DEP) $(LIBGRPC_OBJS) $(LIBADDRESS_SORTING_OBJS) $(LIBGPR_OBJS) $(LIBGRPC_ABSEIL_OBJS) $(ZLIB_MERGE_OBJS) $(LIBUPB_TEXTFORMAT_LIB_OBJS) $(LIBUPB_JSON_LIB_OBJS) $(LIBUPB_OBJS) $(LIBUTF8_RANGE_LIB_OBJS) $(LIBUPB_COLLECTIONS_LIB_OBJS) $(LIBRE2_OBJS) $(CARES_MERGE_OBJS) $(OPENSSL_MERGE_OBJS)
$(LIBDIR)/$(CONFIG)/libgrpc.a: $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(OPENSSL_DEP) $(LIBGRPC_OBJS) $(LIBADDRESS_SORTING_OBJS) $(LIBGPR_OBJS) $(LIBGRPC_ABSEIL_OBJS) $(LIBCARES_OBJS) $(ZLIB_MERGE_OBJS) $(LIBUPB_TEXTFORMAT_LIB_OBJS) $(LIBUPB_JSON_LIB_OBJS) $(LIBUPB_OBJS) $(LIBUTF8_RANGE_LIB_OBJS) $(LIBUPB_COLLECTIONS_LIB_OBJS) $(LIBRE2_OBJS) $(OPENSSL_MERGE_OBJS)
$(E) "[AR] Creating $@"
$(Q) mkdir -p `dirname $@`
$(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc.a
$(Q) $(AR) $(ARFLAGS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBGRPC_OBJS) $(LIBADDRESS_SORTING_OBJS) $(LIBGPR_OBJS) $(LIBGRPC_ABSEIL_OBJS) $(ZLIB_MERGE_OBJS) $(LIBUPB_TEXTFORMAT_LIB_OBJS) $(LIBUPB_JSON_LIB_OBJS) $(LIBUPB_OBJS) $(LIBUTF8_RANGE_LIB_OBJS) $(LIBUPB_COLLECTIONS_LIB_OBJS) $(LIBRE2_OBJS) $(CARES_MERGE_OBJS) $(OPENSSL_MERGE_OBJS)
$(Q) $(AR) $(ARFLAGS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBGRPC_OBJS) $(LIBADDRESS_SORTING_OBJS) $(LIBGPR_OBJS) $(LIBGRPC_ABSEIL_OBJS) $(LIBCARES_OBJS) $(ZLIB_MERGE_OBJS) $(LIBUPB_TEXTFORMAT_LIB_OBJS) $(LIBUPB_JSON_LIB_OBJS) $(LIBUPB_OBJS) $(LIBUTF8_RANGE_LIB_OBJS) $(LIBUPB_COLLECTIONS_LIB_OBJS) $(LIBRE2_OBJS) $(OPENSSL_MERGE_OBJS)
ifeq ($(SYSTEM),Darwin)
$(Q) $(RANLIB) $(RANLIBFLAGS) $(LIBDIR)/$(CONFIG)/libgrpc.a
endif
# shared library for "grpc"
ifeq ($(SYSTEM),MINGW32)
$(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(CARES_DEP) $(OPENSSL_DEP)
$(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(OPENSSL_DEP)
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(CARES_MERGE_LIBS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
else
$(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(CARES_DEP) $(OPENSSL_DEP)
$(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(OPENSSL_DEP)
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(CARES_MERGE_LIBS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.34 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(CARES_MERGE_LIBS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.34 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb_textformat_lib.a $(LIBDIR)/$(CONFIG)/libupb_json_lib.a $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBDIR)/$(CONFIG)/libre2.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(LDLIBS)
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.34
$(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so
endif
@ -1856,7 +1853,7 @@ endif
# start of build recipe for library "grpc_unsecure" (generated by makelib(lib) template function)
# deps: ['upb_collections_lib', 'upb', 'z', 'grpc_abseil', 'cares', 'gpr', 'address_sorting']
# transitive_deps: ['address_sorting', 'gpr', 'grpc_abseil', 'z', 'upb', 'utf8_range_lib', 'upb_collections_lib', 'cares']
# transitive_deps: ['address_sorting', 'gpr', 'grpc_abseil', 'cares', 'z', 'upb', 'utf8_range_lib', 'upb_collections_lib']
LIBGRPC_UNSECURE_SRC = \
src/core/ext/filters/backend_metrics/backend_metric_filter.cc \
src/core/ext/filters/census/grpc_context.cc \
@ -2312,29 +2309,29 @@ LIBGRPC_UNSECURE_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(base
# static library for "grpc_unsecure"
$(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a: $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(CARES_DEP) $(LIBGRPC_UNSECURE_OBJS) $(LIBADDRESS_SORTING_OBJS) $(LIBGPR_OBJS) $(LIBGRPC_ABSEIL_OBJS) $(ZLIB_MERGE_OBJS) $(LIBUPB_OBJS) $(LIBUTF8_RANGE_LIB_OBJS) $(LIBUPB_COLLECTIONS_LIB_OBJS) $(CARES_MERGE_OBJS)
$(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a: $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LIBGRPC_UNSECURE_OBJS) $(LIBADDRESS_SORTING_OBJS) $(LIBGPR_OBJS) $(LIBGRPC_ABSEIL_OBJS) $(LIBCARES_OBJS) $(ZLIB_MERGE_OBJS) $(LIBUPB_OBJS) $(LIBUTF8_RANGE_LIB_OBJS) $(LIBUPB_COLLECTIONS_LIB_OBJS)
$(E) "[AR] Creating $@"
$(Q) mkdir -p `dirname $@`
$(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a
$(Q) $(AR) $(ARFLAGS) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBGRPC_UNSECURE_OBJS) $(LIBADDRESS_SORTING_OBJS) $(LIBGPR_OBJS) $(LIBGRPC_ABSEIL_OBJS) $(ZLIB_MERGE_OBJS) $(LIBUPB_OBJS) $(LIBUTF8_RANGE_LIB_OBJS) $(LIBUPB_COLLECTIONS_LIB_OBJS) $(CARES_MERGE_OBJS)
$(Q) $(AR) $(ARFLAGS) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBGRPC_UNSECURE_OBJS) $(LIBADDRESS_SORTING_OBJS) $(LIBGPR_OBJS) $(LIBGRPC_ABSEIL_OBJS) $(LIBCARES_OBJS) $(ZLIB_MERGE_OBJS) $(LIBUPB_OBJS) $(LIBUTF8_RANGE_LIB_OBJS) $(LIBUPB_COLLECTIONS_LIB_OBJS)
ifeq ($(SYSTEM),Darwin)
$(Q) $(RANLIB) $(RANLIBFLAGS) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a
endif
# shared library for "grpc_unsecure"
ifeq ($(SYSTEM),MINGW32)
$(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(CARES_DEP)
$(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(CARES_MERGE_LIBS) $(LDLIBS)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LDLIBS)
else
$(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(CARES_DEP)
$(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_DEP) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_DEP) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
ifeq ($(SYSTEM),Darwin)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(CARES_MERGE_LIBS) $(LDLIBS)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LDLIBS)
else
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.34 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(CARES_MERGE_LIBS) $(LDLIBS)
$(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.34 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libgpr.a $(GRPC_ABSEIL_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libcares.a $(ZLIB_MERGE_LIBS) $(LIBDIR)/$(CONFIG)/libupb.a $(LIBDIR)/$(CONFIG)/libutf8_range_lib.a $(LIBDIR)/$(CONFIG)/libupb_collections_lib.a $(LDLIBS)
$(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so.34
$(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so
endif
@ -3049,10 +3046,10 @@ endif
# end of build recipe for library "boringssl"
# start of build recipe for library "ares" (generated by makelib(lib) template function)
# start of build recipe for library "cares" (generated by makelib(lib) template function)
# deps: []
# transitive_deps: []
LIBARES_SRC = \
LIBCARES_SRC = \
third_party/cares/cares/src/lib/ares__read_line.c \
third_party/cares/cares/src/lib/ares__get_hostent.c \
third_party/cares/cares/src/lib/ares__close_sockets.c \
@ -3115,27 +3112,27 @@ LIBARES_SRC = \
third_party/cares/cares/src/lib/ares_process.c \
LIBARES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBARES_SRC))))
LIBCARES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBCARES_SRC))))
$(LIBARES_OBJS): CFLAGS += -g
$(LIBARES_OBJS): CPPFLAGS += -Ithird_party/cares/cares/include -Ithird_party/cares -Ithird_party/cares/cares -fvisibility=hidden -D_GNU_SOURCE $(if $(subst Darwin,,$(SYSTEM)),,-Ithird_party/cares/config_darwin) $(if $(subst FreeBSD,,$(SYSTEM)),,-Ithird_party/cares/config_freebsd) $(if $(subst Linux,,$(SYSTEM)),,-Ithird_party/cares/config_linux) $(if $(subst OpenBSD,,$(SYSTEM)),,-Ithird_party/cares/config_openbsd) -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(if $(subst MINGW32,,$(SYSTEM)),-DHAVE_CONFIG_H,)
$(LIBCARES_OBJS): CFLAGS += -g
$(LIBCARES_OBJS): CPPFLAGS += -Ithird_party/cares/cares/include -Ithird_party/cares -Ithird_party/cares/cares -fvisibility=hidden -D_GNU_SOURCE $(if $(subst Darwin,,$(SYSTEM)),,-Ithird_party/cares/config_darwin) $(if $(subst FreeBSD,,$(SYSTEM)),,-Ithird_party/cares/config_freebsd) $(if $(subst Linux,,$(SYSTEM)),,-Ithird_party/cares/config_linux) $(if $(subst OpenBSD,,$(SYSTEM)),,-Ithird_party/cares/config_openbsd) -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(if $(subst MINGW32,,$(SYSTEM)),-DHAVE_CONFIG_H,)
# static library for "ares"
$(LIBDIR)/$(CONFIG)/libares.a: $(LIBARES_OBJS)
# static library for "cares"
$(LIBDIR)/$(CONFIG)/libcares.a: $(LIBCARES_OBJS)
$(E) "[AR] Creating $@"
$(Q) mkdir -p `dirname $@`
$(Q) rm -f $(LIBDIR)/$(CONFIG)/libares.a
$(Q) $(AR) $(ARFLAGS) $(LIBDIR)/$(CONFIG)/libares.a $(LIBARES_OBJS)
$(Q) rm -f $(LIBDIR)/$(CONFIG)/libcares.a
$(Q) $(AR) $(ARFLAGS) $(LIBDIR)/$(CONFIG)/libcares.a $(LIBCARES_OBJS)
ifeq ($(SYSTEM),Darwin)
$(Q) $(RANLIB) $(RANLIBFLAGS) $(LIBDIR)/$(CONFIG)/libares.a
$(Q) $(RANLIB) $(RANLIBFLAGS) $(LIBDIR)/$(CONFIG)/libcares.a
endif
# shared library for "ares"
# shared library for "cares"
ifneq ($(NO_DEPS),true)
-include $(LIBARES_OBJS:.o=.dep)
-include $(LIBCARES_OBJS:.o=.dep)
endif
# end of build recipe for library "ares"
# end of build recipe for library "cares"
# Add private ABSEIL target which contains all sources used by all baselib libraries.

@ -131,13 +131,6 @@ configs:
defaults:
abseil:
CPPFLAGS: -g -Ithird_party/abseil-cpp
ares:
CFLAGS: -g
CPPFLAGS: -Ithird_party/cares/cares/include -Ithird_party/cares -Ithird_party/cares/cares
-fvisibility=hidden -D_GNU_SOURCE $(if $(subst Darwin,,$(SYSTEM)),,-Ithird_party/cares/config_darwin)
$(if $(subst FreeBSD,,$(SYSTEM)),,-Ithird_party/cares/config_freebsd) $(if $(subst
Linux,,$(SYSTEM)),,-Ithird_party/cares/config_linux) $(if $(subst OpenBSD,,$(SYSTEM)),,-Ithird_party/cares/config_openbsd)
-DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(if $(subst MINGW32,,$(SYSTEM)),-DHAVE_CONFIG_H,)
benchmark:
CPPFLAGS: -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX
boringssl:
@ -145,6 +138,13 @@ defaults:
CPPFLAGS: -Ithird_party/boringssl-with-bazel/src/include -fvisibility=hidden -DOPENSSL_NO_ASM
-D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX
CXXFLAGS: -fno-exceptions
cares:
CFLAGS: -g
CPPFLAGS: -Ithird_party/cares/cares/include -Ithird_party/cares -Ithird_party/cares/cares
-fvisibility=hidden -D_GNU_SOURCE $(if $(subst Darwin,,$(SYSTEM)),,-Ithird_party/cares/config_darwin)
$(if $(subst FreeBSD,,$(SYSTEM)),,-Ithird_party/cares/config_freebsd) $(if $(subst
Linux,,$(SYSTEM)),,-Ithird_party/cares/config_linux) $(if $(subst OpenBSD,,$(SYSTEM)),,-Ithird_party/cares/config_openbsd)
-DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(if $(subst MINGW32,,$(SYSTEM)),-DHAVE_CONFIG_H,)
global:
CFLAGS: -g
COREFLAGS: -fno-exceptions
@ -190,7 +190,7 @@ python_dependencies:
deps:
- grpc
- address_sorting
- ares
- cares
- boringssl
- re2
- z
@ -198,7 +198,7 @@ ruby_gem:
deps:
- grpc
- address_sorting
- ares
- cares
- boringssl
- re2
- z

@ -51,8 +51,8 @@ try:
out["libs"] = [
{
"name": "ares",
"defaults": "ares",
"name": "cares",
"defaults": "cares",
"build": "private",
"language": "c",
"secure": False,

@ -48,6 +48,8 @@
return lib_name.startswith("absl/")
def get_absl_dep(lib_name):
"""Gets the corresponding cmake target for given absl library."""
# The "cmake_target" field originates from src/abseil-cpp/preprocessed_builds.yaml.gen.py
return lib_map[lib_name].cmake_target
def get_transitive_deps(lib_name):
@ -148,27 +150,9 @@
private_libs.append("-l" + lib_name)
return private_libs
def is_shared_only_lib(lib_name):
"""Returns True if only shared library should be generated."""
# grpc_csharp_ext is loaded by C# runtime and it
# only makes sense as a shared lib.
return lib_name in ['grpc_csharp_ext']
def get_deps(target_dict):
# TODO(jtattermusch): remove special cases based on target names
deps = []
deps.append("${_gRPC_BASELIB_LIBRARIES}")
if target_dict.get('build', None) in ['protoc']:
deps.append("${_gRPC_PROTOBUF_PROTOC_LIBRARIES}")
if target_dict.language == 'c++':
deps.append("${_gRPC_PROTOBUF_LIBRARIES}")
if target_dict['name'] in ['grpc', 'grpc_cronet', 'grpc_unsecure']:
deps.append("${_gRPC_UPB_LIBRARIES}")
# TODO(yijiem): These targets depend on grpc_base instead of grpc. Since we don't populate grpc_base as a cmake target, the sources all get collapsed into these targets. This workaround adds c-ares and/or re2 dependencies to these targets. We should clean this up.
if target_dict['name'] in ['frame_test']:
deps.append("${_gRPC_CARES_LIBRARIES}")
if target_dict['name'] in ['grpc_authorization_provider']:
deps.append("${_gRPC_CARES_LIBRARIES}")
deps.append("${_gRPC_RE2_LIBRARIES}")
deps.append("${_gRPC_ALLTARGETS_LIBRARIES}")
for d in target_dict.get('deps', []):
if d == 'z':
@ -194,6 +178,22 @@
deps.append(d)
return deps
def is_generate_cmake_target(lib_or_target):
"""Returns True if a cmake target should be generated for given library/target."""
# TODO(jtattermusch): extract the metadata to a centralized location.
if lib_or_target.build not in ["all", "protoc", "tool", "test", "private"]:
return False
if lib_or_target.boringssl:
# Don't generate target for boringssl libs or tests
return False
if lib_or_target.name in ['cares', 'benchmark', 're2', 'xxhash', 'z']:
# we rely on these target to be created by external cmake builds.
return False
if is_absl_lib(lib_or_target.name):
# we rely on absl targets to be created by an external cmake build.
return False
return True
def get_platforms_condition_begin(platforms):
if all(platform in platforms for platform in ['linux', 'mac', 'posix', 'windows']):
return ''
@ -260,8 +260,6 @@
set(gRPC_CORE_SOVERSION "${settings.core_version.major}")
set(gRPC_CPP_VERSION "${settings.cpp_version}")
set(gRPC_CPP_SOVERSION "${settings.cpp_version.major}.${settings.cpp_version.minor}")
set(gRPC_CSHARP_VERSION "${settings.csharp_version}")
set(gRPC_CSHARP_SOVERSION "${settings.csharp_version.major}.${settings.csharp_version.minor}")
set(PACKAGE_STRING "<%text>${PACKAGE_NAME} ${PACKAGE_VERSION}</%text>")
set(PACKAGE_TARNAME "<%text>${PACKAGE_NAME}-${PACKAGE_VERSION}</%text>")
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
@ -277,7 +275,6 @@
# Options
option(gRPC_BUILD_TESTS "Build tests" OFF)
option(gRPC_BUILD_CODEGEN "Build codegen" ON)
option(gRPC_BUILD_CSHARP_EXT "Build C# extensions" ON)
option(gRPC_BACKWARDS_COMPATIBILITY_MODE "Build libraries that are binary compatible across a larger number of OS and libc versions" OFF)
set(gRPC_INSTALL_default ON)
@ -420,12 +417,6 @@
set(_gRPC_CORE_NOSTDCXX_FLAGS "")
endif()
if (gRPC_XDS_USER_AGENT_IS_CSHARP)
# The value of the defines needs to contain quotes.
# See https://github.com/grpc/grpc/blob/fbf32836a418cc84f58786700273b65cb9174e1d/src/core/ext/xds/xds_api.cc#L854
add_definitions("-DGRPC_XDS_USER_AGENT_NAME_SUFFIX=\"csharp\"" "-DGRPC_XDS_USER_AGENT_VERSION_SUFFIX=\"${settings.csharp_version}\"")
endif()
if(UNIX AND NOT HAIKU)
# -pthread does more than -lpthread
set(THREADS_PREFER_PTHREAD_FLAG ON)
@ -476,7 +467,7 @@
% endfor
if(WIN32)
set(_gRPC_BASELIB_LIBRARIES ws2_32 crypt32)
set(_gRPC_ALLTARGETS_LIBRARIES <%text>${_gRPC_ALLTARGETS_LIBRARIES}</%text> ws2_32 crypt32)
endif()
# Create directory for proto source files
@ -638,7 +629,7 @@
if(gRPC_BUILD_TESTS)
add_custom_target(buildtests_c)
% for tgt in targets:
% if tgt.build == 'test' and not tgt.language == 'c++' and not tgt.get('external_deps', None) and not tgt.boringssl:
% if is_generate_cmake_target(tgt) and tgt.build == 'test' and not tgt.language == 'c++':
<%block filter='platforms_condition_block(tgt.platforms)'>
add_dependencies(buildtests_c ${tgt.name})
</%block>
@ -647,7 +638,7 @@
add_custom_target(buildtests_cxx)
% for tgt in targets:
% if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None) and not tgt.boringssl:
% if is_generate_cmake_target(tgt) and tgt.build == 'test' and tgt.language == 'c++':
<%block filter='platforms_condition_block(tgt.platforms)'>
add_dependencies(buildtests_cxx ${tgt.name})
</%block>
@ -660,10 +651,7 @@
<%
cmake_libs = []
for lib in libs:
if lib.build not in ["all", "protoc", "tool", "test", "private"] or lib.boringssl: continue
if lib.get('build_system', []) and 'cmake' not in lib.get('build_system', []): continue
if lib.name in ['ares', 'benchmark', 're2', 'xxhash', 'z']: continue # we build these using CMake instead
if is_absl_lib(lib.name): continue # we build these using CMake instead
if not is_generate_cmake_target(lib): continue
cmake_libs.append(lib)
%>
% for lib in cmake_libs:
@ -671,10 +659,6 @@
if(gRPC_BUILD_TESTS)
${cc_library(lib)}
endif()
% elif lib.name in ['grpc_csharp_ext']:
if(gRPC_BUILD_CSHARP_EXT)
${cc_library(lib)}
endif()
% else:
${cc_library(lib)}
% if not lib.build in ["tool"]:
@ -690,7 +674,7 @@
% endfor
% for tgt in targets:
% if tgt.build in ["all", "protoc", "tool", "test", "private"] and not tgt.boringssl:
% if is_generate_cmake_target(tgt):
% if tgt.build in ["test", "private"]:
if(gRPC_BUILD_TESTS)
<%block filter='platforms_condition_block(tgt.platforms)'>
@ -717,7 +701,7 @@
<%def name="cc_library(lib)">
% if any(proto_re.match(src) for src in lib.src):
% if lib.name == 'grpcpp_channelz':
% if lib.name == 'grpcpp_channelz': # TODO(jtattermusch): remove special case based on target name
# grpcpp_channelz doesn't build with protobuf-lite
# See https://github.com/grpc/grpc/issues/19473
if(gRPC_BUILD_CODEGEN AND NOT gRPC_USE_PROTO_LITE)
@ -725,7 +709,7 @@
if(gRPC_BUILD_CODEGEN)
% endif
% endif
add_library(${lib.name}${' SHARED' if is_shared_only_lib(lib.name) else ''}
add_library(${lib.name}
% for src in lib.src:
% if not proto_re.match(src):
${src}
@ -747,9 +731,6 @@
% if lib.language == 'c++':
VERSION <%text>${gRPC_CPP_VERSION}</%text>
SOVERSION <%text>${gRPC_CPP_SOVERSION}</%text>
% elif lib.language == 'csharp':
VERSION <%text>${gRPC_CSHARP_VERSION}</%text>
SOVERSION <%text>${gRPC_CSHARP_SOVERSION}</%text>
% else:
VERSION <%text>${gRPC_CORE_VERSION}</%text>
SOVERSION <%text>${gRPC_CORE_SOVERSION}</%text>
@ -779,7 +760,7 @@
<%text>${_gRPC_UPB_INCLUDE_DIR}</%text>
<%text>${_gRPC_XXHASH_INCLUDE_DIR}</%text>
<%text>${_gRPC_ZLIB_INCLUDE_DIR}</%text>
% if 'gtest' in lib.transitive_deps or lib.name == 'gtest':
% if 'gtest' in lib.transitive_deps or lib.name == 'gtest': # TODO(jtattermusch): avoid special case based on target name
third_party/googletest/googletest/include
third_party/googletest/googletest
third_party/googletest/googlemock/include
@ -796,7 +777,7 @@
% endfor
)
% endif
% if lib.name in ["gpr"]:
% if lib.name in ["gpr"]: # TODO(jtattermusch): avoid special case based on target name
if(_gRPC_PLATFORM_ANDROID)
target_link_libraries(gpr
android
@ -806,7 +787,7 @@
% endif
% if lib.name in ["grpc", "grpc_cronet", "grpc_test_util", \
"grpc_test_util_unsecure", "grpc_unsecure", \
"grpc++_cronet"]:
"grpc++_cronet"]: # TODO(jtattermusch): remove special cases based on target names
if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC)
target_link_libraries(${lib.name} "-framework CoreFoundation")
endif()

@ -47,8 +47,6 @@
"""For given dependency, return the expression to be used in Makefile rule dependencies."""
if dep == 'z':
return "$(ZLIB_DEP)"
elif dep == 'cares':
return "$(CARES_DEP)"
elif dep == 'grpc_abseil':
return "$(GRPC_ABSEIL_DEP)"
elif dep == 'libssl':
@ -61,8 +59,6 @@
"""For given dependency, return the lib archive expression to be used when linking."""
if dep == 'z':
return "$(ZLIB_MERGE_LIBS)"
elif dep == 'cares':
return "$(CARES_MERGE_LIBS)"
elif dep == 'grpc_abseil':
return "$(GRPC_ABSEIL_MERGE_LIBS)"
elif dep == 'libssl':
@ -75,8 +71,6 @@
"""For given dependency, return the expression with variable that has list of all object files."""
if dep == 'z':
return "$(ZLIB_MERGE_OBJS)"
elif dep == 'cares':
return "$(CARES_MERGE_OBJS)"
elif dep == 'grpc_abseil':
return "$(LIBGRPC_ABSEIL_OBJS)"
elif dep == 'libssl':
@ -183,7 +177,7 @@
# Currently it is necessary because some dependencies are marked as "build: private" in build.yaml
# (which itself is correct, as they are not "public" libraries from our perspective and cmake
# needs to have them marked as such)
filtered_libs = [lib for lib in libs if (lib.build in ['all'] and lib.language != 'c++') or lib.name in ['ares', 'boringssl', 're2', 'upb', 'z']]
filtered_libs = [lib for lib in libs if (lib.build in ['all'] and lib.language != 'c++') or lib.name in ['cares', 'boringssl', 'z']]
filtered_targets = [tgt for tgt in targets if tgt.build in ['all'] and lib.language != 'c++']
%>
@ -542,9 +536,6 @@
endif
ifeq ($(EMBED_CARES),true)
CARES_DEP = $(LIBDIR)/$(CONFIG)/libares.a
CARES_MERGE_OBJS = $(LIBARES_OBJS)
CARES_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libares.a
CPPFLAGS := -Ithird_party/cares/cares/include -Ithird_party/cares -Ithird_party/cares/cares $(CPPFLAGS)
endif

@ -52,8 +52,8 @@
lib = lib_maps.get(dep, None)
if lib:
php_full_deps.extend(lib.transitive_deps)
# construct list of all source files, but explicitly exclude zlib
for dep in set(php_full_deps) - set({'z'}):
# construct list of all source files, but explicitly exclude zlib and cares
for dep in set(php_full_deps) - set({'z', 'cares'}):
lib = lib_maps.get(dep, None)
if lib:
srcs.extend(lib.src)

@ -17,7 +17,8 @@
lib = lib_maps.get(dep, None)
if lib:
php_full_deps.extend(lib.transitive_deps)
for dep in php_full_deps:
# construct list of all source files, but explicitly exclude cares
for dep in set(php_full_deps) - set({'cares'}):
lib = lib_maps.get(dep, None)
if lib:
srcs.extend(lib.src)

@ -35,6 +35,7 @@
return "abseil/" + label[5:].replace(":", "/")
def lib_and_transitive_deps(lib):
"""Return names of lib itself and all of its transitive dependencies."""
transitive_deps = []
lib_metadata = lib_maps.get(lib, None)
if lib_metadata:
@ -58,25 +59,25 @@
absl_specs.add(get_absl_spec_name(dep))
return list(sorted(absl_specs))
def list_lib_files(lib, fields):
def collect_files_for_libs(libs, fields):
files = set()
for lib_name in non_abseil_lib_and_transitive_deps(lib):
lib_metadata = lib_maps.get(lib_name, None)
if lib_metadata:
for lib_name in libs:
lib = lib_maps.get(lib_name, None)
if lib:
for field in fields:
files.update(lib_metadata.get(field, []))
files.update(lib.get(field, []))
return list(sorted(files))
def filter_grpcpp(files):
return sorted([file for file in files if not file.startswith("include/grpc++")])
# ObjectiveC doesn't use c-ares so we don't need address_sorting files at all
address_sorting_unwanted_files = list_lib_files("address_sorting", ("public_headers", "headers", "src"))
# ObjectiveC doesn't use c-ares so we don't need address_sorting and cares files at all.
# absl deps will be declared explicitly so we also don't need to include them.
grpc_full_deps = set(non_abseil_lib_and_transitive_deps("grpc")) - set({"address_sorting", "cares"})
grpc_private_headers = collect_files_for_libs(grpc_full_deps, ("headers", ))
# ObjectiveC needs to obtain re2 explicitly unlike other languages; TODO @donnadionne make ObjC more consistent with others
grpc_private_files = list(sorted((set(list_lib_files("grpc", ("headers", "src"))) - set(address_sorting_unwanted_files)) | set(list_lib_files("re2", ("headers", "src")))))
grpc_public_headers = list(sorted((set(list_lib_files("grpc", ("public_headers",))) - set(address_sorting_unwanted_files)) | set(list_lib_files("re2", ("public_headers",)))))
grpc_private_headers = list(sorted((set(list_lib_files("grpc", ("headers",))) - set(address_sorting_unwanted_files)) | set(list_lib_files("re2", ("headers",)))))
# grpc++ dependencies minus grpc and the libraries grpc itself depends on.
grpcpp_full_deps = set(non_abseil_lib_and_transitive_deps("grpc++")) - set(lib_and_transitive_deps("grpc"))
# TODO(jtattermusch): build.yaml no longer has filegroups, so the files here are just hand-listed
# This template shouldn't be touching the filegroups anyway, so this is only a bit more fragile.
@ -86,25 +87,19 @@
'include/grpcpp/impl/codegen/proto_utils.h']
grpcpp_private_files = filter_grpcpp(
set(list_lib_files("grpc++", ("headers", "src")))
- set(grpc_private_files)
set(collect_files_for_libs(grpcpp_full_deps, ("headers", "src")))
# We exclude proto related files in this particular podspec so that we can provide a protobuf-independent lib
- set(grpcpp_proto_files)
- set(address_sorting_unwanted_files)
)
grpcpp_private_headers = filter_grpcpp(
set(list_lib_files("grpc++", ("headers",)))
- set(grpc_private_headers)
set(collect_files_for_libs(grpcpp_full_deps, ("headers", )))
# We exclude proto related files in this particular podspec so that we can provide a protobuf-independent lib
- set(grpcpp_proto_files)
- set(address_sorting_unwanted_files)
)
grpcpp_public_headers = filter_grpcpp(
set(list_lib_files("grpc++", ("public_headers",)))
- set(grpc_public_headers)
set(collect_files_for_libs(grpcpp_full_deps, ("public_headers", )))
# We exclude proto related files in this particular podspec so that we can provide a protobuf-independent lib
- set(grpcpp_proto_files)
- set(address_sorting_unwanted_files)
)
grpcpp_abseil_specs = list_abseil_specs("grpc++")
%>

@ -34,6 +34,7 @@
return "abseil/" + label[5:].replace(":", "/")
def lib_and_transitive_deps(lib):
"""Return names of lib itself and all of its transitive dependencies."""
transitive_deps = []
lib_metadata = lib_maps.get(lib, None)
if lib_metadata:
@ -57,31 +58,23 @@
absl_specs.add(get_absl_spec_name(dep))
return list(sorted(absl_specs))
def list_lib_files(lib, fields):
def collect_files_for_libs(libs, fields):
files = set()
for lib_name in non_abseil_lib_and_transitive_deps(lib):
for lib_name in libs:
lib = lib_maps.get(lib_name, None)
if lib:
for field in fields:
files.update(lib.get(field, []))
return list(sorted(files))
# ObjectiveC doesn't use c-ares so we don't need address_sorting files at all
address_sorting_unwanted_files = list_lib_files("address_sorting", ("public_headers", "headers", "src"))
# ObjectiveC needs to obtain re2 explicitly unlike other languages; TODO @donnadionne make ObjC more consistent with others
grpc_private_files = list(
sorted((set(list_lib_files("grpc", ("headers", "src"))) -
set(address_sorting_unwanted_files))
| set(list_lib_files("re2", ("headers", "src")))))
grpc_public_headers = list(
sorted((set(list_lib_files("grpc", ("public_headers", ))) -
set(address_sorting_unwanted_files))
| set(list_lib_files("re2", ("public_headers", )))))
grpc_private_headers = list(
sorted((set(list_lib_files("grpc", ("headers", ))) -
set(address_sorting_unwanted_files))
| set(list_lib_files("re2", ("headers", )))))
# ObjectiveC doesn't use c-ares so we don't need address_sorting and cares files at all.
# absl deps will be declared explicitly so we also don't need to include them.
grpc_full_deps = set(non_abseil_lib_and_transitive_deps("grpc")) - set({"address_sorting", "cares"})
grpc_private_files = collect_files_for_libs(grpc_full_deps, ("headers", "src"))
grpc_public_headers = collect_files_for_libs(grpc_full_deps, ("public_headers", ))
grpc_private_headers = collect_files_for_libs(grpc_full_deps, ("headers", ))
grpc_abseil_specs = list_abseil_specs("grpc")
# TODO(jtattermusch): build.yaml is now generated from bazel build

@ -139,7 +139,7 @@
},
'targets': [
% for lib in libs:
% if getattr(lib, 'platforms', None) is None and lib.name != 'ares' and not is_absl_lib(lib.name):
% if getattr(lib, 'platforms', None) is None and lib.name != 'cares' and not is_absl_lib(lib.name):
{
'target_name': '${lib.name}',
'type': 'static_library',

@ -40,7 +40,8 @@
lib = lib_maps.get(dep, None)
if lib:
php_deps.extend(lib.transitive_deps)
for dep in php_deps:
# construct list of all source files, but explicitly exclude cares
for dep in set(php_deps) - set({'cares'}):
lib = lib_maps.get(dep, None)
if lib:
srcs.extend(lib.get('public_headers', []) + lib.headers + lib.src)

Loading…
Cancel
Save