| # Copyright 2022 The Pigweed Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| # use this file except in compliance with the License. You may obtain a copy of |
| # the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations under |
| # the License. |
| |
| import("//build_overrides/pigweed.gni") |
| import("$dir_pw_arduino_build/arduino.gni") |
| import("$dir_pw_build/target_types.gni") |
| |
| if (pw_arduino_build_CORE_PATH != "") { |
| config("default_config") { |
| include_dirs = [ "public" ] |
| } |
| |
| # Common library arguments to the arduino_builder tool. |
| _library_args = [ |
| "--library-path", |
| rebase_path( |
| "$pw_arduino_build_CORE_PATH/teensy/hardware/${pw_arduino_build_PACKAGE_NAME}/libraries"), |
| "--library-names", |
| |
| # Arduino Core Libaries. The c/c++ files for these should only be included |
| # once in any given pw_executable. |
| "SPI", |
| ] |
| |
| _library_include_dirs = |
| exec_script(arduino_builder_script, |
| arduino_show_command_args + _library_args + |
| [ "--library-include-dirs" ], |
| "list lines") |
| |
| config("arduino_spi_config") { |
| include_dirs = _library_include_dirs |
| } |
| |
| _library_c_files = exec_script( |
| arduino_builder_script, |
| arduino_show_command_args + _library_args + [ "--library-c-files" ], |
| "list lines") |
| |
| _library_cpp_files = exec_script( |
| arduino_builder_script, |
| arduino_show_command_args + _library_args + [ "--library-cpp-files" ], |
| "list lines") |
| |
| pw_source_set("arduino_spi_sources") { |
| public_configs = [ ":arduino_spi_config" ] |
| deps = [ "$dir_pw_third_party/arduino:arduino_core_sources" ] |
| sources = _library_c_files + _library_cpp_files |
| include_dirs = _library_include_dirs |
| remove_configs = [ "$dir_pw_build:strict_warnings" ] |
| } |
| } |
| |
| pw_source_set("pw_spi_arduino") { |
| public_configs = [ ":default_config" ] |
| public = [ |
| "public/pw_spi_arduino/chip_selector.h", |
| "public/pw_spi_arduino/initiator.h", |
| ] |
| public_deps = [ |
| ":arduino_spi_sources", |
| "$dir_pw_status", |
| ] |
| deps = [ |
| "$dir_pw_digital_io", |
| "$dir_pw_log", |
| "$dir_pw_spi:chip_selector", |
| "$dir_pw_spi:initiator", |
| ] |
| sources = [ |
| "chip_selector.cc", |
| "initiator.cc", |
| ] |
| remove_configs = [ "$dir_pw_build:strict_warnings" ] |
| } |