pub fn fromTarget(target: *const Target) Query target: *const Target107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136pub fn fromTarget(target: *const Target) Query {
var result: Query = .{
.cpu_arch = target.cpu.arch,
.cpu_model = .{ .explicit = target.cpu.model },
.os_tag = target.os.tag,
.os_version_min = undefined,
.os_version_max = undefined,
.abi = target.abi,
.glibc_version = if (target.abi.isGnu()) target.os.versionRange().gnuLibCVersion() else null,
.android_api_level = if (target.abi.isAndroid()) target.os.version_range.linux.android else null,
};
result.updateOsVersionRange(target.os);
const all_features = target.cpu.arch.allFeaturesList();
var cpu_model_set = target.cpu.model.features;
cpu_model_set.populateDependencies(all_features);
{
// The "add" set is the full set with the CPU Model set removed.
const add_set = &result.cpu_features_add;
add_set.* = target.cpu.features;
add_set.removeFeatureSet(cpu_model_set);
}
{
// The "sub" set is the features that are on in CPU Model set and off in the full set.
const sub_set = &result.cpu_features_sub;
sub_set.* = cpu_model_set;
sub_set.removeFeatureSet(target.cpu.features);
}
return result;
}