1 #include <msp/io/file.h>
2 #include <msp/io/print.h>
3 #include "sourcepackage.h"
4 #include "vcxprojectfile.h"
5 #include "vssolutionfile.h"
6 #include "vssolutiongenerator.h"
11 VsSolutionGenerator::VsSolutionGenerator(Builder &b):
15 Target *VsSolutionGenerator::create_target(const list<Target *> &, const string &)
17 throw logic_error("Not implemented");
20 Task *VsSolutionGenerator::run(const Target &target) const
22 const VsSolutionFile &solution = dynamic_cast<const VsSolutionFile &>(target);
23 Worker *worker = new Worker(solution);
24 return new InternalTask(worker);
28 VsSolutionGenerator::Worker::Worker(const VsSolutionFile &t):
32 void VsSolutionGenerator::Worker::main()
34 IO::BufferedFile out(target.get_path().str(), IO::M_WRITE);
35 IO::print(out, "Microsoft Visual Studio Solution File, Format Version 12.00\n");
36 IO::print(out, "MinimumVisualStudioVersion = 10.0.40219.1\n");
38 const Target::Dependencies &deps = target.get_dependencies();
39 for(Target::Dependencies::const_iterator i=deps.begin(); i!=deps.end(); ++i)
40 if(const VcxProjectFile *project = dynamic_cast<const VcxProjectFile *>(*i))
42 const SourcePackage *pkg = project->get_package();
43 IO::print(out, "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"%s\", \"%s\", \"{%s}\"\nEndProject\n",
44 pkg->get_name(), project->get_path(), project->get_guid());
47 status = Task::SUCCESS;