]> git.tdb.fi Git - builder.git/blobdiff - plugins/msvc/vssolutionfile.cpp
Move the VS project and solution generators to the MSVC plugin
[builder.git] / plugins / msvc / vssolutionfile.cpp
diff --git a/plugins/msvc/vssolutionfile.cpp b/plugins/msvc/vssolutionfile.cpp
new file mode 100644 (file)
index 0000000..38908df
--- /dev/null
@@ -0,0 +1,31 @@
+#include <msp/builder/builder.h>
+#include <msp/builder/sourcepackage.h>
+#include <msp/core/algorithm.h>
+#include "vssolutionfile.h"
+
+using namespace std;
+using namespace Msp;
+
+VsSolutionFile::VsSolutionFile(Builder &b, const SourcePackage &p):
+       FileTarget(b, p, p.get_source_directory()/(p.get_name()+".sln"))
+{
+       tool = &builder.get_toolchain().get_tool("VSSG");
+}
+
+void VsSolutionFile::find_dependencies()
+{
+       find_dependencies(*package);
+}
+
+void VsSolutionFile::find_dependencies(const SourcePackage &spkg)
+{
+       if(FileTarget *project = builder.get_vfs().get_target(spkg.get_source_directory()/(spkg.get_name()+".vcxproj")))
+               if(!any_equals(depends, static_cast<Target *>(project)))
+               {
+                       add_dependency(*project);
+
+                       for(const Package *r: spkg.get_required_packages())
+                               if(const SourcePackage *s = dynamic_cast<const SourcePackage *>(r))
+                                       find_dependencies(*s);
+               }
+}