mirror of
https://fuchsia.googlesource.com/third_party/pigweed.googlesource.com/pigweed/pigweed
synced 2024-09-21 14:16:26 +00:00
93 lines
3.1 KiB
Plaintext
93 lines
3.1 KiB
Plaintext
|
# Copyright 2020 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.
|
||
|
|
||
|
# gn-format disable
|
||
|
import("//build_overrides/pigweed.gni")
|
||
|
|
||
|
import("$dir_pw_arduino_build/arduino.gni")
|
||
|
import("$dir_pw_build/target_types.gni")
|
||
|
import("$dir_pw_docgen/docs.gni")
|
||
|
import("$dir_pw_toolchain/generate_toolchain.gni")
|
||
|
pw_doc_group("target_docs") {
|
||
|
sources = [ "target_docs.rst" ]
|
||
|
}
|
||
|
|
||
|
if (dir_pw_third_party_arduino != "") {
|
||
|
import("target_toolchains.gni")
|
||
|
generate_toolchains("target_toolchains") {
|
||
|
toolchains = pw_target_toolchain_arduino_list
|
||
|
}
|
||
|
|
||
|
config("arduino_build") {
|
||
|
# Debug: Print out arduinobuilder.py args
|
||
|
# print(string_join(" ", [rebase_path(arduino_builder_script)] + arduino_global_args))
|
||
|
|
||
|
# Run prebuilds
|
||
|
# TODO(tonymd) This only needs to be run once but it's happening multiple times.
|
||
|
exec_script(arduino_builder_script,
|
||
|
arduino_global_args + [ "--run-prebuilds" ],
|
||
|
"string")
|
||
|
|
||
|
_exclude_flags = [ "-std=gnu++14" ]
|
||
|
|
||
|
_cflags = exec_script(arduino_builder_script,
|
||
|
arduino_global_args + [ "--c-flags" ],
|
||
|
"list lines")
|
||
|
cflags = filter_exclude(_cflags, _exclude_flags)
|
||
|
|
||
|
asmflags = exec_script(arduino_builder_script,
|
||
|
arduino_global_args + [ "--s-flags" ],
|
||
|
"list lines")
|
||
|
|
||
|
_cflags_cc = exec_script(arduino_builder_script,
|
||
|
arduino_global_args + [ "--cpp-flags" ],
|
||
|
"list lines")
|
||
|
cflags_cc = filter_exclude(_cflags_cc, _exclude_flags)
|
||
|
|
||
|
_ldflags = exec_script(arduino_builder_script,
|
||
|
arduino_global_args + [ "--ld-flags" ],
|
||
|
"list lines")
|
||
|
ldflags =
|
||
|
filter_exclude(_ldflags,
|
||
|
[
|
||
|
# Remove arguments ending in 'core.a', for example:
|
||
|
# C:/Users/username/pigweed/out/core.a
|
||
|
"*core.a\b",
|
||
|
|
||
|
# Remove .elf output file, for example:
|
||
|
# -o C:/Users/username/pigweed/out/pigweed.elf
|
||
|
"\b-o\b",
|
||
|
"*.elf\b",
|
||
|
|
||
|
# Remove the Arduino {object_files} variable
|
||
|
"{object_files}",
|
||
|
])
|
||
|
}
|
||
|
|
||
|
if (current_toolchain != default_toolchain) {
|
||
|
pw_source_set("pre_init") {
|
||
|
public_deps = [
|
||
|
"$dir_pw_sys_io_arduino",
|
||
|
"$dir_pw_third_party_arduino:arduino_core_sources",
|
||
|
]
|
||
|
deps = [ "$dir_pw_preprocessor" ]
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
group("arduino_build") {
|
||
|
}
|
||
|
group("pre_init") {
|
||
|
}
|
||
|
}
|