use of org.gradle.language.nativeplatform.tasks.AbstractNativeSourceCompileTask in project gradle by gradle.
the class SourceCompileTaskConfig method configureCompileTask.
@Override
protected void configureCompileTask(AbstractNativeCompileTask abstractTask, final NativeBinarySpecInternal binary, final LanguageSourceSetInternal sourceSet) {
AbstractNativeSourceCompileTask task = (AbstractNativeSourceCompileTask) abstractTask;
task.setDescription("Compiles the " + sourceSet + " of " + binary);
task.source(sourceSet.getSource());
final Project project = task.getProject();
task.getObjectFileDir().set(new File(binary.getNamingScheme().getOutputDirectory(project.getBuildDir(), "objs"), sourceSet.getProjectScopedName()));
// If this task uses a pre-compiled header
if (sourceSet instanceof DependentSourceSetInternal && ((DependentSourceSetInternal) sourceSet).getPreCompiledHeader() != null) {
final DependentSourceSetInternal dependentSourceSet = (DependentSourceSetInternal) sourceSet;
PreCompiledHeader pch = binary.getPrefixFileToPCH().get(dependentSourceSet.getPrefixHeaderFile());
pch.setPrefixHeaderFile(dependentSourceSet.getPrefixHeaderFile());
pch.setIncludeString(dependentSourceSet.getPreCompiledHeader());
task.setPreCompiledHeader(pch);
}
binary.binaryInputs(task.getOutputs().getFiles().getAsFileTree().matching(new PatternSet().include("**/*.obj", "**/*.o")));
}
Aggregations