CREATE_PROJECT: Add support for creating Visual Studio projects for the dev tools
- Move project name and description to BuildSetup structure - Add list of tools to generate project for (similar to the list of features)
This commit is contained in:
parent
eda43c2d86
commit
7cfed737d7
10 changed files with 254 additions and 142 deletions
|
@ -32,20 +32,20 @@ CodeBlocksProvider::CodeBlocksProvider(StringList &global_warnings, std::map<std
|
|||
}
|
||||
|
||||
void CodeBlocksProvider::createWorkspace(const BuildSetup &setup) {
|
||||
std::ofstream workspace((setup.outputDir + '/' + PROJECT_NAME + ".workspace").c_str());
|
||||
std::ofstream workspace((setup.outputDir + '/' + setup.projectName + ".workspace").c_str());
|
||||
if (!workspace)
|
||||
error("Could not open \"" + setup.outputDir + '/' + PROJECT_NAME + ".workspace\" for writing");
|
||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectName + ".workspace\" for writing");
|
||||
|
||||
workspace << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n"
|
||||
"<CodeBlocks_workspace_file>\n";
|
||||
|
||||
workspace << "\t<Workspace title=\"" << PROJECT_DESCRIPTION << "\">\n";
|
||||
workspace << "\t<Workspace title=\"" << setup.projectDescription << "\">\n";
|
||||
|
||||
writeReferences(workspace);
|
||||
writeReferences(setup, workspace);
|
||||
|
||||
// Note we assume that the UUID map only includes UUIDs for enabled engines!
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
if (i->first == PROJECT_NAME)
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
workspace << "\t\t<Project filename=\"" << i->first << ".cbp\" />\n";
|
||||
|
@ -88,15 +88,15 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
|
|||
"\t\t<Option compiler=\"gcc\" />\n"
|
||||
"\t\t<Build>\n";
|
||||
|
||||
if (name == PROJECT_NAME) {
|
||||
if (name == setup.projectName) {
|
||||
std::string libraries;
|
||||
|
||||
for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
|
||||
libraries += processLibraryName(*i) + ".a;";
|
||||
|
||||
project << "\t\t\t<Target title=\"default\">\n"
|
||||
"\t\t\t\t<Option output=\"" << PROJECT_NAME << "\\" << PROJECT_NAME << "\" prefix_auto=\"1\" extension_auto=\"1\" />\n"
|
||||
"\t\t\t\t<Option object_output=\"" << PROJECT_NAME << "\" />\n"
|
||||
"\t\t\t\t<Option output=\"" << setup.projectName << "\\" << setup.projectName << "\" prefix_auto=\"1\" extension_auto=\"1\" />\n"
|
||||
"\t\t\t\t<Option object_output=\"" << setup.projectName << "\" />\n"
|
||||
"\t\t\t\t<Option external_deps=\"" << libraries /* + list of engines engines\name\name.a */ << "\" />\n"
|
||||
"\t\t\t\t<Option type=\"1\" />\n"
|
||||
"\t\t\t\t<Option compiler=\"gcc\" />\n"
|
||||
|
@ -125,10 +125,10 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
|
|||
project << "\t\t\t\t\t<Add library=\"" << processLibraryName(*i) << "\" />\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
if (i->first == PROJECT_NAME)
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
project << "\t\t\t\t\t<Add library=\"" << PROJECT_NAME << "\\engines\\" << i->first << "\\lib" << i->first << ".a\" />\n";
|
||||
project << "\t\t\t\t\t<Add library=\"" << setup.projectName << "\\engines\\" << i->first << "\\lib" << i->first << ".a\" />\n";
|
||||
}
|
||||
|
||||
project << "\t\t\t\t\t<Add directory=\"$(" << LIBS_DEFINE << ")lib\\mingw\" />\n"
|
||||
|
@ -139,7 +139,7 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
|
|||
// Resource compiler
|
||||
project << "\t\t\t\t<ResourceCompiler>\n"
|
||||
"\t\t\t\t\t<Add directory=\"..\\..\\dists\" />\n"
|
||||
"\t\t\t\t\t<Add directory=\"..\\..\\..\\" << PROJECT_NAME << "\" />\n"
|
||||
"\t\t\t\t\t<Add directory=\"..\\..\\..\\" << setup.projectName << "\" />\n"
|
||||
"\t\t\t\t</ResourceCompiler>\n"
|
||||
"\t\t\t</Target>\n"
|
||||
"\t\t</Build>\n";
|
||||
|
@ -148,9 +148,9 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
|
|||
|
||||
} else {
|
||||
project << "\t\t\t<Target title=\"default\">\n"
|
||||
"\t\t\t\t<Option output=\"" << PROJECT_NAME << "\\engines\\" << name << "\\lib" << name << "\" prefix_auto=\"1\" extension_auto=\"1\" />\n"
|
||||
"\t\t\t\t<Option output=\"" << setup.projectName << "\\engines\\" << name << "\\lib" << name << "\" prefix_auto=\"1\" extension_auto=\"1\" />\n"
|
||||
"\t\t\t\t<Option working_dir=\"\" />\n"
|
||||
"\t\t\t\t<Option object_output=\"" << PROJECT_NAME << "\" />\n"
|
||||
"\t\t\t\t<Option object_output=\"" << setup.projectName << "\" />\n"
|
||||
"\t\t\t\t<Option type=\"2\" />\n"
|
||||
"\t\t\t\t<Option compiler=\"gcc\" />\n"
|
||||
"\t\t\t\t<Option createDefFile=\"1\" />\n"
|
||||
|
@ -161,7 +161,7 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
|
|||
|
||||
project << "\t\t\t\t\t<Add option=\"-g\" />\n"
|
||||
"\t\t\t\t\t<Add directory=\"..\\..\\engines\" />\n"
|
||||
"\t\t\t\t\t<Add directory=\"..\\..\\..\\" << PROJECT_NAME << "\" />\n";
|
||||
"\t\t\t\t\t<Add directory=\"..\\..\\..\\" << setup.projectName << "\" />\n";
|
||||
|
||||
// Sword2.5 engine needs theora and vorbis includes
|
||||
if (name == "sword25")
|
||||
|
@ -240,8 +240,8 @@ void CodeBlocksProvider::writeFileListToProject(const FileNode &dir, std::ofstre
|
|||
}
|
||||
}
|
||||
|
||||
void CodeBlocksProvider::writeReferences(std::ofstream &output) {
|
||||
output << "\t\t<Project filename=\"" << PROJECT_NAME << ".cbp\" active=\"1\">\n";
|
||||
void CodeBlocksProvider::writeReferences(const BuildSetup &setup, std::ofstream &output) {
|
||||
output << "\t\t<Project filename=\"" << setup.projectName << ".cbp\" active=\"1\">\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
if (i->first == " << PROJECT_NAME << ")
|
||||
|
|
|
@ -43,7 +43,7 @@ protected:
|
|||
void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
|
||||
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);
|
||||
|
||||
void writeReferences(std::ofstream &output);
|
||||
void writeReferences(const BuildSetup &setup, std::ofstream &output);
|
||||
|
||||
const char *getProjectExtension();
|
||||
|
||||
|
|
|
@ -259,6 +259,8 @@ int main(int argc, char *argv[]) {
|
|||
} else if (!std::strcmp(argv[i], "--installer")) {
|
||||
setup.runBuildEvents = true;
|
||||
setup.createInstaller = true;
|
||||
} else if (!std::strcmp(argv[i], "--tools")) {
|
||||
setup.devTools = true;
|
||||
} else {
|
||||
std::cerr << "ERROR: Unknown parameter \"" << argv[i] << "\"\n";
|
||||
return -1;
|
||||
|
@ -327,6 +329,11 @@ int main(int argc, char *argv[]) {
|
|||
return -1;
|
||||
|
||||
case kProjectCodeBlocks:
|
||||
if (setup.devTools) {
|
||||
std::cerr << "ERROR: Building tools is not supported for the CodeBlocks project type!\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Code::Blocks is using GCC behind the scenes, so we need to pass a list
|
||||
// of options to enable or disable warnings
|
||||
|
@ -484,6 +491,11 @@ int main(int argc, char *argv[]) {
|
|||
break;
|
||||
|
||||
case kProjectXcode:
|
||||
if (setup.devTools) {
|
||||
std::cerr << "ERROR: Building tools is not supported for the XCode project type!\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Xcode is also using GCC behind the scenes. See Code::Blocks comment
|
||||
// for info on all warnings
|
||||
|
@ -510,6 +522,15 @@ int main(int argc, char *argv[]) {
|
|||
break;
|
||||
}
|
||||
|
||||
// Setup project name and description
|
||||
setup.projectName = PROJECT_NAME;
|
||||
setup.projectDescription = PROJECT_DESCRIPTION;
|
||||
|
||||
if (setup.devTools) {
|
||||
setup.projectName += "-tools";
|
||||
setup.projectDescription += "Tools";
|
||||
}
|
||||
|
||||
provider->createProject(setup);
|
||||
|
||||
delete provider;
|
||||
|
@ -790,6 +811,18 @@ const Feature s_features[] = {
|
|||
{ "langdetect", "USE_DETECTLANG", "", true, "System language detection support" } // This feature actually depends on "translation", there
|
||||
// is just no current way of properly detecting this...
|
||||
};
|
||||
|
||||
const Tool s_tools[] = {
|
||||
{ "create_drascula", true},
|
||||
{ "create_hugo", true},
|
||||
{ "create_kyradat", true},
|
||||
{ "create_lure", true},
|
||||
{ "create_mads", true},
|
||||
{ "create_teenagent", true},
|
||||
{ "create_toon", true},
|
||||
{ "create_translations", true},
|
||||
{ "qtable", true}
|
||||
};
|
||||
} // End of anonymous namespace
|
||||
|
||||
FeatureList getAllFeatures() {
|
||||
|
@ -836,6 +869,16 @@ bool setFeatureBuildState(const std::string &name, FeatureList &features, bool e
|
|||
}
|
||||
}
|
||||
|
||||
ToolList getAllTools() {
|
||||
const size_t toolCount = sizeof(s_tools) / sizeof(s_tools[0]);
|
||||
|
||||
ToolList tools;
|
||||
for (size_t i = 0; i < toolCount; ++i)
|
||||
tools.push_back(s_tools[i]);
|
||||
|
||||
return tools;
|
||||
}
|
||||
|
||||
namespace CreateProjectTool {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1061,63 +1104,90 @@ ProjectProvider::ProjectProvider(StringList &global_warnings, std::map<std::stri
|
|||
}
|
||||
|
||||
void ProjectProvider::createProject(const BuildSetup &setup) {
|
||||
_uuidMap = createUUIDMap(setup);
|
||||
if (setup.devTools) {
|
||||
_uuidMap = createToolsUUIDMap();
|
||||
|
||||
// We also need to add the UUID of the main project file.
|
||||
const std::string svmUUID = _uuidMap[PROJECT_NAME] = createUUID();
|
||||
// We also need to add the UUID of the main project file.
|
||||
const std::string svmUUID = _uuidMap[setup.projectName] = createUUID();
|
||||
|
||||
// Create Solution/Workspace file
|
||||
createWorkspace(setup);
|
||||
createWorkspace(setup);
|
||||
|
||||
StringList in, ex;
|
||||
StringList in, ex;
|
||||
|
||||
// Create engine project files
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
if (i->first == PROJECT_NAME)
|
||||
continue;
|
||||
// Create tools project files
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
in.clear(); ex.clear();
|
||||
const std::string moduleDir = setup.srcDir + "/devtools/" + i->first;
|
||||
|
||||
createModuleList(moduleDir, setup.defines, in, ex);
|
||||
createProjectFile(i->first, i->second, setup, moduleDir, in, ex);
|
||||
}
|
||||
|
||||
// Create other misc. build files
|
||||
createOtherBuildFiles(setup);
|
||||
|
||||
} else {
|
||||
_uuidMap = createUUIDMap(setup);
|
||||
|
||||
// We also need to add the UUID of the main project file.
|
||||
const std::string svmUUID = _uuidMap[setup.projectName] = createUUID();
|
||||
|
||||
// Create Solution/Workspace file
|
||||
createWorkspace(setup);
|
||||
|
||||
StringList in, ex;
|
||||
|
||||
// Create engine project files
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
in.clear(); ex.clear();
|
||||
const std::string moduleDir = setup.srcDir + "/engines/" + i->first;
|
||||
|
||||
createModuleList(moduleDir, setup.defines, in, ex);
|
||||
createProjectFile(i->first, i->second, setup, moduleDir, in, ex);
|
||||
}
|
||||
|
||||
// Last but not least create the main project file.
|
||||
in.clear(); ex.clear();
|
||||
const std::string moduleDir = setup.srcDir + "/engines/" + i->first;
|
||||
|
||||
createModuleList(moduleDir, setup.defines, in, ex);
|
||||
createProjectFile(i->first, i->second, setup, moduleDir, in, ex);
|
||||
}
|
||||
|
||||
// Last but not least create the main project file.
|
||||
in.clear(); ex.clear();
|
||||
|
||||
// File list for the Project file
|
||||
createModuleList(setup.srcDir + "/backends", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/base", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/common", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/engines", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/graphics", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/gui", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/audio", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/audio/softsynth/mt32", setup.defines, in, ex);
|
||||
// File list for the Project file
|
||||
createModuleList(setup.srcDir + "/backends", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/base", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/common", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/engines", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/graphics", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/gui", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/audio", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/audio/softsynth/mt32", setup.defines, in, ex);
|
||||
#if HAS_VIDEO_FOLDER
|
||||
createModuleList(setup.srcDir + "/video", setup.defines, in, ex);
|
||||
createModuleList(setup.srcDir + "/video", setup.defines, in, ex);
|
||||
#endif
|
||||
|
||||
// Resource files
|
||||
in.push_back(setup.srcDir + "/icons/" + PROJECT_NAME + ".ico");
|
||||
in.push_back(setup.srcDir + "/dists/" + PROJECT_NAME + ".rc");
|
||||
// Resource files
|
||||
in.push_back(setup.srcDir + "/icons/" + setup.projectName + ".ico");
|
||||
in.push_back(setup.srcDir + "/dists/" + setup.projectName + ".rc");
|
||||
|
||||
// Various text files
|
||||
in.push_back(setup.srcDir + "/AUTHORS");
|
||||
in.push_back(setup.srcDir + "/COPYING");
|
||||
in.push_back(setup.srcDir + "/COPYING.LGPL");
|
||||
in.push_back(setup.srcDir + "/COPYRIGHT");
|
||||
in.push_back(setup.srcDir + "/NEWS");
|
||||
in.push_back(setup.srcDir + "/README");
|
||||
in.push_back(setup.srcDir + "/TODO");
|
||||
// Various text files
|
||||
in.push_back(setup.srcDir + "/AUTHORS");
|
||||
in.push_back(setup.srcDir + "/COPYING");
|
||||
in.push_back(setup.srcDir + "/COPYING.LGPL");
|
||||
in.push_back(setup.srcDir + "/COPYRIGHT");
|
||||
in.push_back(setup.srcDir + "/NEWS");
|
||||
in.push_back(setup.srcDir + "/README");
|
||||
in.push_back(setup.srcDir + "/TODO");
|
||||
|
||||
// Create the main project file.
|
||||
createProjectFile(PROJECT_NAME, svmUUID, setup, setup.srcDir, in, ex);
|
||||
// Create the main project file.
|
||||
createProjectFile(setup.projectName, svmUUID, setup, setup.srcDir, in, ex);
|
||||
|
||||
// Create other misc. build files
|
||||
createOtherBuildFiles(setup);
|
||||
// Create other misc. build files
|
||||
createOtherBuildFiles(setup);
|
||||
}
|
||||
}
|
||||
|
||||
ProjectProvider::UUIDMap ProjectProvider::createUUIDMap(const BuildSetup &setup) const {
|
||||
|
@ -1133,6 +1203,20 @@ ProjectProvider::UUIDMap ProjectProvider::createUUIDMap(const BuildSetup &setup)
|
|||
return result;
|
||||
}
|
||||
|
||||
ProjectProvider::UUIDMap ProjectProvider::createToolsUUIDMap() const {
|
||||
UUIDMap result;
|
||||
|
||||
ToolList tools = getAllTools();
|
||||
for (ToolList::const_iterator i = tools.begin(); i != tools.end(); ++i) {
|
||||
if (!i->enable)
|
||||
continue;
|
||||
|
||||
result[i->name] = createUUID();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string ProjectProvider::createUUID() const {
|
||||
#ifdef USE_WIN32_API
|
||||
UUID uuid;
|
||||
|
|
|
@ -137,6 +137,12 @@ struct Feature {
|
|||
};
|
||||
typedef std::list<Feature> FeatureList;
|
||||
|
||||
struct Tool {
|
||||
const char *name; ///< Name of the tools
|
||||
bool enable; ///< Whether the tools is enabled or not
|
||||
};
|
||||
typedef std::list<Tool> ToolList;
|
||||
|
||||
/**
|
||||
* Creates a list of all features available for MSVC.
|
||||
*
|
||||
|
@ -179,6 +185,9 @@ bool setFeatureBuildState(const std::string &name, FeatureList &features, bool e
|
|||
* It also contains the path to the project source root.
|
||||
*/
|
||||
struct BuildSetup {
|
||||
std::string projectName; ///< Project name
|
||||
std::string projectDescription; ///< Project description
|
||||
|
||||
std::string srcDir; ///< Path to the sources.
|
||||
std::string filePrefix; ///< Prefix for the relative path arguments in the project files.
|
||||
std::string outputDir; ///< Path where to put the MSVC project files.
|
||||
|
@ -189,10 +198,12 @@ struct BuildSetup {
|
|||
StringList defines; ///< List of all defines for the build.
|
||||
StringList libraries; ///< List of all external libraries required for the build.
|
||||
|
||||
bool devTools; ///< Generate project files for the tools
|
||||
bool runBuildEvents; ///< Run build events as part of the build (generate revision number and copy engine/theme data & needed files to the build folder
|
||||
bool createInstaller; ///< Create NSIS installer after the build
|
||||
|
||||
BuildSetup() {
|
||||
devTools = false;
|
||||
runBuildEvents = false;
|
||||
createInstaller = false;
|
||||
}
|
||||
|
@ -360,7 +371,7 @@ protected:
|
|||
*
|
||||
* @param output File stream to write to.
|
||||
*/
|
||||
virtual void writeReferences(std::ofstream &) {};
|
||||
virtual void writeReferences(const BuildSetup &, std::ofstream &) {};
|
||||
|
||||
/**
|
||||
* Get the file extension for project files
|
||||
|
@ -401,6 +412,14 @@ protected:
|
|||
*/
|
||||
UUIDMap createUUIDMap(const BuildSetup &setup) const;
|
||||
|
||||
/**
|
||||
* Creates an UUID for every enabled tool of the
|
||||
* passed build description.
|
||||
*
|
||||
* @return A map, which includes UUIDs for all enabled engines.
|
||||
*/
|
||||
UUIDMap createToolsUUIDMap() const;
|
||||
|
||||
/**
|
||||
* Creates an UUID and returns it in string representation.
|
||||
*
|
||||
|
|
|
@ -58,9 +58,9 @@ inline void outputConfiguration(std::ostream &project, const std::string &config
|
|||
"\t\t</ProjectConfiguration>\n";
|
||||
}
|
||||
|
||||
inline void outputConfigurationType(std::ostream &project, const std::string &name, const std::string &config) {
|
||||
inline void outputConfigurationType(const BuildSetup &setup, std::ostream &project, const std::string &name, const std::string &config) {
|
||||
project << "\t<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='" << config << "'\" Label=\"Configuration\">\n"
|
||||
"\t\t<ConfigurationType>" << (name == PROJECT_NAME ? "Application" : "StaticLibrary") << "</ConfigurationType>\n"
|
||||
"\t\t<ConfigurationType>" << ((name == setup.projectName || setup.devTools) ? "Application" : "StaticLibrary") << "</ConfigurationType>\n"
|
||||
"\t</PropertyGroup>\n";
|
||||
}
|
||||
|
||||
|
@ -103,23 +103,23 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
|
|||
// Shared configuration
|
||||
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n";
|
||||
|
||||
outputConfigurationType(project, name, "Release|Win32");
|
||||
outputConfigurationType(project, name, "Analysis|Win32");
|
||||
outputConfigurationType(project, name, "Debug|Win32");
|
||||
outputConfigurationType(project, name, "Release|x64");
|
||||
outputConfigurationType(project, name, "Analysis|x64");
|
||||
outputConfigurationType(project, name, "Debug|x64");
|
||||
outputConfigurationType(setup, project, name, "Release|Win32");
|
||||
outputConfigurationType(setup, project, name, "Analysis|Win32");
|
||||
outputConfigurationType(setup, project, name, "Debug|Win32");
|
||||
outputConfigurationType(setup, project, name, "Release|x64");
|
||||
outputConfigurationType(setup, project, name, "Analysis|x64");
|
||||
outputConfigurationType(setup, project, name, "Debug|x64");
|
||||
|
||||
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n"
|
||||
"\t<ImportGroup Label=\"ExtensionSettings\">\n"
|
||||
"\t</ImportGroup>\n";
|
||||
|
||||
outputProperties(project, "Release|Win32", PROJECT_DESCRIPTION "_Release.props");
|
||||
outputProperties(project, "Analysis|Win32", PROJECT_DESCRIPTION "_Analysis.props");
|
||||
outputProperties(project, "Debug|Win32", PROJECT_DESCRIPTION "_Debug.props");
|
||||
outputProperties(project, "Release|x64", PROJECT_DESCRIPTION "_Release64.props");
|
||||
outputProperties(project, "Analysis|x64", PROJECT_DESCRIPTION "_Analysis64.props");
|
||||
outputProperties(project, "Debug|x64", PROJECT_DESCRIPTION "_Debug64.props");
|
||||
outputProperties(project, "Release|Win32", setup.projectDescription + "_Release.props");
|
||||
outputProperties(project, "Analysis|Win32", setup.projectDescription + "_Analysis.props");
|
||||
outputProperties(project, "Debug|Win32", setup.projectDescription + "_Debug.props");
|
||||
outputProperties(project, "Release|x64", setup.projectDescription + "_Release64.props");
|
||||
outputProperties(project, "Analysis|x64", setup.projectDescription + "_Analysis64.props");
|
||||
outputProperties(project, "Debug|x64", setup.projectDescription + "_Debug64.props");
|
||||
|
||||
project << "\t<PropertyGroup Label=\"UserMacros\" />\n";
|
||||
|
||||
|
@ -145,8 +145,8 @@ void MSBuildProvider::createProjectFile(const std::string &name, const std::stri
|
|||
addFilesToProject(moduleDir, project, includeList, excludeList, setup.filePrefix);
|
||||
|
||||
// Output references for the main project
|
||||
if (name == PROJECT_NAME)
|
||||
writeReferences(project);
|
||||
if (name == setup.projectName)
|
||||
writeReferences(setup, project);
|
||||
|
||||
project << "\t<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\n"
|
||||
"\t<ImportGroup Label=\"ExtensionTargets\">\n"
|
||||
|
@ -213,11 +213,11 @@ void MSBuildProvider::outputFilter(std::ostream &filters, const FileEntries &fil
|
|||
}
|
||||
}
|
||||
|
||||
void MSBuildProvider::writeReferences(std::ofstream &output) {
|
||||
void MSBuildProvider::writeReferences(const BuildSetup &setup, std::ofstream &output) {
|
||||
output << "\t<ItemGroup>\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
if (i->first == PROJECT_NAME)
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
output << "\t<ProjectReference Include=\"" << i->first << ".vcxproj\">\n"
|
||||
|
@ -235,7 +235,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
|||
std::map<std::string, StringList>::iterator warningsIterator = _projectWarnings.find(name);
|
||||
|
||||
// Nothing to add here, move along!
|
||||
if (name != PROJECT_NAME && name != "sword25" && name != "tinsel" && name != "grim" && warningsIterator == _projectWarnings.end())
|
||||
if (!setup.devTools && name != setup.projectName && name != "sword25" && name != "tinsel" && name != "grim" && warningsIterator == _projectWarnings.end())
|
||||
return;
|
||||
|
||||
std::string warnings = "";
|
||||
|
@ -247,7 +247,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
|||
"\t\t<ClCompile>\n";
|
||||
|
||||
// Compile configuration
|
||||
if (name == PROJECT_NAME || name == "sword25" || name == "grim") {
|
||||
if (setup.devTools || name == setup.projectName || name == "sword25" || name == "grim") {
|
||||
project << "\t\t\t<DisableLanguageExtensions>false</DisableLanguageExtensions>\n";
|
||||
} else {
|
||||
if (name == "tinsel" && !isRelease)
|
||||
|
@ -260,18 +260,18 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
|||
project << "\t\t</ClCompile>\n";
|
||||
|
||||
// Link configuration for main project
|
||||
if (name == PROJECT_NAME) {
|
||||
if (name == setup.projectName || setup.devTools) {
|
||||
std::string libraries;
|
||||
|
||||
for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
|
||||
libraries += *i + ".lib;";
|
||||
|
||||
project << "\t\t<Link>\n"
|
||||
"\t\t\t<OutputFile>$(OutDir)" << PROJECT_NAME << ".exe</OutputFile>\n"
|
||||
"\t\t\t<OutputFile>$(OutDir)" << (setup.devTools ? name : setup.projectName) << ".exe</OutputFile>\n"
|
||||
"\t\t\t<AdditionalDependencies>" << libraries << "%(AdditionalDependencies)</AdditionalDependencies>\n"
|
||||
"\t\t</Link>\n";
|
||||
|
||||
if (setup.runBuildEvents) {
|
||||
if (!setup.devTools && setup.runBuildEvents) {
|
||||
project << "\t\t<PreBuildEvent>\n"
|
||||
"\t\t\t<Message>Generate revision</Message>\n"
|
||||
"\t\t\t<Command>" << getPreBuildEvent() << "</Command>\n"
|
||||
|
@ -288,7 +288,7 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s
|
|||
project << "\t</ItemDefinitionGroup>\n";
|
||||
}
|
||||
|
||||
void MSBuildProvider::outputGlobalPropFile(std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) {
|
||||
void MSBuildProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) {
|
||||
|
||||
std::string warnings;
|
||||
for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
|
||||
|
@ -306,7 +306,7 @@ void MSBuildProvider::outputGlobalPropFile(std::ofstream &properties, int bits,
|
|||
"<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
|
||||
"\t<PropertyGroup>\n"
|
||||
"\t\t<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>\n"
|
||||
"\t\t<_PropertySheetDisplayName>" << PROJECT_DESCRIPTION << "_Global</_PropertySheetDisplayName>\n"
|
||||
"\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_Global</_PropertySheetDisplayName>\n"
|
||||
"\t\t<ExecutablePath>$(" << LIBS_DEFINE << ")\\bin;$(ExecutablePath)</ExecutablePath>\n"
|
||||
"\t\t<LibraryPath>$(" << LIBS_DEFINE << ")\\lib\\" << (bits == 32 ? "x86" : "x64") << ";$(LibraryPath)</LibraryPath>\n"
|
||||
"\t\t<IncludePath>$(" << LIBS_DEFINE << ")\\include;$(IncludePath)</IncludePath>\n"
|
||||
|
@ -319,7 +319,7 @@ void MSBuildProvider::outputGlobalPropFile(std::ofstream &properties, int bits,
|
|||
"\t\t\t<DisableSpecificWarnings>" << warnings << ";%(DisableSpecificWarnings)</DisableSpecificWarnings>\n"
|
||||
"\t\t\t<AdditionalIncludeDirectories>$(" << LIBS_DEFINE << ")\\include;" << prefix << ";" << prefix << "\\engines;$(TargetDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
|
||||
"\t\t\t<PreprocessorDefinitions>" << definesList << "%(PreprocessorDefinitions)</PreprocessorDefinitions>\n"
|
||||
"\t\t\t<ExceptionHandling></ExceptionHandling>\n";
|
||||
"\t\t\t<ExceptionHandling>" << (setup.devTools ? "Sync" : "") << "</ExceptionHandling>\n";
|
||||
|
||||
#if NEEDS_RTTI
|
||||
properties << "\t\t\t<RuntimeTypeInfo>true</RuntimeTypeInfo>\n";
|
||||
|
@ -333,9 +333,12 @@ void MSBuildProvider::outputGlobalPropFile(std::ofstream &properties, int bits,
|
|||
"\t\t</ClCompile>\n"
|
||||
"\t\t<Link>\n"
|
||||
"\t\t\t<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>\n"
|
||||
"\t\t\t<SubSystem>Console</SubSystem>\n"
|
||||
"\t\t\t<EntryPointSymbol>WinMainCRTStartup</EntryPointSymbol>\n"
|
||||
"\t\t</Link>\n"
|
||||
"\t\t\t<SubSystem>Console</SubSystem>\n";
|
||||
|
||||
if (!setup.devTools)
|
||||
properties << "\t\t\t<EntryPointSymbol>WinMainCRTStartup</EntryPointSymbol>\n";
|
||||
|
||||
properties << "\t\t</Link>\n"
|
||||
"\t\t<ResourceCompile>\n"
|
||||
"\t\t\t<AdditionalIncludeDirectories>" << prefix << ";%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\n"
|
||||
"\t\t</ResourceCompile>\n"
|
||||
|
@ -349,18 +352,18 @@ void MSBuildProvider::createBuildProp(const BuildSetup &setup, bool isRelease, b
|
|||
const std::string outputType = (enableAnalysis ? "Analysis" : (isRelease ? "Release" : "Debug"));
|
||||
const std::string outputBitness = (isWin32 ? "32" : "64");
|
||||
|
||||
std::ofstream properties((setup.outputDir + '/' + PROJECT_DESCRIPTION "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
|
||||
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
|
||||
if (!properties)
|
||||
error("Could not open \"" + setup.outputDir + '/' + PROJECT_DESCRIPTION "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
|
||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
|
||||
|
||||
properties << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
||||
"<Project DefaultTargets=\"Build\" ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
|
||||
"\t<ImportGroup Label=\"PropertySheets\">\n"
|
||||
"\t\t<Import Project=\"" << PROJECT_DESCRIPTION << "_Global" << (isWin32 ? "" : "64") << ".props\" />\n"
|
||||
"\t\t<Import Project=\"" << setup.projectDescription << "_Global" << (isWin32 ? "" : "64") << ".props\" />\n"
|
||||
"\t</ImportGroup>\n"
|
||||
"\t<PropertyGroup>\n"
|
||||
"\t\t<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>\n"
|
||||
"\t\t<_PropertySheetDisplayName>" << PROJECT_DESCRIPTION << "_" << outputType << outputBitness << "</_PropertySheetDisplayName>\n"
|
||||
"\t\t<_PropertySheetDisplayName>" << setup.projectDescription << "_" << outputType << outputBitness << "</_PropertySheetDisplayName>\n"
|
||||
"\t\t<LinkIncremental>" << (isRelease ? "false" : "true") << "</LinkIncremental>\n"
|
||||
"\t</PropertyGroup>\n"
|
||||
"\t<ItemDefinitionGroup>\n"
|
||||
|
|
|
@ -40,9 +40,9 @@ protected:
|
|||
void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
|
||||
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);
|
||||
|
||||
void writeReferences(std::ofstream &output);
|
||||
void writeReferences(const BuildSetup &setup, std::ofstream &output);
|
||||
|
||||
void outputGlobalPropFile(std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents);
|
||||
void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents);
|
||||
|
||||
void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, bool enableAnalysis);
|
||||
|
||||
|
|
|
@ -36,33 +36,36 @@ MSVCProvider::MSVCProvider(StringList &global_warnings, std::map<std::string, St
|
|||
}
|
||||
|
||||
void MSVCProvider::createWorkspace(const BuildSetup &setup) {
|
||||
UUIDMap::const_iterator svmUUID = _uuidMap.find(PROJECT_NAME);
|
||||
UUIDMap::const_iterator svmUUID = _uuidMap.find(setup.projectName);
|
||||
if (svmUUID == _uuidMap.end())
|
||||
error("No UUID for \"" PROJECT_NAME "\" project created");
|
||||
error("No UUID for \"" + setup.projectName + "\" project created");
|
||||
|
||||
const std::string svmProjectUUID = svmUUID->second;
|
||||
assert(!svmProjectUUID.empty());
|
||||
|
||||
std::string solutionUUID = createUUID();
|
||||
|
||||
std::ofstream solution((setup.outputDir + '/' + PROJECT_NAME ".sln").c_str());
|
||||
std::ofstream solution((setup.outputDir + '/' + setup.projectName + ".sln").c_str());
|
||||
if (!solution)
|
||||
error("Could not open \"" + setup.outputDir + '/' + PROJECT_NAME ".sln\" for writing");
|
||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectName + ".sln\" for writing");
|
||||
|
||||
solution << "Microsoft Visual Studio Solution File, Format Version " << _version + 1 << ".00\n";
|
||||
solution << "# Visual Studio " << getVisualStudioVersion() << "\n";
|
||||
|
||||
solution << "Project(\"{" << solutionUUID << "}\") = \"" << PROJECT_NAME << "\", \"" << PROJECT_NAME << getProjectExtension() << "\", \"{" << svmProjectUUID << "}\"\n";
|
||||
// Write main project
|
||||
if (!setup.devTools) {
|
||||
solution << "Project(\"{" << solutionUUID << "}\") = \"" << setup.projectName << "\", \"" << setup.projectName << getProjectExtension() << "\", \"{" << svmProjectUUID << "}\"\n";
|
||||
|
||||
// Project dependencies are moved to vcxproj files in Visual Studio 2010
|
||||
if (_version < 10)
|
||||
writeReferences(solution);
|
||||
// Project dependencies are moved to vcxproj files in Visual Studio 2010
|
||||
if (_version < 10)
|
||||
writeReferences(setup, solution);
|
||||
|
||||
solution << "EndProject\n";
|
||||
solution << "EndProject\n";
|
||||
}
|
||||
|
||||
// Note we assume that the UUID map only includes UUIDs for enabled engines!
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
if (i->first == PROJECT_NAME)
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
solution << "Project(\"{" << solutionUUID << "}\") = \"" << i->first << "\", \"" << i->first << getProjectExtension() << "\", \"{" << i->second << "}\"\n"
|
||||
|
@ -117,16 +120,16 @@ void MSVCProvider::createOtherBuildFiles(const BuildSetup &setup) {
|
|||
}
|
||||
|
||||
void MSVCProvider::createGlobalProp(const BuildSetup &setup) {
|
||||
std::ofstream properties((setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global" + getPropertiesExtension()).c_str());
|
||||
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_Global" + getPropertiesExtension()).c_str());
|
||||
if (!properties)
|
||||
error("Could not open \"" + setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global" + getPropertiesExtension() + "\" for writing");
|
||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global" + getPropertiesExtension() + "\" for writing");
|
||||
|
||||
outputGlobalPropFile(properties, 32, setup.defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
|
||||
outputGlobalPropFile(setup, properties, 32, setup.defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
|
||||
properties.close();
|
||||
|
||||
properties.open((setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global64" + getPropertiesExtension()).c_str());
|
||||
properties.open((setup.outputDir + '/' + setup.projectDescription + "_Global64" + getPropertiesExtension()).c_str());
|
||||
if (!properties)
|
||||
error("Could not open \"" + setup.outputDir + '/' + PROJECT_DESCRIPTION "_Global64" + getPropertiesExtension() + "\" for writing");
|
||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_Global64" + getPropertiesExtension() + "\" for writing");
|
||||
|
||||
// HACK: We must disable the "nasm" feature for x64. To achieve that we must duplicate the feature list and
|
||||
// recreate a define list.
|
||||
|
@ -140,7 +143,7 @@ void MSVCProvider::createGlobalProp(const BuildSetup &setup) {
|
|||
x64Defines.push_back("WIN32");
|
||||
x64Defines.push_back("SDL_BACKEND");
|
||||
|
||||
outputGlobalPropFile(properties, 64, x64Defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
|
||||
outputGlobalPropFile(setup, properties, 64, x64Defines, convertPathToWin(setup.filePrefix), setup.runBuildEvents);
|
||||
}
|
||||
|
||||
std::string MSVCProvider::getPreBuildEvent() const {
|
||||
|
|
|
@ -58,7 +58,7 @@ protected:
|
|||
* @param prefix File prefix, used to add additional include paths.
|
||||
* @param runBuildEvents true if generating a revision number, false otherwise
|
||||
*/
|
||||
virtual void outputGlobalPropFile(std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) = 0;
|
||||
virtual void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) = 0;
|
||||
|
||||
/**
|
||||
* Generates the project properties for debug and release settings.
|
||||
|
|
|
@ -83,7 +83,7 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
|
|||
// Check for project-specific warnings:
|
||||
std::map< std::string, std::list<std::string> >::iterator warningsIterator = _projectWarnings.find(name);
|
||||
|
||||
if (name == PROJECT_NAME) {
|
||||
if (setup.devTools || name == setup.projectName) {
|
||||
std::string libraries;
|
||||
|
||||
for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
|
||||
|
@ -115,12 +115,12 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
|
|||
toolConfig += (name == "grim" ? "DisableLanguageExtensions=\"false\" " : "");
|
||||
|
||||
// Win32
|
||||
outputConfiguration(project, toolConfig, "Debug", "Win32", "");
|
||||
outputConfiguration(project, toolConfig, "Analysis", "Win32", "");
|
||||
outputConfiguration(project, toolConfig, "Release", "Win32", "");
|
||||
outputConfiguration(project, toolConfig, "Debug", "x64", "64");
|
||||
outputConfiguration(project, toolConfig, "Analysis", "x64", "64");
|
||||
outputConfiguration(project, toolConfig, "Release", "x64", "64");
|
||||
outputConfiguration(setup, project, toolConfig, "Debug", "Win32", "");
|
||||
outputConfiguration(setup, project, toolConfig, "Analysis", "Win32", "");
|
||||
outputConfiguration(setup, project, toolConfig, "Release", "Win32", "");
|
||||
outputConfiguration(setup, project, toolConfig, "Debug", "x64", "64");
|
||||
outputConfiguration(setup, project, toolConfig, "Analysis", "x64", "64");
|
||||
outputConfiguration(setup, project, toolConfig, "Release", "x64", "64");
|
||||
}
|
||||
|
||||
project << "\t</Configurations>\n"
|
||||
|
@ -143,23 +143,23 @@ void VisualStudioProvider::createProjectFile(const std::string &name, const std:
|
|||
}
|
||||
|
||||
void VisualStudioProvider::outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const std::string &platform, const std::string &props, const bool isWin32) {
|
||||
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\" << PROJECT_DESCRIPTION << "_" << config << props << ".vsprops\">\n"
|
||||
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"1\" InheritedPropertySheets=\".\\" << setup.projectDescription << "_" << config << props << ".vsprops\">\n"
|
||||
"\t\t\t<Tool\tName=\"VCCLCompilerTool\" DisableLanguageExtensions=\"false\" />\n"
|
||||
"\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/" << PROJECT_NAME << ".exe\"\n"
|
||||
"\t\t\t<Tool\tName=\"VCLinkerTool\" OutputFile=\"$(OutDir)/" << setup.projectName << ".exe\"\n"
|
||||
"\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n"
|
||||
"\t\t\t/>\n";
|
||||
outputBuildEvents(project, setup, isWin32);
|
||||
project << "\t\t</Configuration>\n";
|
||||
}
|
||||
|
||||
void VisualStudioProvider::outputConfiguration(std::ostream &project, const std::string &toolConfig, const std::string &config, const std::string &platform, const std::string &props) {
|
||||
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\" << PROJECT_DESCRIPTION << "_" << config << props << ".vsprops\">\n"
|
||||
void VisualStudioProvider::outputConfiguration(const BuildSetup &setup, std::ostream &project, const std::string &toolConfig, const std::string &config, const std::string &platform, const std::string &props) {
|
||||
project << "\t\t<Configuration Name=\"" << config << "|" << platform << "\" ConfigurationType=\"4\" InheritedPropertySheets=\".\\" << setup.projectDescription << "_" << config << props << ".vsprops\">\n"
|
||||
"\t\t\t<Tool Name=\"VCCLCompilerTool\" "<< toolConfig << "/>\n"
|
||||
"\t\t</Configuration>\n";
|
||||
}
|
||||
|
||||
void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildSetup &setup, const bool isWin32) {
|
||||
if (setup.runBuildEvents) {
|
||||
if (!setup.devTools && setup.runBuildEvents) {
|
||||
project << "\t\t\t<Tool\tName=\"VCPreBuildEventTool\"\n"
|
||||
"\t\t\t\tCommandLine=\"" << getPreBuildEvent() << "\"\n"
|
||||
"\t\t\t/>\n"
|
||||
|
@ -169,11 +169,11 @@ void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildS
|
|||
}
|
||||
}
|
||||
|
||||
void VisualStudioProvider::writeReferences(std::ofstream &output) {
|
||||
void VisualStudioProvider::writeReferences(const BuildSetup &setup, std::ofstream &output) {
|
||||
output << "\tProjectSection(ProjectDependencies) = postProject\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
if (i->first == PROJECT_NAME)
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
output << "\t\t{" << i->second << "} = {" << i->second << "}\n";
|
||||
|
@ -182,7 +182,7 @@ void VisualStudioProvider::writeReferences(std::ofstream &output) {
|
|||
output << "\tEndProjectSection\n";
|
||||
}
|
||||
|
||||
void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) {
|
||||
void VisualStudioProvider::outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents) {
|
||||
std::string warnings;
|
||||
for (StringList::const_iterator i = _globalWarnings.begin(); i != _globalWarnings.end(); ++i)
|
||||
warnings += *i + ';';
|
||||
|
@ -202,17 +202,17 @@ void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int b
|
|||
"<VisualStudioPropertySheet\n"
|
||||
"\tProjectType=\"Visual C++\"\n"
|
||||
"\tVersion=\"8.00\"\n"
|
||||
"\tName=\"" << PROJECT_DESCRIPTION << "_Global\"\n"
|
||||
"\tName=\"" << setup.projectDescription << "_Global\"\n"
|
||||
"\tOutputDirectory=\"$(ConfigurationName)" << bits << "\"\n"
|
||||
"\tIntermediateDirectory=\"$(ConfigurationName)" << bits << "/$(ProjectName)\"\n"
|
||||
"\t>\n"
|
||||
"\t<Tool\n"
|
||||
"\t\tName=\"VCCLCompilerTool\"\n"
|
||||
"\t\tDisableLanguageExtensions=\"true\"\n"
|
||||
"\t\tDisableLanguageExtensions=\"" << (setup.devTools ? "false" : "true") << "\"\n"
|
||||
"\t\tDisableSpecificWarnings=\"" << warnings << "\"\n"
|
||||
"\t\tAdditionalIncludeDirectories=\"" << prefix << ";" << prefix << "\\engines;$(" << LIBS_DEFINE << ")\\include;$(TargetDir)\"\n"
|
||||
"\t\tPreprocessorDefinitions=\"" << definesList << "\"\n"
|
||||
"\t\tExceptionHandling=\"0\"\n";
|
||||
"\t\tExceptionHandling=\"" << (setup.devTools ? "1" : "0") << "\"\n";
|
||||
|
||||
#if NEEDS_RTTI
|
||||
properties << "\t\tRuntimeTypeInfo=\"true\"\n";
|
||||
|
@ -231,9 +231,12 @@ void VisualStudioProvider::outputGlobalPropFile(std::ofstream &properties, int b
|
|||
"\t<Tool\n"
|
||||
"\t\tName=\"VCLinkerTool\"\n"
|
||||
"\t\tIgnoreDefaultLibraryNames=\"\"\n"
|
||||
"\t\tSubSystem=\"1\"\n"
|
||||
"\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n"
|
||||
"\t\tAdditionalLibraryDirectories=\"$(" << LIBS_DEFINE << ")\\lib\\" << ((bits == 32) ? "x86" : "x64") << "\"\n"
|
||||
"\t\tSubSystem=\"1\"\n";
|
||||
|
||||
if (!setup.devTools)
|
||||
properties << "\t\tEntryPointSymbol=\"WinMainCRTStartup\"\n";
|
||||
|
||||
properties << "\t\tAdditionalLibraryDirectories=\"$(" << LIBS_DEFINE << ")\\lib\\" << ((bits == 32) ? "x86" : "x64") << "\"\n"
|
||||
"\t/>\n"
|
||||
"\t<Tool\n"
|
||||
"\t\tName=\"VCResourceCompilerTool\"\n"
|
||||
|
@ -248,16 +251,16 @@ void VisualStudioProvider::createBuildProp(const BuildSetup &setup, bool isRelea
|
|||
const std::string outputType = (enableAnalysis ? "Analysis" : (isRelease ? "Release" : "Debug"));
|
||||
const std::string outputBitness = (isWin32 ? "32" : "64");
|
||||
|
||||
std::ofstream properties((setup.outputDir + '/' + PROJECT_DESCRIPTION "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
|
||||
std::ofstream properties((setup.outputDir + '/' + setup.projectDescription + "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension()).c_str());
|
||||
if (!properties)
|
||||
error("Could not open \"" + setup.outputDir + '/' + PROJECT_DESCRIPTION "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
|
||||
error("Could not open \"" + setup.outputDir + '/' + setup.projectDescription + "_" + outputType + (isWin32 ? "" : "64") + getPropertiesExtension() + "\" for writing");
|
||||
|
||||
properties << "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n"
|
||||
"<VisualStudioPropertySheet\n"
|
||||
"\tProjectType=\"Visual C++\"\n"
|
||||
"\tVersion=\"8.00\"\n"
|
||||
"\tName=\"" << PROJECT_DESCRIPTION << "_" << outputType << outputBitness << "\"\n"
|
||||
"\tInheritedPropertySheets=\".\\" << PROJECT_DESCRIPTION << "_Global" << (isWin32 ? "" : "64") << ".vsprops\"\n"
|
||||
"\tName=\"" << setup.projectDescription << "_" << outputType << outputBitness << "\"\n"
|
||||
"\tInheritedPropertySheets=\".\\" << setup.projectDescription << "_Global" << (isWin32 ? "" : "64") << ".vsprops\"\n"
|
||||
"\t>\n"
|
||||
"\t<Tool\n"
|
||||
"\t\tName=\"VCCLCompilerTool\"\n";
|
||||
|
|
|
@ -38,9 +38,9 @@ protected:
|
|||
void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
|
||||
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);
|
||||
|
||||
void writeReferences(std::ofstream &output);
|
||||
void writeReferences(const BuildSetup &setup, std::ofstream &output);
|
||||
|
||||
void outputGlobalPropFile(std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents);
|
||||
void outputGlobalPropFile(const BuildSetup &setup, std::ofstream &properties, int bits, const StringList &defines, const std::string &prefix, bool runBuildEvents);
|
||||
|
||||
void createBuildProp(const BuildSetup &setup, bool isRelease, bool isWin32, bool enableAnalysis);
|
||||
|
||||
|
@ -49,7 +49,7 @@ protected:
|
|||
int getVisualStudioVersion();
|
||||
|
||||
void outputConfiguration(std::ostream &project, const BuildSetup &setup, const std::string &libraries, const std::string &config, const std::string &platform, const std::string &props, const bool isWin32);
|
||||
void outputConfiguration(std::ostream &project, const std::string &toolConfig, const std::string &config, const std::string &platform, const std::string &props);
|
||||
void outputConfiguration(const BuildSetup &setup, std::ostream &project, const std::string &toolConfig, const std::string &config, const std::string &platform, const std::string &props);
|
||||
void outputBuildEvents(std::ostream &project, const BuildSetup &setup, const bool isWin32);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue