2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------
31 * Created on: 13/11/2012
32 * Author: Daniel Felipe Gonzalez Obando
35 #include "modelCDMProject.h"
41 #include "CDMUtilities.h"
45 modelCDMProject::modelCDMProject()
47 std::cout << "in constructor1" << std::endl;
52 modelCDMProject::modelCDMProject(
53 const std::string& path,
54 const std::string& buildPath
57 this->path = CDMUtilities::fixPath(path);
59 std::string pathFixed(CDMUtilities::fixPath(path));
61 //TODO: set pathMakeLists for windows
62 std::string pathMakeLists = pathFixed + "/CMakeLists.txt";
64 std::ifstream confFile;
65 confFile.open((pathMakeLists).c_str());
68 while(confFile.is_open() && !confFile.eof())
70 //std::cout << "leyendo " << word << std::endl;
72 std::getline(confFile,word,'(');
73 std::vector<std::string> wordBits;
74 CDMUtilities::splitter::split(wordBits,word," (\n",CDMUtilities::splitter::no_empties);
76 if(wordBits[wordBits.size()-1] == "PROJECT")
78 std::getline(confFile,word,')');
79 std::vector<std::string> nameBits;
80 CDMUtilities::splitter::split(nameBits, word, " ", CDMUtilities::splitter::no_empties);
83 for (int i = 0; i < nameBits.size(); i++)
87 this->name += nameBits[i];
93 if(wordBits[wordBits.size()-1] == "SET")
96 std::getline(confFile,word,')');
97 if(word.find("PROJECT_MAJOR_VERSION") != std::string::npos)
99 std::vector<std::string> versionBits;
100 CDMUtilities::splitter::split(versionBits, word, " ", CDMUtilities::splitter::no_empties);
101 version = versionBits[versionBits.size()-1];
103 if(word.find("PROJECT_MINOR_VERSION") != std::string::npos)
105 std::vector<std::string> versionBits;
106 CDMUtilities::splitter::split(versionBits, word, " ", CDMUtilities::splitter::no_empties);
107 version += "." + versionBits[versionBits.size()-1];
109 if(word.find("PROJECT_BUILD_VERSION") != std::string::npos)
111 std::vector<std::string> versionBits;
112 CDMUtilities::splitter::split(versionBits, word, " ", CDMUtilities::splitter::no_empties);
113 version += "." + versionBits[versionBits.size()-1];
116 //get project versionDate
117 if(word.find("PROJECT_VERSION_DATE") != std::string::npos)
119 std::vector<std::string> versionBits;
120 CDMUtilities::splitter::split(versionBits, word, " \"", CDMUtilities::splitter::no_empties);
121 versionDate = versionBits[versionBits.size()-1];
123 //get project buildPath
127 this->buildPath = buildPath;
131 this->buildPath = this->path + "Bin";
137 this->type = wxDIR_DIRS;
140 //TODO: implement method
141 //if appli exist create Appli
143 //if lib exist create Lib
145 //if bbtk_* exist create Packages
150 modelCDMProject::~modelCDMProject()
152 if(this->appli != NULL)
157 if(this->lib != NULL)
162 for (int i = 0; i < this->packages.size(); i++)
164 if(this->packages[i] != NULL)
166 delete this->packages[i];
167 this->packages[i] = NULL;
173 modelCDMProject::GetName() const
179 modelCDMProject::GetVersion() const
181 return this->version;
185 modelCDMProject::GetVersionDate() const
187 return this->versionDate;
191 modelCDMProject::GetBuildPath() const
193 return this->buildPath;
196 bool modelCDMProject::SetVersion(const std::string& version, std::string*& result)
198 //TODO: implement method
202 bool modelCDMProject::SetBuildPath(const std::string& path, std::string*& result)
204 //TODO: implement method
208 bool modelCDMProject::CreatePackage(
209 const std::string& name,
210 std::string*& result,
211 const std::string& authors,
212 const std::string& authorsEmail,
213 const std::string& version,
214 const std::string& description
217 //TODO: implement method
221 bool modelCDMProject::CreateLibrary(
222 const std::string& name,
223 std::string*& result,
224 const std::string& path
227 //TODO: implement method
231 bool modelCDMProject::CreateApplication(
232 const std::string& name,
233 std::string*& result,
234 const std::string& path
237 //TODO: implement method
241 bool modelCDMProject::CreateBlackBox(
242 const std::string& name,
243 const std::string& package,
244 const std::string& authors,
245 const std::string& authorsEmail,
246 const std::string& categories,
247 const std::string& description
250 //TODO: implement method
254 bool modelCDMProject::OpenCMakeListsFile(std::string*& result)
256 //TODO: implement method
260 const bool modelCDMProject::Refresh(std::string*& result)
262 //TODO: implement method
266 bool modelCDMProject::ConfigureBuild(std::string*& result)
268 //TODO: implement method
272 bool modelCDMProject::Build(std::string*& result)
274 //TODO: implement method
278 bool modelCDMProject::Connect(std::string*& result)
280 //TODO: implement method