Skip to content

Commit 3bacb57

Browse files
Optimize compilation time (#27228)
* Optimize compilation time 1. Do not to include cluster-objects.h if not needed as parsing such a large header significantly impacts the build time and in most cases it is enough to include ClusterEnums.h. 2. Do not build the controller library for embedded targets, by default. If needed, this can be overriden using the chip_build_controller argument from lib.gni. * Fix build
1 parent 3633de9 commit 3bacb57

30 files changed

+53
-10
lines changed

examples/all-clusters-minimal-app/asr/src/DeviceCallbacks.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "DeviceCallbacks.h"
2626

2727
#include "CHIPDeviceManager.h"
28+
#include <app-common/zap-generated/ids/Attributes.h>
2829
#include <app-common/zap-generated/ids/Clusters.h>
2930
#include <app/CommandHandler.h>
3031
#include <app/server/Dnssd.h>

examples/bridge-app/asr/subdevice/SubDeviceManager.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "SubDeviceManager.h"
2020
#include "SubDevice.h"
21+
#include <app-common/zap-generated/cluster-objects.h>
2122
#include <app-common/zap-generated/ids/Attributes.h>
2223
#include <app-common/zap-generated/ids/Clusters.h>
2324
#include <app/ConcreteAttributePath.h>

examples/bridge-app/asr/subdevice/subdevice_test.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "SubDeviceManager.h"
2121
#include <app-common/zap-generated/ids/Attributes.h>
2222
#include <app-common/zap-generated/ids/Clusters.h>
23+
#include <app-common/zap-generated/ids/Commands.h>
2324
#include <app/ConcreteAttributePath.h>
2425
#include <app/InteractionModelEngine.h>
2526
#include <app/clusters/identify-server/identify-server.h>

examples/contact-sensor-app/nxp/k32w/k32w0/main/ZclCallbacks.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "AppTask.h"
2222
#include "ContactSensorManager.h"
2323

24+
#include <app-common/zap-generated/cluster-objects.h>
2425
#include <app-common/zap-generated/ids/Attributes.h>
2526
#include <app-common/zap-generated/ids/Clusters.h>
2627
#include <app/ConcreteAttributePath.h>

examples/platform/silabs/efr32/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ source_set("efr32-common") {
357357

358358
public_deps += [
359359
"${chip_root}/examples/providers:device_info_provider",
360+
"${chip_root}/src/app/server",
360361
"${chip_root}/src/lib",
361362
"${chip_root}/src/setup_payload",
362363
]

examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.h

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <lib/support/JniReferences.h>
2929
#include <lib/support/JniTypeWrappers.h>
3030

31+
#include <app-common/zap-generated/cluster-objects.h>
32+
3133
class CallbackBaseJNI
3234
{
3335
public:

examples/tv-casting-app/tv-casting-common/include/ApplicationBasic.h

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include <controller/CHIPCluster.h>
2323

24+
#include <app-common/zap-generated/cluster-objects.h>
25+
2426
// SUBSCRIBER CLASSES
2527
class VendorNameSubscriber : public MediaSubscriptionBase<chip::app::Clusters::ApplicationBasic::Attributes::VendorName::TypeInfo>
2628
{

examples/tv-casting-app/tv-casting-common/include/ApplicationLauncher.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <controller/CHIPCluster.h>
2323
#include <functional>
2424

25+
#include <app-common/zap-generated/cluster-objects.h>
26+
2527
// COMMAND CLASSES
2628
class LaunchAppCommand
2729
: public MediaCommandBase<chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Type,

examples/tv-casting-app/tv-casting-common/include/Channel.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <controller/CHIPCluster.h>
2323
#include <functional>
2424

25+
#include <app-common/zap-generated/cluster-objects.h>
26+
2527
// COMMAND CLASSES
2628
class ChangeChannelCommand : public MediaCommandBase<chip::app::Clusters::Channel::Commands::ChangeChannel::Type,
2729
chip::app::Clusters::Channel::Commands::ChangeChannelResponse::DecodableType>

examples/tv-casting-app/tv-casting-common/include/ContentLauncher.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <controller/CHIPCluster.h>
2323
#include <functional>
2424

25+
#include <app-common/zap-generated/cluster-objects.h>
26+
2527
// COMMAND CLASSES
2628
class LaunchURLCommand : public MediaCommandBase<chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type,
2729
chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::DecodableType>

examples/tv-casting-app/tv-casting-common/include/KeypadInput.h

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include <controller/CHIPCluster.h>
2222
#include <functional>
2323

24+
#include <app-common/zap-generated/cluster-objects.h>
25+
2426
class SendKeyCommand : public MediaCommandBase<chip::app::Clusters::KeypadInput::Commands::SendKey::Type,
2527
chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::DecodableType>
2628
{

examples/tv-casting-app/tv-casting-common/include/LevelControl.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <controller/CHIPCluster.h>
2323
#include <functional>
2424

25+
#include <app-common/zap-generated/cluster-objects.h>
26+
2527
// COMMAND CLASSES
2628
class StepCommand
2729
: public MediaCommandBase<chip::app::Clusters::LevelControl::Commands::Step::Type, chip::app::DataModel::NullObjectType>

examples/tv-casting-app/tv-casting-common/include/MediaPlayback.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <controller/CHIPCluster.h>
2323
#include <functional>
2424

25+
#include <app-common/zap-generated/cluster-objects.h>
26+
2527
// COMMAND CLASSES
2628
class PlayCommand : public MediaCommandBase<chip::app::Clusters::MediaPlayback::Commands::Play::Type,
2729
chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::DecodableType>

examples/tv-casting-app/tv-casting-common/include/OnOff.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <controller/CHIPCluster.h>
2323
#include <functional>
2424

25+
#include <app-common/zap-generated/cluster-objects.h>
26+
2527
// COMMAND CLASSES
2628
class OnCommand : public MediaCommandBase<chip::app::Clusters::OnOff::Commands::On::Type, chip::app::DataModel::NullObjectType>
2729
{

examples/tv-casting-app/tv-casting-common/include/TargetNavigator.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include <controller/CHIPCluster.h>
2323
#include <functional>
2424

25+
#include <app-common/zap-generated/cluster-objects.h>
26+
2527
// COMMAND CLASSES
2628
class NavigateTargetCommand
2729
: public MediaCommandBase<chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::Type,

examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include <app/OperationalSessionSetup.h>
2424
#include <platform/CHIPDeviceLayer.h>
2525

26+
#include <app-common/zap-generated/cluster-objects.h>
27+
2628
constexpr size_t kMaxNumberOfEndpoints = 5;
2729

2830
class TargetVideoPlayerInfo;

src/app/chip_data_model.cmake

+4-2
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ function(chip_configure_data_model APP_TARGET)
7575

7676
if (ARG_INCLUDE_SERVER)
7777
target_sources(${APP_TARGET} ${SCOPE}
78-
${CHIP_APP_BASE_DIR}/server/EchoHandler.cpp
78+
${CHIP_APP_BASE_DIR}/server/AclStorage.cpp
79+
${CHIP_APP_BASE_DIR}/server/DefaultAclStorage.cpp
80+
${CHIP_APP_BASE_DIR}/server/CommissioningWindowManager.cpp
7981
${CHIP_APP_BASE_DIR}/server/Dnssd.cpp
82+
${CHIP_APP_BASE_DIR}/server/EchoHandler.cpp
8083
${CHIP_APP_BASE_DIR}/server/OnboardingCodesUtil.cpp
8184
${CHIP_APP_BASE_DIR}/server/Server.cpp
82-
${CHIP_APP_BASE_DIR}/server/CommissioningWindowManager.cpp
8385
)
8486

8587
target_compile_options(${APP_TARGET} ${SCOPE}

src/app/server/CommissioningWindowManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
#pragma once
1919

20-
#include <app-common/zap-generated/cluster-objects.h>
2120
#include <app/data-model/Nullable.h>
2221
#include <app/server/AppDelegate.h>
2322
#include <app/server/CommissioningModeProvider.h>
2423
#include <lib/core/CHIPVendorIdentifiers.hpp>
24+
#include <lib/core/ClusterEnums.h>
2525
#include <lib/core/DataModelTypes.h>
2626
#include <lib/dnssd/Advertiser.h>
2727
#include <messaging/ExchangeDelegate.h>

src/app/util/generic-callbacks.h

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#pragma once
1919

20-
#include <app-common/zap-generated/cluster-objects.h>
2120
#include <app/util/af-types.h>
2221
#include <app/util/attribute-metadata.h>
2322
#include <app/util/basic-types.h>

src/controller/CommissioningDelegate.h

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#pragma once
20+
#include <app-common/zap-generated/cluster-objects.h>
2021
#include <app/OperationalSessionSetup.h>
2122
#include <controller/CommissioneeDeviceProxy.h>
2223
#include <credentials/attestation_verifier/DeviceAttestationDelegate.h>

src/credentials/GroupDataProvider.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
#include <stdint.h>
2121
#include <sys/types.h>
2222

23-
#include <app-common/zap-generated/cluster-objects.h>
2423
#include <app/util/basic-types.h>
2524
#include <crypto/CHIPCryptoPAL.h>
2625
#include <lib/core/CHIPError.h>
26+
#include <lib/core/ClusterEnums.h>
2727
#include <lib/support/CHIPMemString.h>
2828
#include <lib/support/CommonIterator.h>
2929

src/include/platform/AttributeList.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
#pragma once
2424

25-
#include <app-common/zap-generated/cluster-objects.h>
2625
#include <lib/core/CHIPError.h>
26+
#include <lib/support/CodeUtils.h>
2727

2828
namespace chip {
2929
namespace DeviceLayer {

src/include/platform/ConfigurationManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <setup_payload/CHIPAdditionalDataPayloadBuildConfig.h>
3232
#endif
3333

34-
#include <app-common/zap-generated/cluster-objects.h>
34+
#include <lib/core/ClusterEnums.h>
3535
#include <lib/support/Span.h>
3636
#include <platform/PersistedStorage.h>
3737
#include <platform/internal/CHIPDeviceLayerInternal.h>

src/include/platform/ConnectivityManager.h

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include <platform/CHIPDeviceConfig.h>
3232
#include <platform/CHIPDeviceEvent.h>
3333

34-
#include <app-common/zap-generated/cluster-objects.h>
3534
#include <app/util/basic-types.h>
3635

3736
#if INET_CONFIG_ENABLE_TCP_ENDPOINT

src/include/platform/ThreadStackManager.h

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
#pragma once
2525

26-
#include <app-common/zap-generated/cluster-objects.h>
2726
#include <app/AttributeAccessInterface.h>
2827
#include <app/util/basic-types.h>
2928
#include <inet/IPAddress.h>

src/lib/BUILD.gn

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ static_library("lib") {
1919
public_deps = [
2020
"${chip_root}/src/app",
2121
"${chip_root}/src/ble",
22-
"${chip_root}/src/controller",
2322
"${chip_root}/src/crypto",
2423
"${chip_root}/src/inet",
2524
"${chip_root}/src/lib/asn1",
@@ -28,11 +27,17 @@ static_library("lib") {
2827
"${chip_root}/src/lib/support",
2928
"${chip_root}/src/messaging",
3029
"${chip_root}/src/platform",
30+
"${chip_root}/src/protocols",
3131
"${chip_root}/src/setup_payload",
3232
"${chip_root}/src/system",
3333
"${chip_root}/src/transport",
3434
]
3535

36+
# See src/lib/lib.gni for declaration of this build arg.
37+
if (chip_build_controller) {
38+
public_deps += [ "${chip_root}/src/controller" ]
39+
}
40+
3641
# Only include the shell if it is being used. The shell is
3742
# a debug feature mostly useful for embedded examples.
3843
# See src/lib/lib.gni for declaration of this build arg.

src/lib/lib.gni

+6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import("//build_overrides/chip.gni")
16+
import("${chip_root}/src/lib/core/core.gni")
17+
1518
declare_args() {
19+
# Build controller library.
20+
chip_build_controller = chip_target_style != "embedded"
21+
1622
# Enable libshell support.
1723
chip_build_libshell = false
1824

src/platform/Linux/ThreadStackManagerImpl.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <platform/PlatformManager.h>
2626
#include <platform/ThreadStackManager.h>
2727

28+
#include <app-common/zap-generated/ids/Attributes.h>
29+
2830
#include <nlbyteorder.hpp>
2931
#include <nlio-byteorder.hpp>
3032
#include <nlio.hpp>

src/platform/webos/ThreadStackManagerImpl.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <platform/ThreadStackManager.h>
2626
#include <platform/webos/NetworkCommissioningDriver.h>
2727

28+
#include <app-common/zap-generated/ids/Attributes.h>
29+
2830
#include <nlbyteorder.hpp>
2931
#include <nlio-byteorder.hpp>
3032
#include <nlio.hpp>

src/protocols/secure_channel/CASEDestinationId.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <credentials/FabricTable.h>
2121
#include <credentials/GroupDataProvider.h>
2222
#include <lib/core/CHIPError.h>
23+
#include <lib/support/BufferWriter.h>
2324
#include <lib/support/Span.h>
2425

2526
#include "CASEDestinationId.h"

0 commit comments

Comments
 (0)