Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / lib / core / BUILD.gn
1 # Copyright (c) 2020-2021 Project CHIP Authors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import("//build_overrides/build.gni")
16 import("//build_overrides/chip.gni")
17 import("//build_overrides/nlio.gni")
18
19 import("${chip_root}/build/chip/buildconfig_header.gni")
20 import("${chip_root}/build/chip/tests.gni")
21 import("${chip_root}/src/inet/inet.gni")
22 import("core.gni")
23
24 buildconfig_header("chip_buildconfig") {
25   header = "CHIPBuildConfig.h"
26   header_dir = "core"
27
28   chip_target_style_unix = chip_target_style == "unix"
29   chip_target_style_embedded = chip_target_style == "embedded"
30
31   chip_config_memory_management_malloc =
32       chip_config_memory_management == "malloc"
33   chip_config_memory_management_simple =
34       chip_config_memory_management == "simple"
35   chip_config_memory_management_platform =
36       chip_config_memory_management == "platform"
37
38   # TODO - Move CHIP_PROJECT_CONFIG_INCLUDE, CHIP_PLATFORM_CONFIG_INCLUDE here.
39   # Currently those are also used from src/system.
40   defines = [
41     "CHIP_FUZZING_ENABLED=false",
42     "CHIP_CONFIG_TEST=${chip_build_tests}",
43     "CHIP_ERROR_LOGGING=${chip_error_logging}",
44     "CHIP_PROGRESS_LOGGING=${chip_progress_logging}",
45     "CHIP_DETAIL_LOGGING=${chip_detail_logging}",
46     "CHIP_CONFIG_SHORT_ERROR_STR=${chip_config_short_error_str}",
47     "CHIP_CONFIG_ENABLE_ARG_PARSER=${chip_config_enable_arg_parser}",
48     "CHIP_TARGET_STYLE_UNIX=${chip_target_style_unix}",
49     "CHIP_TARGET_STYLE_EMBEDDED=${chip_target_style_embedded}",
50     "CHIP_CONFIG_MEMORY_MGMT_MALLOC=${chip_config_memory_management_malloc}",
51     "HAVE_MALLOC=${chip_config_memory_management_malloc}",
52     "HAVE_FREE=${chip_config_memory_management_malloc}",
53     "HAVE_NEW=false",
54     "CHIP_CONFIG_MEMORY_MGMT_SIMPLE=${chip_config_memory_management_simple}",
55     "CHIP_CONFIG_MEMORY_MGMT_PLATFORM=${chip_config_memory_management_platform}",
56     "CHIP_CONFIG_MEMORY_DEBUG_CHECKS=${chip_config_memory_debug_checks}",
57     "CHIP_CONFIG_MEMORY_DEBUG_DMALLOC=${chip_config_memory_debug_dmalloc}",
58     "CHIP_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES=false",
59     "CHIP_ENABLE_INTERACTION_MODEL=${chip_enable_interaction_model}",
60   ]
61 }
62
63 source_set("chip_config_header") {
64   sources = [
65     "CHIPConfig.h",
66     "CHIPEventLoggingConfig.h",
67     "CHIPTimeConfig.h",
68   ]
69
70   public_configs = [
71     "${chip_root}/src:includes",
72     "${chip_root}/src/lib:includes",
73   ]
74
75   public_deps = [
76     ":chip_buildconfig",
77     "${chip_root}/src/ble:ble_config_header",
78     "${chip_root}/src/system:system_config_header",
79   ]
80
81   allow_circular_includes_from = [ "${chip_root}/src/ble:ble_config_header" ]
82 }
83
84 static_library("core") {
85   output_name = "libChipCore"
86
87   sources = [
88     "CHIPCallback.h",
89     "CHIPCircularTLVBuffer.cpp",
90     "CHIPCircularTLVBuffer.h",
91     "CHIPCore.h",
92     "CHIPEncoding.h",
93     "CHIPError.cpp",
94     "CHIPError.h",
95     "CHIPKeyIds.cpp",
96     "CHIPKeyIds.h",
97     "CHIPTLV.h",
98     "CHIPTLVDebug.cpp",
99     "CHIPTLVReader.cpp",
100     "CHIPTLVTags.h",
101     "CHIPTLVTypes.h",
102     "CHIPTLVUpdater.cpp",
103     "CHIPTLVUtilities.cpp",
104     "CHIPTLVWriter.cpp",
105   ]
106
107   cflags = [ "-Wconversion" ]
108
109   public_deps = [
110     ":chip_config_header",
111     "${chip_root}/src/ble",
112     "${chip_root}/src/inet",
113     "${chip_root}/src/lib/support",
114     "${chip_root}/src/system",
115     "${nlio_root}:nlio",
116   ]
117
118   allow_circular_includes_from = [
119     "${chip_root}/src/ble",
120     "${chip_root}/src/lib/support",
121     "${chip_root}/src/inet",
122     "${chip_root}/src/system",
123   ]
124 }