Make default AddressResolve implementation the default (#32824)
This avoids having to manually define CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER
with the default value in non-gn build systems (e.g. Xcode).
diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj
index a156bb4..ca30f3c 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=<lib/address_resolve/AddressResolve_DefaultImpl.h>",
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=<lib/address_resolve/AddressResolve_DefaultImpl.h>",
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=<lib/address_resolve/AddressResolve_DefaultImpl.h>",
"$(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=<lib/address_resolve/AddressResolve_DefaultImpl.h>",
"$(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=<lib/address_resolve/AddressResolve_DefaultImpl.h>",
"$(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 bcfdc9c..7dffeed 100644
--- a/src/lib/address_resolve/AddressResolve.h
+++ b/src/lib/address_resolve/AddressResolve.h
@@ -253,13 +253,17 @@
} // 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 <lib/address_resolve/AddressResolve_DefaultImpl.h>
+#endif
namespace chip {
namespace AddressResolve {
diff --git a/src/lib/address_resolve/BUILD.gn b/src/lib/address_resolve/BUILD.gn
index d35a1d4..68f79c9 100644
--- a/src/lib/address_resolve/BUILD.gn
+++ b/src/lib/address_resolve/BUILD.gn
@@ -17,10 +17,6 @@
import("address_resolve.gni")
-config("default_address_resolve_config") {
- defines = [ "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>" ]
-}
-
static_library("address_resolve") {
public_deps = [
"${chip_root}/src/lib/asn1",
@@ -44,8 +40,6 @@
"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