|
@@ -13,12 +13,14 @@
|
|
|
#include "cmGlobalVisualStudioGenerator.h"
|
|
|
|
|
|
#include "cmCallVisualStudioMacro.h"
|
|
|
+#include "cmGeneratedFileStream.h"
|
|
|
#include "cmGeneratorTarget.h"
|
|
|
#include "cmLocalVisualStudioGenerator.h"
|
|
|
#include "cmMakefile.h"
|
|
|
#include "cmSourceFile.h"
|
|
|
#include "cmTarget.h"
|
|
|
#include <cmsys/Encoding.hxx>
|
|
|
+#include "cmAlgorithms.h"
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm)
|
|
@@ -887,3 +889,71 @@ std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir(
|
|
|
}
|
|
|
return tmp;
|
|
|
}
|
|
|
+
|
|
|
+void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
|
|
|
+ cmGeneratorTarget* gt, std::vector<cmCustomCommand>& commands,
|
|
|
+ std::string const& configName)
|
|
|
+{
|
|
|
+ std::vector<std::string> outputs;
|
|
|
+ std::string deffile = gt->ObjectDirectory;
|
|
|
+ deffile += "/exportall.def";
|
|
|
+ outputs.push_back(deffile);
|
|
|
+ std::vector<std::string> empty;
|
|
|
+ std::vector<cmSourceFile const*> objectSources;
|
|
|
+ gt->GetObjectSources(objectSources, configName);
|
|
|
+ std::map<cmSourceFile const*, std::string> mapping;
|
|
|
+ for(std::vector<cmSourceFile const*>::const_iterator it
|
|
|
+ = objectSources.begin(); it != objectSources.end(); ++it)
|
|
|
+ {
|
|
|
+ mapping[*it];
|
|
|
+ }
|
|
|
+ gt->LocalGenerator->
|
|
|
+ ComputeObjectFilenames(mapping, gt);
|
|
|
+ std::string obj_dir = gt->ObjectDirectory;
|
|
|
+ std::string cmakeCommand = cmSystemTools::GetCMakeCommand();
|
|
|
+ cmSystemTools::ConvertToWindowsExtendedPath(cmakeCommand);
|
|
|
+ cmCustomCommandLine cmdl;
|
|
|
+ cmdl.push_back(cmakeCommand);
|
|
|
+ cmdl.push_back("-E");
|
|
|
+ cmdl.push_back("__create_def");
|
|
|
+ cmdl.push_back(deffile);
|
|
|
+ std::string obj_dir_expanded = obj_dir;
|
|
|
+ cmSystemTools::ReplaceString(obj_dir_expanded,
|
|
|
+ this->GetCMakeCFGIntDir(),
|
|
|
+ configName.c_str());
|
|
|
+ std::string objs_file = obj_dir_expanded;
|
|
|
+ cmSystemTools::MakeDirectory(objs_file.c_str());
|
|
|
+ objs_file += "/objects.txt";
|
|
|
+ cmdl.push_back(objs_file);
|
|
|
+ cmGeneratedFileStream fout(objs_file.c_str());
|
|
|
+ if(!fout)
|
|
|
+ {
|
|
|
+ cmSystemTools::Error("could not open ", objs_file.c_str());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for(std::vector<cmSourceFile const*>::const_iterator it
|
|
|
+ = objectSources.begin(); it != objectSources.end(); ++it)
|
|
|
+ {
|
|
|
+ // Find the object file name corresponding to this source file.
|
|
|
+ std::map<cmSourceFile const*, std::string>::const_iterator
|
|
|
+ map_it = mapping.find(*it);
|
|
|
+ // It must exist because we populated the mapping just above.
|
|
|
+ assert(!map_it->second.empty());
|
|
|
+ std::string objFile = obj_dir + map_it->second;
|
|
|
+ // replace $(ConfigurationName) in the object names
|
|
|
+ cmSystemTools::ReplaceString(objFile, this->GetCMakeCFGIntDir(),
|
|
|
+ configName.c_str());
|
|
|
+ if(cmHasLiteralSuffix(objFile, ".obj"))
|
|
|
+ {
|
|
|
+ fout << objFile << "\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cmCustomCommandLines commandLines;
|
|
|
+ commandLines.push_back(cmdl);
|
|
|
+ cmCustomCommand command(gt->Target->GetMakefile(),
|
|
|
+ outputs, empty, empty,
|
|
|
+ commandLines,
|
|
|
+ "Auto build dll exports",
|
|
|
+ ".");
|
|
|
+ commands.push_back(command);
|
|
|
+}
|