+#include <msp/crypto/md5.h>
+#include <msp/strings/format.h>
#include "builder.h"
#include "sourcepackage.h"
#include "vcxprojectfile.h"
+using namespace Msp;
+
VcxProjectFile::VcxProjectFile(Builder &b, const SourcePackage &p):
FileTarget(b, p, p.get_source_directory()/(p.get_name()+".vcxproj"))
{
tool = &builder.get_toolchain().get_tool("VCXG");
+
+ char digest[16];
+ Crypto::MD5(package->get_name()).get_digest(digest, sizeof(digest));
+ digest[6] = 3;
+ digest[8] = (digest[6]&0x3F)|0x80;
+ for(unsigned j=0; j<sizeof(digest); ++j)
+ {
+ if(j==4 || j==6 || j==8 || j==10)
+ guid += '-';
+ guid += format("%02x", static_cast<unsigned char>(digest[j]));
+ }
}
class VcxProjectFile: public FileTarget
{
+private:
+ std::string guid;
+
public:
VcxProjectFile(Builder &, const SourcePackage &);
virtual const char *get_type() const { return "VcxProjectFile"; }
+
+ const std::string &get_guid() const { return guid; }
};
#endif
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</PropertyGroup>\n");
IO::print(out, "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n");