#include "builder.h"
#include "csourcefile.h"
#include "executable.h"
+#include "internaltask.h"
#include "sourcepackage.h"
#include "vcxprojectfile.h"
#include "vcxprojectgenerator.h"
using namespace std;
using namespace Msp;
-Target *VcxProjectGenerator::create_target(const vector<Target *> &, const string &)
+VcxProjectGenerator::VcxProjectGenerator(Builder &b):
+ Tool(b, "VCXG")
{
- throw logic_error("Not implemented");
+ set_run_internal(_run);
}
-Task *VcxProjectGenerator::run(const Target &target) const
+Target *VcxProjectGenerator::create_target(const vector<Target *> &, const string &)
{
- const VcxProjectFile &project = dynamic_cast<const VcxProjectFile &>(target);
- Worker *worker = new Worker(project);
- return new InternalTask(worker);
+ throw logic_error("Not implemented");
}
-
-void VcxProjectGenerator::Worker::main()
+bool VcxProjectGenerator::_run(const VcxProjectFile &project)
{
- const SourcePackage &spkg = *target.get_package();
+ const SourcePackage &spkg = *project.get_package();
Builder &builder = spkg.get_builder();
- IO::BufferedFile out(target.get_path().str(), IO::M_WRITE);
+ IO::BufferedFile out(project.get_path().str(), IO::M_WRITE);
IO::print(out, "<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n");
IO::print(out, "\t<ItemGroup Label=\"ProjectConfigurations\">\n");
IO::print(out, "\t<PropertyGroup Label=\"Globals\">\n");
IO::print(out, "\t\t<VCProjectVersion>15.0</VCProjectVersion>\n");
IO::print(out, "\t\t<Keyword>MakeFileProj</Keyword>\n");
- IO::print(out, "\t\t<ProjectGuid>{%s}</ProjectGuid>\n", target.get_guid());
+ IO::print(out, "\t\t<ProjectGuid>{%s}</ProjectGuid>\n", project.get_guid());
IO::print(out, "\t</PropertyGroup>\n");
IO::print(out, "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n");
IO::print(out, "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n");
IO::print(out, "</Project>\n");
- status = Task::SUCCESS;
+ return true;
}