]> git.tdb.fi Git - builder.git/blob - plugins/base/baseplugin.cpp
b43c851fbdf63cb6bab239a8fa9f633b90cffa5e
[builder.git] / plugins / base / baseplugin.cpp
1 #include <msp/builder/builder.h>
2 #include <msp/builder/tool.h>
3 #include "baseplugin.h"
4 #include "basetools.h"
5 #include "compilecommandsjson.h"
6 #include "pkgconfigfile.h"
7 #include "vcxprojectfile.h"
8 #include "vssolutionfile.h"
9
10 void BasePlugin::add_tools(Toolchain &toolchain, const Architecture &) const
11 {
12         toolchain.add_toolchain(new BaseTools(builder));
13 }
14
15 void BasePlugin::create_targets(SourcePackage &spkg) const
16 {
17         const Architecture &native_arch = builder.get_native_arch();
18
19         if(!spkg.get_exported_build_info().libs.empty() && native_arch.get_system()=="linux")
20         {
21                 PkgConfigFile *pc = new PkgConfigFile(builder, spkg);
22                 builder.get_build_graph().get_target("install")->add_dependency(*builder.get_toolchain().get_tool("CP").create_target(*pc));
23         }
24
25         if(native_arch.get_system()=="windows")
26         {
27                 new VcxProjectFile(builder, spkg);
28                 new VsSolutionFile(builder, spkg);
29         }
30
31         new CompileCommandsJson(builder, spkg);
32 }
33
34
35 extern "C"
36 Plugin *create_plugin(Builder &builder)
37 {
38         return new BasePlugin(builder);
39 }