Skip to content

Commit

Permalink
Make default AddressResolve implementation the default
Browse files Browse the repository at this point in the history
This avoids having to manually define CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER
with the default value in non-gn build systems (e.g. Xcode).
  • Loading branch information
ksperling-apple committed Apr 2, 2024
1 parent ff2ab2b commit a601e55
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
5 changes: 0 additions & 5 deletions src/darwin/Framework/Matter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 6 additions & 2 deletions src/lib/address_resolve/AddressResolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <lib/address_resolve/AddressResolve_DefaultImpl.h>
#endif

namespace chip {
namespace AddressResolve {
Expand Down
6 changes: 0 additions & 6 deletions src/lib/address_resolve/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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=<lib/address_resolve/AddressResolve_DefaultImpl.h>" ]
}

static_library("address_resolve") {
public_deps = [
"${chip_root}/src/lib/asn1",
Expand All @@ -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
Expand Down

0 comments on commit a601e55

Please sign in to comment.