ENH: add some comments on how this could be moved to global generator
This commit is contained in:
parent
4d31557dcb
commit
beb584e7a1
|
@ -138,6 +138,15 @@ void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
||||||
dst2 += lang;
|
dst2 += lang;
|
||||||
dst2 += "Compiler.cmake";
|
dst2 += "Compiler.cmake";
|
||||||
cmSystemTools::CopyFileIfDifferent(src2.c_str(), dst2.c_str());
|
cmSystemTools::CopyFileIfDifferent(src2.c_str(), dst2.c_str());
|
||||||
|
src2 = m_ConfiguredFilesPath;
|
||||||
|
src2 += "/CMake";
|
||||||
|
src2 += lang;
|
||||||
|
src2 += "Platform.cmake";
|
||||||
|
dst2 = rootBin;
|
||||||
|
dst2 += "/CMake";
|
||||||
|
dst2 += lang;
|
||||||
|
dst2 += "Platform.cmake";
|
||||||
|
cmSystemTools::CopyFileIfDifferent(src2.c_str(), dst2.c_str());
|
||||||
}
|
}
|
||||||
rootBin = m_ConfiguredFilesPath;
|
rootBin = m_ConfiguredFilesPath;
|
||||||
}
|
}
|
||||||
|
@ -145,6 +154,16 @@ void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
||||||
// **** Step 1, find and make sure CMAKE_MAKE_PROGRAM is defined
|
// **** Step 1, find and make sure CMAKE_MAKE_PROGRAM is defined
|
||||||
this->FindMakeProgram(mf);
|
this->FindMakeProgram(mf);
|
||||||
|
|
||||||
|
// try and load the CMakeSystem.cmake if it is there
|
||||||
|
std::string fpath = rootBin;
|
||||||
|
if(!mf->GetDefinition("CMAKE_SYSTEM_LOADED"))
|
||||||
|
{
|
||||||
|
fpath += "/CMakeSystem.cmake";
|
||||||
|
if(cmSystemTools::FileExists(fpath.c_str()))
|
||||||
|
{
|
||||||
|
mf->ReadListFile(0,fpath.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
// **** Step 2, Load the CMakeDetermineSystem.cmake file and find out
|
// **** Step 2, Load the CMakeDetermineSystem.cmake file and find out
|
||||||
// what platform we are running on
|
// what platform we are running on
|
||||||
if (!isLocal && !mf->GetDefinition("CMAKE_SYSTEM_NAME"))
|
if (!isLocal && !mf->GetDefinition("CMAKE_SYSTEM_NAME"))
|
||||||
|
@ -166,7 +185,7 @@ void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
||||||
}
|
}
|
||||||
// **** Step 3, load the CMakeSystem.cmake from the binary directory
|
// **** Step 3, load the CMakeSystem.cmake from the binary directory
|
||||||
// this file is configured by the CMakeDetermineSystem.cmake file
|
// this file is configured by the CMakeDetermineSystem.cmake file
|
||||||
std::string fpath = rootBin;
|
fpath = rootBin;
|
||||||
if(!mf->GetDefinition("CMAKE_SYSTEM_LOADED"))
|
if(!mf->GetDefinition("CMAKE_SYSTEM_LOADED"))
|
||||||
{
|
{
|
||||||
fpath += "/CMakeSystem.cmake";
|
fpath += "/CMakeSystem.cmake";
|
||||||
|
@ -188,6 +207,26 @@ void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
||||||
"broken CMakeLists.txt file or a problematic release of "
|
"broken CMakeLists.txt file or a problematic release of "
|
||||||
"CMake");
|
"CMake");
|
||||||
}
|
}
|
||||||
|
// try and load the configured file first
|
||||||
|
std::string loadedLang = "CMAKE_";
|
||||||
|
loadedLang += lang;
|
||||||
|
loadedLang += "_COMPILER_LOADED";
|
||||||
|
if(!mf->GetDefinition(loadedLang.c_str()))
|
||||||
|
{
|
||||||
|
fpath = rootBin;
|
||||||
|
fpath += "/CMake";
|
||||||
|
fpath += lang;
|
||||||
|
fpath += "Compiler.cmake";
|
||||||
|
if(cmSystemTools::FileExists(fpath.c_str()))
|
||||||
|
{
|
||||||
|
if(!mf->ReadListFile(0,fpath.c_str()))
|
||||||
|
{
|
||||||
|
cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
|
||||||
|
}
|
||||||
|
this->SetLanguageEnabled(lang, mf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
needTestLanguage = true; // must test a language after finding it
|
needTestLanguage = true; // must test a language after finding it
|
||||||
// read determine LANG compiler
|
// read determine LANG compiler
|
||||||
std::string determineCompiler = "CMakeDetermine";
|
std::string determineCompiler = "CMakeDetermine";
|
||||||
|
|
|
@ -26,6 +26,42 @@
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
#include <cmsys/RegularExpression.hxx>
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Ideas for moving this stuff into the global generator
|
||||||
|
// Right now in your local generator you read and write a file to build
|
||||||
|
// up a list of all files in the project.
|
||||||
|
// Basically, there does not need to be a local kdevlop generator at all,
|
||||||
|
// it can just use the unix makefile one. Then in the global generators
|
||||||
|
// Generate method you do something like this:
|
||||||
|
// unsigned int i;
|
||||||
|
// for(i = 0; i < m_LocalGenerators.size(); ++i)
|
||||||
|
// {
|
||||||
|
// // Get list of targets and sources from local generator i
|
||||||
|
// // add them to a file map like you do now in the local generator
|
||||||
|
// }
|
||||||
|
// // now write out the Project.filelist file and Project.kdevlop files
|
||||||
|
// It should most likely do the same thing as the visual studio generators and
|
||||||
|
// write out all the sub-projects as well. And also honor the exclude from above
|
||||||
|
// option.
|
||||||
|
|
||||||
|
// I guess at the end of the day it should do something like this:
|
||||||
|
// TopProject.kdevelop
|
||||||
|
// TopProject.kdevelop.filelist
|
||||||
|
// SubProject/SubProject.kdevelop
|
||||||
|
// SubProject/SubProject.kdevelop.filelist
|
||||||
|
// if SubProject was in a SUBDIR(EXCLUDE_FROM_ALL SubProject)
|
||||||
|
// then its files should not be in TopProject.filelist.
|
||||||
|
// If you look at these functions you can see how the visual studio
|
||||||
|
// cmGlobalVisualStudio7Generator::Generate() // generate the project
|
||||||
|
// void cmGlobalVisualStudio7Generator::CollectSubprojects() // create a map of project names to local
|
||||||
|
// // generators
|
||||||
|
// void cmGlobalVisualStudio7Generator::OutputSLNFile(cmLocalGenerator* root,
|
||||||
|
// std::vector<cmLocalGenerator*>& generators)
|
||||||
|
// // output a project for each project and sub project
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
cmLocalKdevelopGenerator::cmLocalKdevelopGenerator()
|
cmLocalKdevelopGenerator::cmLocalKdevelopGenerator()
|
||||||
:cmLocalUnixMakefileGenerator()
|
:cmLocalUnixMakefileGenerator()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue