diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-01-12 19:23:39 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-01-20 16:02:11 +0100 |
commit | e75f101e8b988adb458e594ffaaaebc0c01f65df (patch) | |
tree | 1f55772fe9040ab9f03d5b6c9d29b8eacd19c5b6 /CC/prebuilt/RULES | |
parent | 4a8579a2a4ef252644df0c29893e70ad8438ae82 (diff) | |
download | rules-cc-e75f101e8b988adb458e594ffaaaebc0c01f65df.tar.gz |
Support generating flag-files for prebuilt libraries
Diffstat (limited to 'CC/prebuilt/RULES')
-rw-r--r-- | CC/prebuilt/RULES | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/CC/prebuilt/RULES b/CC/prebuilt/RULES index be2bacc..16f9f26 100644 --- a/CC/prebuilt/RULES +++ b/CC/prebuilt/RULES @@ -1,8 +1,13 @@ { "library": { "doc": ["A prebuilt C++ library"] - , "target_fields": ["lib", "hdrs", "deps"] + , "target_fields": ["lib", "hdrs", "deps", "pkg-config"] , "string_fields": ["name", "version", "stage", "defines", "cflags", "ldflags"] + , "implicit": + { "defaults": [["./", "..", "defaults"]] + , "config_reader": [["CC", "prebuilt/read_pkgconfig.py"]] + } + , "config_vars": ["ENV"] , "field_doc": { "name": [ "The name of the library (without leading \"lib\" or trailing file name" @@ -32,6 +37,13 @@ ["List of compile flags set for this target and its consumers."] , "ldflags": ["Additional linker flags (typically for linking system libraries)."] + , "pkg-config": + [ "Pkg-config file for optional infer of public cflags and ldflags. If" + , "multiple files are specified (e.g., one depends on the other), the" + , "first one is used as entry. Note that if this field is non-empty the" + , "tool \"pkg-config\" must be available in \"PATH\", which is taken" + , "from [\"CC\", \"defaults\"] or the \"ENV\" variable." + ] } , "artifacts_doc": [ "The actual library (libname.a or libname.so). Only static libraries are" @@ -67,7 +79,9 @@ ] } , "imports": - { "artifacts_list": ["./", "../..", "field_artifacts_list"] + { "artifacts": ["./", "../..", "field_artifacts"] + , "artifacts_list": ["./", "../..", "field_artifacts_list"] + , "stage_field": ["", "stage_singleton_field"] , "prebuilt result": "prebuilt result" } , "expression": @@ -112,6 +126,19 @@ , "body": {"type": "CALL_EXPRESSION", "name": "artifacts_list"} } ] + , [ "config_reader" + , { "type": "let*" + , "bindings": + [["fieldname", "config_reader"], ["location", "config_reader"]] + , "body": {"type": "CALL_EXPRESSION", "name": "stage_field"} + } + ] + , [ "pkg-configs" + , { "type": "let*" + , "bindings": [["fieldname", "pkg-config"]] + , "body": {"type": "CALL_EXPRESSION", "name": "artifacts_list"} + } + ] , ["deps-fieldnames", ["deps"]] ] , "body": {"type": "CALL_EXPRESSION", "name": "prebuilt result"} |