Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / persistent-storage / efr32 / BUILD.gn
1 # Copyright (c) 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/efr32_sdk.gni")
18 import("//build_overrides/pigweed.gni")
19
20 import("${build_root}/config/defaults.gni")
21
22 import("${efr32_sdk_build_root}/efr32_executable.gni")
23 import("${efr32_sdk_build_root}/efr32_sdk.gni")
24
25 assert(current_os == "freertos")
26
27 efr32_project_dir = "${chip_root}/examples/persistent-storage/efr32"
28 examples_plat_dir = "${chip_root}/examples/platform/efr32"
29
30 efr32_sdk("sdk") {
31   include_dirs = [
32     "${chip_root}/src/platform/EFR32",
33     "${efr32_project_dir}/include",
34     "${efr32_project_dir}/src",
35     "${examples_plat_dir}",
36     "${examples_plat_dir}/${efr32_family}/${efr32_board}",
37   ]
38
39   sources = [
40     "${efr32_project_dir}/include/CHIPProjectConfig.h",
41     "${efr32_project_dir}/include/FreeRTOSConfig.h",
42   ]
43
44   defines = [
45     "BOARD_ID=${efr32_board}",
46     "SL_HEAP_SIZE=(10 * 1024)",
47   ]
48 }
49
50 efr32_executable("persistent_storage") {
51   include_dirs = [ "${efr32_project_dir}/.." ]
52   defines = []
53   output_name = "chip-efr32-persistent_storage-example.out"
54
55   deps = [ "$dir_pw_kvs:crc16" ]
56   public_deps = [
57     ":sdk",
58     "$dir_pw_assert",
59     "${chip_root}/src/lib",
60   ]
61
62   include_dirs += [
63     "${efr32_project_dir}/include",
64     "${chip_root}/src/app/util",
65     "${examples_plat_dir}",
66     "${examples_plat_dir}/${efr32_family}/${efr32_board}",
67   ]
68
69   sources = [
70     "${efr32_project_dir}/../KeyValueStorageTest.cpp",
71     "${examples_plat_dir}/init_efrPlatform.cpp",
72     "${examples_plat_dir}/uart.c",
73     "main.cpp",
74   ]
75
76   output_dir = root_out_dir
77
78   if (efr32_family == "efr32mg12") {
79     ldscript = "${examples_plat_dir}/ldscripts/efr32-MG12P.ld"
80   } else if (efr32_family == "efr32mg21") {
81     ldscript = "${examples_plat_dir}/ldscripts/efr32-MG21.ld"
82   }
83
84   ldflags = [ "-T" + rebase_path(ldscript, root_build_dir) ]
85 }
86
87 group("efr32") {
88   deps = [ ":persistent_storage" ]
89 }
90
91 group("default") {
92   deps = [ ":efr32" ]
93 }