From a601e5580d330cb58caf471e06efbb630bfb017e Mon Sep 17 00:00:00 2001 From: Karsten Sperling Date: Wed, 3 Apr 2024 12:43:31 +1300 Subject: [PATCH] Make default AddressResolve implementation the default This avoids having to manually define CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER with the default value in non-gn build systems (e.g. Xcode). --- src/darwin/Framework/Matter.xcodeproj/project.pbxproj | 5 ----- src/lib/address_resolve/AddressResolve.h | 8 ++++++-- src/lib/address_resolve/BUILD.gn | 6 ------ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index a156bb44b1aecd..ca30f3cdd9c02d 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -2031,7 +2031,6 @@ GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", CHIP_HAVE_CONFIG_H, - "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", CONFIG_BUILD_FOR_HOST_UNIT_TEST, "CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES=1", "CONFIG_USE_INTERACTIVE_MODE=1", @@ -2105,7 +2104,6 @@ GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", CHIP_HAVE_CONFIG_H, - "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", CONFIG_BUILD_FOR_HOST_UNIT_TEST, "CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES=1", "CONFIG_USE_INTERACTIVE_MODE=1", @@ -2208,7 +2206,6 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", - "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = YES; @@ -2252,7 +2249,6 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREPROCESSOR_DEFINITIONS = ( CHIP_HAVE_CONFIG_H, - "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", "$(inherited)", "CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES=1", "MTR_ENABLE_PROVISIONAL=1", @@ -2422,7 +2418,6 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREPROCESSOR_DEFINITIONS = ( CHIP_HAVE_CONFIG_H, - "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", "$(inherited)", "CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES=1", "MTR_ENABLE_PROVISIONAL=1", diff --git a/src/lib/address_resolve/AddressResolve.h b/src/lib/address_resolve/AddressResolve.h index bcfdc9c551356a..7dffeed01ed1d8 100644 --- a/src/lib/address_resolve/AddressResolve.h +++ b/src/lib/address_resolve/AddressResolve.h @@ -253,13 +253,17 @@ class Resolver } // namespace AddressResolve } // namespace chip -// outside the open space, include the required platform headers for the -// actual implementation. +// Include the required platform header for the actual implementation, if defined. +// Otherwise assume the default implementation is being used. // Expectations of this include: // - define the `Impl::NodeLookupHandle` deriving from NodeLookupHandleBase // - corresponding CPP file should provide a valid Resolver::Instance() // implementation +#ifdef CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER #include CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER +#else +#include +#endif namespace chip { namespace AddressResolve { diff --git a/src/lib/address_resolve/BUILD.gn b/src/lib/address_resolve/BUILD.gn index d35a1d4aec9a5f..68f79c9d8efe1b 100644 --- a/src/lib/address_resolve/BUILD.gn +++ b/src/lib/address_resolve/BUILD.gn @@ -17,10 +17,6 @@ import("//build_overrides/chip.gni") import("address_resolve.gni") -config("default_address_resolve_config") { - defines = [ "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" ] -} - static_library("address_resolve") { public_deps = [ "${chip_root}/src/lib/asn1", @@ -44,8 +40,6 @@ static_library("address_resolve") { "AddressResolve_DefaultImpl.cpp", "AddressResolve_DefaultImpl.h", ] - - public_configs = [ ":default_address_resolve_config" ] } else if (chip_address_resolve_strategy == "custom") { # nothing to do here, custom implementation # assume CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER is defined as a constant