From: Mikko Rasa Date: Sun, 18 Dec 2022 15:58:59 +0000 (+0200) Subject: Generate GUIDs for Visual C++ project files X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a557d2ba9aae4a05e4b15c81ba5262da7caac2a5;p=builder.git Generate GUIDs for Visual C++ project files --- diff --git a/Build b/Build index 2363ad7..34f5e40 100644 --- a/Build +++ b/Build @@ -5,6 +5,7 @@ package "builder" require "mspcore"; require "mspdatafile"; + require "mspcrypto"; require "sigc++-2.0"; program "builder" diff --git a/source/vcxprojectfile.cpp b/source/vcxprojectfile.cpp index 7b09db0..c591524 100644 --- a/source/vcxprojectfile.cpp +++ b/source/vcxprojectfile.cpp @@ -1,9 +1,24 @@ +#include +#include #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(digest[j])); + } } diff --git a/source/vcxprojectfile.h b/source/vcxprojectfile.h index b5a90d1..ff3aba1 100644 --- a/source/vcxprojectfile.h +++ b/source/vcxprojectfile.h @@ -5,10 +5,15 @@ 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 diff --git a/source/vcxprojectgenerator.cpp b/source/vcxprojectgenerator.cpp index 871cde9..a173829 100644 --- a/source/vcxprojectgenerator.cpp +++ b/source/vcxprojectgenerator.cpp @@ -57,6 +57,7 @@ void VcxProjectGenerator::Worker::main() IO::print(out, "\t\n"); IO::print(out, "\t\t15.0\n"); IO::print(out, "\t\tMakeFileProj\n"); + IO::print(out, "\t\t{%s}\n", target.get_guid()); IO::print(out, "\t\n"); IO::print(out, "\t\n");