Search in sources :

Example 1 with CppSharedLibraryVisualStudioTargetBinary

use of org.gradle.ide.visualstudio.internal.CppSharedLibraryVisualStudioTargetBinary in project gradle by gradle.

the class VisualStudioPlugin method applyVisualStudioCurrentModelRules.

private void applyVisualStudioCurrentModelRules(final VisualStudioExtensionInternal extension) {
    project.getComponents().withType(CppApplication.class).all(cppApplication -> {
        DefaultVisualStudioProject vsProject = extension.getProjectRegistry().createProject(project.getName(), cppApplication.getName());
        vsProject.getSourceFiles().from(cppApplication.getCppSource());
        vsProject.getHeaderFiles().from(cppApplication.getHeaderFiles());
        cppApplication.getBinaries().whenElementFinalized(CppExecutable.class, executable -> {
            extension.getProjectRegistry().addProjectConfiguration(new CppApplicationVisualStudioTargetBinary(project.getName(), project.getPath(), cppApplication, executable, project.getLayout()));
        });
    });
    project.afterEvaluate(proj -> {
        project.getComponents().withType(CppLibrary.class).all(cppLibrary -> {
            for (Linkage linkage : cppLibrary.getLinkage().get()) {
                VisualStudioTargetBinary.ProjectType projectType = VisualStudioTargetBinary.ProjectType.DLL;
                if (Linkage.STATIC.equals(linkage)) {
                    projectType = VisualStudioTargetBinary.ProjectType.LIB;
                }
                DefaultVisualStudioProject vsProject = extension.getProjectRegistry().createProject(project.getName() + projectType.getSuffix(), cppLibrary.getName());
                vsProject.getSourceFiles().from(cppLibrary.getCppSource());
                vsProject.getHeaderFiles().from(cppLibrary.getHeaderFiles());
            }
            cppLibrary.getBinaries().whenElementFinalized(CppSharedLibrary.class, library -> {
                extension.getProjectRegistry().addProjectConfiguration(new CppSharedLibraryVisualStudioTargetBinary(project.getName(), project.getPath(), cppLibrary, library, project.getLayout()));
            });
            cppLibrary.getBinaries().whenElementFinalized(CppStaticLibrary.class, library -> {
                extension.getProjectRegistry().addProjectConfiguration(new CppStaticLibraryVisualStudioTargetBinary(project.getName(), project.getPath(), cppLibrary, library, project.getLayout()));
            });
        });
    });
}
Also used : CppApplicationVisualStudioTargetBinary(org.gradle.ide.visualstudio.internal.CppApplicationVisualStudioTargetBinary) Linkage(org.gradle.nativeplatform.Linkage) VisualStudioTargetBinary(org.gradle.ide.visualstudio.internal.VisualStudioTargetBinary) CppApplicationVisualStudioTargetBinary(org.gradle.ide.visualstudio.internal.CppApplicationVisualStudioTargetBinary) CppStaticLibraryVisualStudioTargetBinary(org.gradle.ide.visualstudio.internal.CppStaticLibraryVisualStudioTargetBinary) CppSharedLibraryVisualStudioTargetBinary(org.gradle.ide.visualstudio.internal.CppSharedLibraryVisualStudioTargetBinary) CppLibrary(org.gradle.language.cpp.CppLibrary) CppStaticLibraryVisualStudioTargetBinary(org.gradle.ide.visualstudio.internal.CppStaticLibraryVisualStudioTargetBinary) DefaultVisualStudioProject(org.gradle.ide.visualstudio.internal.DefaultVisualStudioProject) CppApplication(org.gradle.language.cpp.CppApplication) CppSharedLibraryVisualStudioTargetBinary(org.gradle.ide.visualstudio.internal.CppSharedLibraryVisualStudioTargetBinary)

Aggregations

CppApplicationVisualStudioTargetBinary (org.gradle.ide.visualstudio.internal.CppApplicationVisualStudioTargetBinary)1 CppSharedLibraryVisualStudioTargetBinary (org.gradle.ide.visualstudio.internal.CppSharedLibraryVisualStudioTargetBinary)1 CppStaticLibraryVisualStudioTargetBinary (org.gradle.ide.visualstudio.internal.CppStaticLibraryVisualStudioTargetBinary)1 DefaultVisualStudioProject (org.gradle.ide.visualstudio.internal.DefaultVisualStudioProject)1 VisualStudioTargetBinary (org.gradle.ide.visualstudio.internal.VisualStudioTargetBinary)1 CppApplication (org.gradle.language.cpp.CppApplication)1 CppLibrary (org.gradle.language.cpp.CppLibrary)1 Linkage (org.gradle.nativeplatform.Linkage)1