|
1 | 1 | load("//cc/toolchains:args.bzl", "cc_args") |
2 | 2 | load("//cc/toolchains:feature.bzl", "cc_feature") |
3 | 3 | load("//cc/toolchains:feature_set.bzl", "cc_feature_set") |
| 4 | +load("//cc/toolchains:nested_args.bzl", "cc_nested_args") |
4 | 5 |
|
5 | 6 | cc_feature_set( |
6 | 7 | name = "feature", |
7 | 8 | all_of = [ |
8 | 9 | ":user_link_flags_feature", |
9 | 10 | ":legacy_link_flags_feature", |
10 | 11 | ":output_link_flags_feature", |
| 12 | + ":build_interface_libraries_feature", |
| 13 | + ":dynamic_library_linker_tool_feature", |
11 | 14 | ], |
12 | 15 | visibility = ["//visibility:public"], |
13 | 16 | ) |
@@ -58,3 +61,93 @@ cc_args( |
58 | 61 | format = {"output_execpath": "//cc/toolchains/variables:output_execpath"}, |
59 | 62 | requires_not_none = "//cc/toolchains/variables:output_execpath", |
60 | 63 | ) |
| 64 | + |
| 65 | +cc_feature( |
| 66 | + name = "build_interface_libraries_feature", |
| 67 | + args = ["build_interface_libraries"], |
| 68 | + overrides = "//cc/toolchains/features/legacy:build_interface_libraries", |
| 69 | +) |
| 70 | + |
| 71 | +cc_args( |
| 72 | + name = "build_interface_libraries", |
| 73 | + actions = ["//cc/toolchains/actions:dynamic_library_link_actions"], |
| 74 | + nested = [":build_interface_libraries_check"], |
| 75 | + requires_not_none = "//cc/toolchains/variables:generate_interface_library", |
| 76 | +) |
| 77 | + |
| 78 | +cc_nested_args( |
| 79 | + name = "build_interface_libraries_check", |
| 80 | + nested = select({ |
| 81 | + "@platforms//os:windows": [":windows_build_interface_libraries"], |
| 82 | + "//conditions:default": [":generic_build_interface_libraries"], |
| 83 | + }), |
| 84 | + requires_equal = "//cc/toolchains/variables:generate_interface_library", |
| 85 | + requires_equal_value = "yes", |
| 86 | +) |
| 87 | + |
| 88 | +cc_nested_args( |
| 89 | + name = "windows_build_interface_libraries", |
| 90 | + args = ["-Wl,/IMPLIB:{interface_library_output_path}"], |
| 91 | + format = {"interface_library_output_path": "//cc/toolchains/variables:interface_library_output_path"}, |
| 92 | + requires_not_none = "//cc/toolchains/variables:interface_library_output_path", |
| 93 | +) |
| 94 | + |
| 95 | +cc_nested_args( |
| 96 | + name = "generic_build_interface_libraries", |
| 97 | + nested = [ |
| 98 | + ":generate_interface_library", |
| 99 | + ":interface_library_builder_path", |
| 100 | + ":interface_library_input_path", |
| 101 | + ":interface_library_output_path", |
| 102 | + ], |
| 103 | +) |
| 104 | + |
| 105 | +cc_nested_args( |
| 106 | + name = "generate_interface_library", |
| 107 | + args = ["{generate_interface_library}"], |
| 108 | + format = {"generate_interface_library": "//cc/toolchains/variables:generate_interface_library"}, |
| 109 | +) |
| 110 | + |
| 111 | +cc_nested_args( |
| 112 | + name = "interface_library_builder_path", |
| 113 | + args = ["{interface_library_builder_path}"], |
| 114 | + format = {"interface_library_builder_path": "//cc/toolchains/variables:interface_library_builder_path"}, |
| 115 | + requires_not_none = "//cc/toolchains/variables:interface_library_builder_path", |
| 116 | +) |
| 117 | + |
| 118 | +cc_nested_args( |
| 119 | + name = "interface_library_input_path", |
| 120 | + args = ["{interface_library_input_path}"], |
| 121 | + format = {"interface_library_input_path": "//cc/toolchains/variables:interface_library_input_path"}, |
| 122 | + requires_not_none = "//cc/toolchains/variables:interface_library_input_path", |
| 123 | +) |
| 124 | + |
| 125 | +cc_nested_args( |
| 126 | + name = "interface_library_output_path", |
| 127 | + args = ["{interface_library_output_path}"], |
| 128 | + format = {"interface_library_output_path": "//cc/toolchains/variables:interface_library_output_path"}, |
| 129 | + requires_not_none = "//cc/toolchains/variables:interface_library_output_path", |
| 130 | +) |
| 131 | + |
| 132 | +cc_feature( |
| 133 | + name = "dynamic_library_linker_tool_feature", |
| 134 | + args = select({ |
| 135 | + "@platforms//os:windows": [], |
| 136 | + "//conditions:default": ["dynamic_library_linker_tool"], |
| 137 | + }), |
| 138 | + overrides = "//cc/toolchains/features/legacy:dynamic_library_linker_tool", |
| 139 | +) |
| 140 | + |
| 141 | +cc_args( |
| 142 | + name = "dynamic_library_linker_tool", |
| 143 | + actions = ["//cc/toolchains/actions:dynamic_library_link_actions"], |
| 144 | + nested = [":dynamic_library_linker_tool_check"], |
| 145 | + requires_not_none = "//cc/toolchains/variables:generate_interface_library", |
| 146 | +) |
| 147 | + |
| 148 | +cc_nested_args( |
| 149 | + name = "dynamic_library_linker_tool_check", |
| 150 | + args = [" + cppLinkDynamicLibraryToolPath + "], |
| 151 | + requires_equal = "//cc/toolchains/variables:generate_interface_library", |
| 152 | + requires_equal_value = "yes", |
| 153 | +) |
0 commit comments