X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FmodelCDMApplication.cpp;fp=lib%2FcreaDevManagerLib%2FmodelCDMApplication.cpp;h=56c9e08bbae20cdb00db5e66d2042c61c0368bd3;hb=2fb5dd9262993efaf56bfc731f4297fdb96bf63e;hp=19cc293cd8543dca53f9a74e2fdb8d5ac8ce6566;hpb=40c574d86b82c2afc5a351f1ad96cc0254008306;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMApplication.cpp b/lib/creaDevManagerLib/modelCDMApplication.cpp index 19cc293..56c9e08 100644 --- a/lib/creaDevManagerLib/modelCDMApplication.cpp +++ b/lib/creaDevManagerLib/modelCDMApplication.cpp @@ -35,6 +35,7 @@ #include "modelCDMApplication.h" #include +#include #include #include "CDMUtilities.h" @@ -421,3 +422,90 @@ const bool modelCDMApplication::Refresh(std::string*& result) this->SortChildren(); return true; } + +void modelCDMApplication::CheckStructure(std::map& properties) +{ + //check cmake exist + if(this->CMakeLists != NULL) + { + //set default properties + properties["application " + this->name + " lib ${crea_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${WXWIDGETS_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${KWWidgets_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${VTK_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${ITK_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${GDCM_LIBRARIES}"] = false; + properties["application " + this->name + " lib ${BOOST_LIBRARIES}"] = false; + + //open cmakelists + std::ifstream confFile; + confFile.open((this->CMakeLists->GetPath()).c_str()); + + //take everything that is not commented + std::string fileContent; + + std::string word; + std::vector words; + while(confFile.is_open() && !confFile.eof()) + { + std::getline(confFile,word, '\n'); + if(word[0] != '#') + { + CDMUtilities::splitter::split(words, word, "#", CDMUtilities::splitter::empties_ok); + if (words.size() > 0) + { + word = words[0]; + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok); + for (int i = 0; i < words.size(); i++) + { + if(words[i].substr(0,2) == "//") + break; + fileContent += words[i] + " "; + } + } + } + } + + //check every instruction + std::stringstream ss(fileContent); + while(!ss.eof()) + { + std::getline(ss,word, '('); + + //check instruction name + CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::no_empties); + + //set instructions + if (words.size() > 0 && words[words.size()-1] == "SET") + { + std::getline(ss,word, ')'); + + CDMUtilities::splitter::split(words, word, " \t", CDMUtilities::splitter::no_empties); + if (words.size() > 1) + { + if (words[0] == "${EXE_NAME}_LINK_LIBRARIES") + { + for (int i = 1; i < words.size(); i++) + { + properties["application " + this->name + " lib " + words[i]] = true; + } + } + } + } + else if (words.size() > 0 && words[words.size()-1] == "INCLUDE_DIRECTORIES") + { + std::getline(ss,word, ')'); + + CDMUtilities::splitter::split(words, word, " \t", CDMUtilities::splitter::no_empties); + + for (int i = 0; i < words.size(); i++) + { + properties["application " + this->name + " dir " + words[i]] = true; + } + + + } + } + + } +}