]> Creatis software - crea.git/blobdiff - lib/creaDevManagerLib/modelCDMApplication.cpp
Feature #1711 CreaDevManager application implementation
[crea.git] / lib / creaDevManagerLib / modelCDMApplication.cpp
index dcfb21e84ff0d86df300b3964e0183dff3946e92..c15bedf6c2cb04bdf49cd95282d5a03209b1be4e 100644 (file)
@@ -363,7 +363,7 @@ const bool modelCDMApplication::Refresh(std::string*& result)
                               std::getline(fileStream,word,'(');
                               std::vector<std::string> wordBits;
                               CDMUtilities::splitter::split(wordBits,word," \n",CDMUtilities::splitter::no_empties);
-                              if (wordBits[wordBits.size() - 1] == "main")
+                              if (wordBits[wordBits.size() - 1] == "main" || wordBits[wordBits.size() - 1] == "IMPLEMENT_APP")
                                 {
                                   this->mainFile = dynamic_cast<modelCDMFile*>(children[i]);
                                 }
@@ -389,7 +389,7 @@ const bool modelCDMApplication::Refresh(std::string*& result)
                           std::getline(fileStream,word,'(');
                           std::vector<std::string> wordBits;
                           CDMUtilities::splitter::split(wordBits,word," \n",CDMUtilities::splitter::no_empties);
-                          if (wordBits[wordBits.size() - 1] == "main")
+                          if (wordBits[wordBits.size() - 1] == "main" || wordBits[wordBits.size() - 1] == "IMPLEMENT_APP")
                             {
                               this->mainFile = file;
                             }
@@ -514,3 +514,95 @@ void modelCDMApplication::CheckStructure(std::map<std::string, bool>& properties
 
     }
 }
+
+std::map<std::string, bool> modelCDMApplication::Get3rdPartyLibraries()
+{
+  std::map<std::string, std::string> correspondence;
+  correspondence["${crea_LIBRARIES}"] = "Crea";
+  correspondence["${WXWIDGETS_LIBRARIES}"] = "WxWidgets";
+  correspondence["${KWWidgets_LIBRARIES}"] = "KWWidgets";
+  correspondence["${VTK_LIBRARIES}"] = "VTK";
+  correspondence["${ITK_LIBRARIES}"] = "ITK";
+  correspondence["${GDCM_LIBRARIES}"] = "GDCM";
+  correspondence["${BOOST_LIBRARIES}"] = "Boost";
+  std::map<std::string, bool> res;
+  res["Crea"] = false;
+  res["WxWidgets"] = false;
+  res["KWWidgets"] = false;
+  res["VTK"] = false;
+  res["ITK"] = false;
+  res["GDCM"] = false;
+  res["Boost"] = false;
+
+  if(this->HasCMakeLists())
+    {
+      std::ifstream CMFile(this->CMakeLists->GetPath().c_str());
+      if (CMFile.is_open())
+        {
+          std::string line;
+          while(!CMFile.eof())
+            {
+              std::getline(CMFile, line, '(');
+
+              std::vector<std::string> lineSeg;
+              CDMUtilities::splitter::split(lineSeg,line,"\n ",CDMUtilities::splitter::no_empties);
+
+              if(lineSeg.size() > 0 && lineSeg[lineSeg.size()-1] == "SET")
+                {
+                  //std::cout << "found set" << std::endl;
+                  std::getline(CMFile, line, ')');
+                  //std::cout << line << std::endl;
+                  CDMUtilities::splitter::split(lineSeg,line,"\n",CDMUtilities::splitter::no_empties);
+                  if(lineSeg.size() > 0)
+                    {
+                      //std::cout << lineSeg[0] << std::endl;
+                      for(int i = 0; i < lineSeg[0].size(); ++i)
+                        if (lineSeg[0][i] == ' ')
+                          {
+                            lineSeg[0].erase(i,1);
+                            --i;
+                          }
+                      //std::cout << lineSeg[0] << std::endl;
+                      if (lineSeg[0] == "${EXE_NAME}_LINK_LIBRARIES")
+                        {
+                          //std::cout << "link" << std::endl;
+                          for (int l = 1; l < lineSeg.size(); ++l)
+                            {
+                              for(int i = 0;i < lineSeg[l].size(); i++)
+                                if (lineSeg[l][i] == ' ')
+                                  {
+                                    lineSeg[l].erase(i,1);
+                                    i--;
+                                  }
+                              if(lineSeg[l].size() > 0 && lineSeg[l][0] == '$')
+                                {
+                                  //std::cout << "found " << lineSeg[l] << std::endl;
+                                  res[correspondence[lineSeg[l]]] = true;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+          CMFile.close();
+        }
+    }
+  return res;
+}
+
+bool modelCDMApplication::Set3rdPartyLibrary(const std::string& library_name, const bool& toInclude)
+{
+  return false;
+}
+
+std::map<std::string, bool> modelCDMApplication::GetCustomLibraries()
+{
+  std::map<std::string, bool> res;
+  res["Test"] = false;
+  return res;
+}
+
+bool modelCDMApplication::SetCustomLibrary(const std::string& library_name, const bool& toInclude)
+{
+  return false;
+}