Search in sources :

Example 1 with AbstractNativeSourceCompileTask

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")));
}
Also used : Project(org.gradle.api.Project) PreCompiledHeader(org.gradle.nativeplatform.toolchain.internal.PreCompiledHeader) AbstractNativeSourceCompileTask(org.gradle.language.nativeplatform.tasks.AbstractNativeSourceCompileTask) File(java.io.File) PatternSet(org.gradle.api.tasks.util.PatternSet)

Aggregations

File (java.io.File)1 Project (org.gradle.api.Project)1 PatternSet (org.gradle.api.tasks.util.PatternSet)1 AbstractNativeSourceCompileTask (org.gradle.language.nativeplatform.tasks.AbstractNativeSourceCompileTask)1 PreCompiledHeader (org.gradle.nativeplatform.toolchain.internal.PreCompiledHeader)1