1# Copyright 2021 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 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/gn_internal/build_target.gni") 18 19# Note: In general, prefer to import target_types.gni rather than this file. 20# cc_executable.gni and cc_library.gni are both provided by target_types.gni. 21# 22# cc_library.gni is split out from cc_executable.gni because pw_executable 23# templates may need to create pw_source_set targets internally, and can't 24# import target_types.gni because it creates a circular import path. 25 26# These templates are wrappers for GN's built-in source_set, static_library, 27# and shared_library targets. 28# 29# For more information on the features provided by these templates, see the full 30# docs at https://pigweed.dev/pw_build/?highlight=pw_executable#target-types. 31# 32# In addition to the arguments supported by the underlying native target types, 33# these templates introduce the following arguments: 34# 35# remove_configs: (optional) A list of configs to remove from the set of 36# default configs specified by the current toolchain configuration. 37# remove_public_deps: (optional) A list of targets to remove from the set of 38# default public_deps specified by the current toolchain configuration. 39 40template("pw_source_set") { 41 pw_internal_build_target(target_name) { 42 forward_variables_from(invoker, "*") 43 if (!defined(add_global_link_deps)) { 44 add_global_link_deps = false 45 } 46 underlying_target_type = "source_set" 47 } 48} 49 50template("pw_static_library") { 51 pw_internal_build_target(target_name) { 52 forward_variables_from(invoker, "*") 53 if (!defined(add_global_link_deps)) { 54 add_global_link_deps = false 55 } 56 underlying_target_type = "static_library" 57 } 58} 59 60template("pw_shared_library") { 61 pw_internal_build_target(target_name) { 62 forward_variables_from(invoker, "*") 63 if (!defined(add_global_link_deps)) { 64 add_global_link_deps = false 65 } 66 underlying_target_type = "shared_library" 67 } 68} 69