CREATE_PROJECT: Make ProjectProvider able to work properly with subclasses that want to create one single project.

This commit is contained in:
Einar Johan Trøan Sømåen 2015-04-04 18:17:10 +02:00
parent d6625c20bf
commit 9ef6e59805
3 changed files with 22 additions and 8 deletions

View File

@ -1279,18 +1279,23 @@ void ProjectProvider::createProject(BuildSetup &setup) {
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
if (i->first == setup.projectName)
continue;
in.clear(); ex.clear();
// Retain the files between engines if we're creating a single project
if (createOneProjectPerEngine()) {
in.clear(); ex.clear();
}
const std::string moduleDir = setup.srcDir + targetFolder + i->first;
createModuleList(moduleDir, setup.defines, setup.testDirs, in, ex);
createProjectFile(i->first, i->second, setup, moduleDir, in, ex);
if (createOneProjectPerEngine()) {
createProjectFile(i->first, i->second, setup, moduleDir, in, ex);
}
}
if (setup.tests) {
// Create the main project file.
in.clear(); ex.clear();
if (createOneProjectPerEngine()) {
in.clear(); ex.clear();
}
createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex);
createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex);
createModuleList(setup.srcDir + "/base", setup.defines, setup.testDirs, in, ex);
@ -1304,8 +1309,9 @@ void ProjectProvider::createProject(BuildSetup &setup) {
createProjectFile(setup.projectName, svmUUID, setup, setup.srcDir, in, ex);
} else if (!setup.devTools) {
// Last but not least create the main project file.
in.clear(); ex.clear();
if (createOneProjectPerEngine()) {
in.clear(); ex.clear();
}
// File list for the Project file
createModuleList(setup.srcDir + "/backends", setup.defines, setup.testDirs, in, ex);
createModuleList(setup.srcDir + "/backends/platform/sdl", setup.defines, setup.testDirs, in, ex);

View File

@ -458,6 +458,13 @@ protected:
*/
virtual const char *getProjectExtension() { return ""; }
/**
* Returns whether the provider produces one project per engine
* allowing providers such as the XCode-project provider to disable
* the logic for this in the super-class, thus merging the engine-files
* into the main project instead.
*/
virtual bool createOneProjectPerEngine() const { return true; }
/**
* Adds files of the specified directory recursively to given project file.
*

View File

@ -45,7 +45,8 @@ protected:
void writeFileListToProject(const FileNode &dir, std::ofstream &projectFile, const int indentation,
const StringList &duplicate, const std::string &objPrefix, const std::string &filePrefix);
// Disable multi-project creation on ProjectProvider
bool createOneProjectPerEngine() const { return false; }
private:
enum {
SettingsAsList = 0x01,