subdir_glob()
This is liable to change in the future.
The subdir_glob()
function is useful for defining header maps for C/C++ libraries which should be relative the given sub-directory. Given a list of tuples, the form of (relative-sub-directory, glob-pattern), return a dict of sub-directory relative paths to full paths.
Please refer to
for explanations and examples of the pattern. glob()
Arguments
glob_specs
The array of tuples in form of (relative-sub-directory, glob-pattern inside relative-sub-directory).excludes
(defaults to[]
) A list of patterns to identify files that should be removed from the set specified by the first argument.prefix
(defaults toNone
) If is notNone
, prepends it to each key in the dictionary.
Examples
Given thisexported_headers
description:exported_headers = subdir_glob([ ("lib/source", "video/**/*.h"), ("lib/source", "audio/**/*.h"), ], excludes = [ "lib/source/video/codecs/*.h", ], prefix = "MediaLib/")It will map the following on disk directory structure below to the following includes:
lib/ source/ video/ converter/ converter.h -> #include "MediaLib/video/converter/converter.h" player/ player.h -> #include "MediaLib/video/player/player.h" codecs/ codec1.h -> not includable - defined in `excludes` codec2.h -> not includable - defined in `excludes` audio/ codecs/ codec1.h -> #include "MediaLib/audio/codecs/codec1.h" codec2.h -> #include "MediaLib/audio/codecs/codec2.h" player/ player.h -> #include "MediaLib/audio/player/player.h" internal/ otherheader.h -> not includable