MCPcopy Create free account
hub / github.com/Kitware/CMake / AddUnityFilesModeGroup

Method AddUnityFilesModeGroup

Source/cmLocalGenerator.cxx:3212–3249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3210}
3211
3212std::vector<cmLocalGenerator::UnitySource>
3213cmLocalGenerator::AddUnityFilesModeGroup(
3214 cmGeneratorTarget* target, std::string const& lang,
3215 std::vector<std::string> const& configs,
3216 std::vector<UnityBatchedSource> const& filtered_sources,
3217 cmValue beforeInclude, cmValue afterInclude,
3218 std::string const& filename_base, UnityPathMode pathMode)
3219{
3220 std::vector<UnitySource> unity_files;
3221
3222 // sources organized by group name. Drop any source
3223 // without a group
3224 std::unordered_map<std::string, std::vector<UnityBatchedSource>>
3225 explicit_mapping;
3226 for (UnityBatchedSource const& ubs : filtered_sources) {
3227 if (cmValue value = ubs.Source->GetProperty("UNITY_GROUP")) {
3228 auto i = explicit_mapping.find(*value);
3229 if (i == explicit_mapping.end()) {
3230 std::vector<UnityBatchedSource> sources{ ubs };
3231 explicit_mapping.emplace(*value, std::move(sources));
3232 } else {
3233 i->second.emplace_back(ubs);
3234 }
3235 }
3236 }
3237
3238 char const* filename_prefix = unity_file_prefix(target);
3239 for (auto const& item : explicit_mapping) {
3240 auto const& name = item.first;
3241 std::string filename = cmStrCat(filename_base, filename_prefix, name,
3242 unity_file_extension(lang));
3243 unity_files.emplace_back(this->WriteUnitySource(
3244 target, configs, cmMakeRange(item.second), beforeInclude, afterInclude,
3245 std::move(filename), filename_base, pathMode));
3246 }
3247
3248 return unity_files;
3249}
3250
3251void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
3252{

Callers

nothing calls this directly

Calls 11

WriteUnitySourceMethod · 0.95
moveFunction · 0.85
unity_file_prefixFunction · 0.85
unity_file_extensionFunction · 0.85
cmMakeRangeFunction · 0.85
emplaceMethod · 0.80
emplace_backMethod · 0.80
cmStrCatFunction · 0.70
GetPropertyMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected