CREATE_PROJECT: Put detection in a separate project
Keeps the main project clean and is a prerequisite for loading detection as a plugin
This commit is contained in:
parent
7775330954
commit
803d8f1ba5
6 changed files with 41 additions and 32 deletions
|
@ -45,7 +45,7 @@ void CodeBlocksProvider::createWorkspace(const BuildSetup &setup) {
|
|||
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) {
|
||||
for (UUIDMap::const_iterator i = _allProjUuidMap.begin(); i != _allProjUuidMap.end(); ++i) {
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
|
@ -153,7 +153,7 @@ void CodeBlocksProvider::createProjectFile(const std::string &name, const std::s
|
|||
for (StringList::const_iterator i = libraries.begin(); i != libraries.end(); ++i)
|
||||
project << "\t\t\t\t\t<Add library=\"" << (*i) << "\" />\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
for (UUIDMap::const_iterator i = _allProjUuidMap.begin(); i != _allProjUuidMap.end(); ++i) {
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
|
@ -277,7 +277,7 @@ void CodeBlocksProvider::writeFileListToProject(const FileNode &dir, std::ofstre
|
|||
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) {
|
||||
for (UUIDMap::const_iterator i = _allProjUuidMap.begin(); i != _allProjUuidMap.end(); ++i) {
|
||||
if (i->first == " << PROJECT_NAME << ")
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1500,22 +1500,26 @@ void ProjectProvider::createProject(BuildSetup &setup) {
|
|||
std::string targetFolder;
|
||||
|
||||
if (setup.devTools) {
|
||||
_uuidMap = createToolsUUIDMap();
|
||||
_engineUuidMap = createToolsUUIDMap();
|
||||
targetFolder = "/devtools/";
|
||||
} else if (!setup.tests) {
|
||||
_uuidMap = createUUIDMap(setup);
|
||||
_engineUuidMap = createUUIDMap(setup);
|
||||
targetFolder = "/engines/";
|
||||
}
|
||||
|
||||
_allProjUuidMap = _engineUuidMap;
|
||||
|
||||
// We also need to add the UUID of the main project file.
|
||||
const std::string svmUUID = _uuidMap[setup.projectName] = createUUID(setup.projectName);
|
||||
const std::string svmUUID = _allProjUuidMap[setup.projectName] = createUUID(setup.projectName);
|
||||
// Add the uuid of the detection project
|
||||
const std::string detUUID = _allProjUuidMap["scummvm-detection"] = createUUID("scummvm-detection");
|
||||
|
||||
createWorkspace(setup);
|
||||
|
||||
StringList in, ex;
|
||||
|
||||
// Create project files
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
for (UUIDMap::const_iterator i = _engineUuidMap.begin(); i != _engineUuidMap.end(); ++i) {
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
// Retain the files between engines if we're creating a single project
|
||||
|
@ -1528,6 +1532,28 @@ void ProjectProvider::createProject(BuildSetup &setup) {
|
|||
createProjectFile(i->first, i->second, setup, moduleDir, in, ex);
|
||||
}
|
||||
|
||||
// Create engine-detection submodules.
|
||||
{
|
||||
in.clear();
|
||||
ex.clear();
|
||||
std::vector<std::string> detectionModuleDirs;
|
||||
detectionModuleDirs.reserve(setup.engines.size());
|
||||
|
||||
for (EngineDescList::const_iterator i = setup.engines.begin(), end = setup.engines.end(); i != end; ++i) {
|
||||
// We ignore all sub engines here because they require no special handling.
|
||||
if (isSubEngine(i->name, setup.engines)) {
|
||||
continue;
|
||||
}
|
||||
detectionModuleDirs.push_back(setup.srcDir + "/engines/" + i->name);
|
||||
}
|
||||
|
||||
for (std::string &str : detectionModuleDirs) {
|
||||
createModuleList(str, setup.defines, setup.testDirs, in, ex, true);
|
||||
}
|
||||
|
||||
createProjectFile("Detection", detUUID, setup, setup.srcDir, in, ex);
|
||||
}
|
||||
|
||||
if (setup.tests) {
|
||||
// Create the main project file.
|
||||
in.clear();
|
||||
|
@ -1561,24 +1587,6 @@ void ProjectProvider::createProject(BuildSetup &setup) {
|
|||
createModuleList(setup.srcDir + "/image", setup.defines, setup.testDirs, in, ex);
|
||||
createModuleList(setup.srcDir + "/math", setup.defines, setup.testDirs, in, ex);
|
||||
|
||||
// Create engine-detection submodules.
|
||||
if (setup.useStaticDetection) {
|
||||
std::vector<std::string> detectionModuleDirs;
|
||||
detectionModuleDirs.reserve(setup.engines.size());
|
||||
|
||||
for (EngineDescList::const_iterator i = setup.engines.begin(), end = setup.engines.end(); i != end; ++i) {
|
||||
// We ignore all sub engines here because they require no special handling.
|
||||
if (isSubEngine(i->name, setup.engines)) {
|
||||
continue;
|
||||
}
|
||||
detectionModuleDirs.push_back(setup.srcDir + "/engines/" + i->name);
|
||||
}
|
||||
|
||||
for (std::string &str : detectionModuleDirs) {
|
||||
createModuleList(str, setup.defines, setup.testDirs, in, ex, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Resource files
|
||||
addResourceFiles(setup, in, ex);
|
||||
|
||||
|
|
|
@ -482,7 +482,8 @@ protected:
|
|||
StringList &_globalWarnings; ///< Global warnings
|
||||
std::map<std::string, StringList> &_projectWarnings; ///< Per-project warnings
|
||||
|
||||
UUIDMap _uuidMap; ///< List of (project name, UUID) pairs
|
||||
UUIDMap _engineUuidMap; ///< List of (project name, UUID) pairs
|
||||
UUIDMap _allProjUuidMap;
|
||||
|
||||
/**
|
||||
* Create workspace/solution file
|
||||
|
|
|
@ -255,7 +255,7 @@ void MSBuildProvider::outputFilter(std::ostream &filters, const FileEntries &fil
|
|||
void MSBuildProvider::writeReferences(const BuildSetup &setup, std::ofstream &output) {
|
||||
output << "\t<ItemGroup>\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
for (UUIDMap::const_iterator i = _allProjUuidMap.begin(); i != _allProjUuidMap.end(); ++i) {
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -144,8 +144,8 @@ std::string MSVCProvider::outputLibraryDependencies(const BuildSetup &setup, boo
|
|||
}
|
||||
|
||||
void MSVCProvider::createWorkspace(const BuildSetup &setup) {
|
||||
UUIDMap::const_iterator svmUUID = _uuidMap.find(setup.projectName);
|
||||
if (svmUUID == _uuidMap.end())
|
||||
UUIDMap::const_iterator svmUUID = _allProjUuidMap.find(setup.projectName);
|
||||
if (svmUUID == _allProjUuidMap.end())
|
||||
error("No UUID for \"" + setup.projectName + "\" project created");
|
||||
|
||||
const std::string svmProjectUUID = svmUUID->second;
|
||||
|
@ -174,7 +174,7 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) {
|
|||
}
|
||||
|
||||
// Note we assume that the UUID map only includes UUIDs for enabled engines!
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
for (UUIDMap::const_iterator i = _allProjUuidMap.begin(); i != _allProjUuidMap.end(); ++i) {
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
|
@ -195,7 +195,7 @@ void MSVCProvider::createWorkspace(const BuildSetup &setup) {
|
|||
solution << "\tEndGlobalSection\n"
|
||||
"\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n";
|
||||
|
||||
for (UUIDMap::const_iterator i = _uuidMap.begin(); i != _uuidMap.end(); ++i) {
|
||||
for (UUIDMap::const_iterator i = _allProjUuidMap.begin(); i != _allProjUuidMap.end(); ++i) {
|
||||
for (std::list<MSVC_Architecture>::const_iterator arch = _archs.begin(); arch != _archs.end(); ++arch) {
|
||||
solution << "\t\t{" << i->second << "}.Debug|" << getMSVCConfigName(*arch) << ".ActiveCfg = Debug|" << getMSVCConfigName(*arch) << "\n"
|
||||
<< "\t\t{" << i->second << "}.Debug|" << getMSVCConfigName(*arch) << ".Build.0 = Debug|" << getMSVCConfigName(*arch) << "\n"
|
||||
|
|
|
@ -175,7 +175,7 @@ void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildS
|
|||
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) {
|
||||
for (UUIDMap::const_iterator i = _allProjUuidMap.begin(); i != _allProjUuidMap.end(); ++i) {
|
||||
if (i->first == setup.projectName)
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue