Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / platform / device.gni
1 # Copyright (c) 2020 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 # TIZEN_CHIP_MODIFY
16
17 import("//build_overrides/chip.gni")
18 import("${chip_root}/src/ble/ble.gni")
19
20 declare_args() {
21   # Device platform layer: cc13x2_26x2, darwin, efr32, esp32, external, freertos, linux, nrfconnect, k32w, qpg6100, tizen, none.
22   chip_device_platform = "tizen"
23   chip_platform_target = ""
24 }
25
26 if (chip_device_platform == "auto") {
27   if (current_os == "mac" || current_os == "ios") {
28     chip_device_platform = "darwin"
29   } else if (current_os == "linux") {
30     chip_device_platform = "linux"
31   } else {
32     chip_device_platform = "none"
33   }
34 }
35
36 declare_args() {
37   # Enable openthread support.
38   chip_enable_openthread =
39       chip_device_platform == "linux" || chip_device_platform == "qpg6100" ||
40       chip_device_platform == "cc13x2_26x2" || chip_device_platform == "k32w" || chip_device_platform == "tizen"
41
42   # Enable wifi support.
43   chip_enable_wifi = chip_device_platform == "linux" || chip_device_platform == "tizen"
44
45   # Enable ble support.
46   chip_enable_ble =
47       chip_config_network_layer_ble &&
48       (chip_device_platform == "linux" || chip_device_platform == "darwin" ||
49        chip_device_platform == "cc13x2_26x2" || chip_device_platform == "tizen")
50
51   if (chip_device_platform == "linux" || chip_device_platform == "esp32") {
52     chip_mdns = "minimal"
53   } else if (chip_device_platform == "darwin" || chip_device_platform == "tizen") {
54     chip_mdns = "platform"
55   } else {
56     chip_mdns = "none"
57   }
58 }
59
60 _chip_device_layer = "none"
61 if (chip_device_platform == "cc13x2_26x2") {
62   _chip_device_layer = "cc13x2_26x2"
63 } else if (chip_device_platform == "darwin") {
64   _chip_device_layer = "Darwin"
65 } else if (chip_device_platform == "efr32") {
66   _chip_device_layer = "EFR32"
67 } else if (chip_device_platform == "esp32") {
68   _chip_device_layer = "ESP32"
69 } else if (chip_device_platform == "linux") {
70   _chip_device_layer = "Linux"
71 } else if (chip_device_platform == "tizen") {
72   _chip_device_layer = "Tizen"
73 } else if (chip_device_platform == "nrfconnect") {
74   _chip_device_layer = "nrfconnect"
75 } else if (chip_device_platform == "qpg6100") {
76   _chip_device_layer = "qpg6100"
77 } else if (chip_device_platform == "k32w") {
78   _chip_device_layer = "K32W"
79 }
80
81 if (chip_device_platform != "external") {
82   chip_ble_platform_config_include = ""
83   chip_device_platform_config_include = ""
84   chip_platform_config_include = ""
85   chip_inet_platform_config_include = ""
86   chip_system_platform_config_include = ""
87 } else {
88   declare_args() {
89     chip_ble_platform_config_include = ""
90     chip_device_platform_config_include = ""
91     chip_platform_config_include = ""
92     chip_inet_platform_config_include = ""
93     chip_system_platform_config_include = ""
94   }
95 }
96
97 if (_chip_device_layer != "none" && chip_device_platform != "external") {
98   chip_ble_platform_config_include =
99       "<platform/" + _chip_device_layer + "/BlePlatformConfig.h>"
100   chip_device_platform_config_include =
101       "<platform/" + _chip_device_layer + "/CHIPDevicePlatformConfig.h>"
102   chip_platform_config_include =
103       "<platform/" + _chip_device_layer + "/CHIPPlatformConfig.h>"
104   chip_inet_platform_config_include =
105       "<platform/" + _chip_device_layer + "/InetPlatformConfig.h>"
106   chip_system_platform_config_include =
107       "<platform/" + _chip_device_layer + "/SystemPlatformConfig.h>"
108 }
109
110 assert(
111     (current_os != "freertos" && chip_device_platform == "none") ||
112         chip_device_platform == "cc13x2_26x2" ||
113         chip_device_platform == "darwin" || chip_device_platform == "efr32" ||
114         chip_device_platform == "esp32" || chip_device_platform == "external" ||
115         chip_device_platform == "linux" || chip_device_platform == "tizen" ||
116         chip_device_platform == "nrfconnect" ||
117         chip_device_platform == "k32w" || chip_device_platform == "qpg6100",
118     "Please select a valid value for chip_device_platform")