Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / pigweed / repo / third_party / arduino / BUILD.gn
1 # Copyright 2020 The Pigweed Authors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 # use this file except in compliance with the License. You may obtain a copy of
5 # the License at
6 #
7 #     https://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, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations under
13 # the License.
14
15 import("//build_overrides/pigweed.gni")
16
17 import("$dir_pw_arduino_build/arduino.gni")
18 import("$dir_pw_build/target_types.gni")
19
20 if (pw_arduino_build_CORE_PATH != "") {
21   pw_source_set("arduino_core_sources") {
22     remove_configs = [ "$dir_pw_build:strict_warnings" ]
23
24     _core_c_files =
25         exec_script(arduino_builder_script,
26                     arduino_show_command_args + [ "--core-c-files" ],
27                     "list lines")
28     _core_s_files = filter_exclude(
29             exec_script(arduino_builder_script,
30                         arduino_show_command_args + [ "--core-s-files" ],
31                         "list lines"),
32             # TODO(tonymd): Conditionally remove this source file unless building for cortex-m0.
33             # Exception for adafruit-samd core
34             # pulse_asm.S is for: '.cpu cortex-m0plus .fpu softvfp'
35             [ "*pulse_asm.S\b" ])
36
37     _core_cpp_files =
38         exec_script(arduino_builder_script,
39                     arduino_show_command_args + [ "--core-cpp-files" ],
40                     "list lines")
41     _variant_c_files =
42         exec_script(arduino_builder_script,
43                     arduino_show_command_args + [ "--variant-c-files" ],
44                     "list lines")
45     _variant_s_files =
46         exec_script(arduino_builder_script,
47                     arduino_show_command_args + [ "--variant-s-files" ],
48                     "list lines")
49     _variant_cpp_files =
50         exec_script(arduino_builder_script,
51                     arduino_show_command_args + [ "--variant-cpp-files" ],
52                     "list lines")
53
54     # Some cores have required built in libraries:
55     # - stm32duino requires SrcWrapper.
56     _library_c_files =
57         exec_script(arduino_builder_script,
58                     arduino_show_command_args + [ "--library-c-files" ],
59                     "list lines")
60     _library_s_files =
61         exec_script(arduino_builder_script,
62                     arduino_show_command_args + [ "--library-s-files" ],
63                     "list lines")
64     _library_cpp_files =
65         exec_script(arduino_builder_script,
66                     arduino_show_command_args + [ "--library-cpp-files" ],
67                     "list lines")
68
69     sources = _core_c_files + _core_s_files + _core_cpp_files +
70               _variant_c_files + _variant_s_files + _variant_cpp_files +
71               _library_c_files + _library_s_files + _library_cpp_files
72
73     # Rename main() to ArduinoMain()
74     # See //pw_arduino_build/docs.rst for details on this approach.
75     defines = [ "main(...)=ArduinoMain()" ]
76   }
77 } else {
78   group("arduino_core_sources") {
79   }
80 }