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 # ------------------------------------------------------------------------
30 * wxCDMProjectStructureReportDialog.cpp
32 * Created on: 17/1/2013
33 * Author: Daniel Felipe Gonzalez Obando
36 #include "wxCDMProjectStructureReportDialog.h"
38 #include "creaDevManagerIds.h"
40 #include <wx/html/htmlwin.h>
42 #include "CDMUtilities.h"
44 BEGIN_EVENT_TABLE(wxCDMProjectStructureReportDialog, wxDialog)
45 EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMProjectStructureReportDialog::OnFinish)
48 wxCDMProjectStructureReportDialog::wxCDMProjectStructureReportDialog(
50 const std::map<std::string, bool>& properties,
52 const wxString& caption,
53 const wxPoint& position,
58 this->properties = properties;
59 wxCDMProjectStructureReportDialog::Create(parent, id, caption, position, size, style);
62 wxCDMProjectStructureReportDialog::~wxCDMProjectStructureReportDialog()
66 bool wxCDMProjectStructureReportDialog::Create(
69 const wxString& caption,
70 const wxPoint& position,
75 wxDialog::Create(parent, id, caption, position, size, style);
77 this->CreateControls();
82 void wxCDMProjectStructureReportDialog::CreateControls()
85 wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL);
87 wxHtmlWindow* htmlWindow = new wxHtmlWindow(this, wxID_ANY);
88 htmlWindow->SetPage(this->GetContent());
89 v_sizer1->Add(htmlWindow, 1, wxEXPAND);
90 v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")),0,wxEXPAND);
95 void wxCDMProjectStructureReportDialog::OnFinish(wxCommandEvent& event)
97 this->EndDialog(wxID_CANCEL);
100 wxString wxCDMProjectStructureReportDialog::GetContent()
102 std::map<std::string, bool>::iterator it, it2;
103 std::map<std::string, bool> pkgs;
104 std::map<std::string, bool> libs;
105 std::map<std::string, bool> applis;
106 for (it = this->properties.begin(); it != this->properties.end(); it++)
108 std::cout << it->first << " " << it->second << std::endl;
109 if(it->first.substr(0,7) == "package")
111 std::vector<std::string> words;
112 CDMUtilities::splitter::split(words, it->first, " ", CDMUtilities::splitter::no_empties);
113 pkgs[words[1]] = true;
115 else if(it->first.substr(0,7) == "library")
117 std::vector<std::string> words;
118 CDMUtilities::splitter::split(words, it->first, " ", CDMUtilities::splitter::no_empties);
119 libs[words[1]] = true;
121 else if(it->first.substr(0,11) == "application")
123 std::vector<std::string> words;
124 CDMUtilities::splitter::split(words, it->first, " ", CDMUtilities::splitter::no_empties);
125 applis[words[1]] = true;
128 std::string report = "";
132 " <title>Project Structure Check Report</title>"
135 " <h1>Project Structure Check Report</h1>"
136 " <div id=\"projectChk\">"
137 " <h3>Project CMakeLists.txt</h3>"
139 " Includes the following built-in libraries:"
140 " <font color=\"#00CC00\"><ul>";
141 if(this->properties["project set USE_CREA"])
144 if(this->properties["project set USE_GDCM"])
147 if(this->properties["project set USE_GDCM_VTK"])
149 " <li>GDCM_VTK</li>";
150 if(this->properties["project set USE_GDCM2"])
153 if(this->properties["project set USE_WXWIDGETS"])
155 " <li>wxWidgets</li>";
156 if(this->properties["project set USE_KWWIDGETS"])
158 " <li>kwWidgets</li>";
159 if(this->properties["project set USE_VTK"])
162 if(this->properties["project set USE_ITK"])
165 if(this->properties["project set USE_BOOST"])
172 " Doesn't include the following built-in libraries:"
173 " <font color=\"#AAAA00\"><ul>";
174 if(!this->properties["project set USE_CREA"])
177 if(!this->properties["project set USE_GDCM"])
180 if(!this->properties["project set USE_GDCM_VTK"])
182 " <li>GDCM_VTK</li>";
183 if(!this->properties["project set USE_GDCM2"])
186 if(!this->properties["project set USE_WXWIDGETS"])
188 " <li>wxWidgets</li>";
189 if(!this->properties["project set USE_KWWIDGETS"])
191 " <li>kwWidgets</li>";
192 if(!this->properties["project set USE_VTK"])
195 if(!this->properties["project set USE_ITK"])
198 if(!this->properties["project set USE_BOOST"])
206 " <font color=\"#00CC00\"><ul>";
207 if(this->properties["project add lib"])
210 if(this->properties["project add appli"])
213 for (it = this->properties.begin(); it != this->properties.end(); it++)
215 if(it->second == true && it->first.substr(0,11) == "project add")
217 std::string namePkg = it->first.substr(12);
218 if (namePkg.substr(0,4) == "bbtk")
220 " <li>Package " + namePkg + "</li>";
226 " <p>Doesn't include:"
227 " <font color=\"#FF0000\"><ul>";
228 if(!this->properties["project add lib"])
232 " <blockquote>ADD_SUBDIRECTORY(lib)</blockquote>"
233 " in the project CMakeLists file."
235 if(!this->properties["project add appli"])
239 " <blockquote>ADD_SUBDIRECTORY(appli)</blockquote>"
240 " in the project CMakeLists file."
242 for (it = this->properties.begin(); it != this->properties.end(); it++)
244 if(it->second == false && it->first.substr(0,11) == "project add")
246 std::string namePkg = it->first.substr(12);
249 " Package \"" + namePkg + "\": use"
250 " <blockquote>ADD_SUBDIRECTORY(" + namePkg + ")</blockquote>"
251 " in the project CMakeLists file."
260 for (it = pkgs.begin(); it != pkgs.end(); it++)
263 " <div id=\"package" + it->first + "Chk\">"
264 " <h3>Package " + it->first + " CMakeLists.txt</h3>"
266 " Includes the following built-in libraries:"
267 " <font color=\"#00CC00\"><ul>";
268 if(this->properties["package " + it->first + " set USE_VTK"])
271 if(this->properties["package " + it->first + " set USE_ITK"])
274 if(this->properties["package " + it->first + " set USE_GDCM"])
277 if(this->properties["package " + it->first + " set USE_GDC_VTK"])
279 " <li>GDCM_VTK</li>";
280 if(this->properties["package " + it->first + " set USE_GSMIS"])
283 if(this->properties["package " + it->first + " set USE_WXWIDGETS"])
285 " <li>wxWidgets</li>";
286 if(this->properties["package " + it->first + " set USE_KWWIDGETS"])
288 " <li>kwWidgets</li>";
293 " Doesn't include the following built-in libraries:"
294 " <font color=\"#AAAA00\"><ul>";
295 if(!this->properties["package " + it->first + " set USE_VTK"])
298 if(!this->properties["package " + it->first + " set USE_ITK"])
301 if(!this->properties["package " + it->first + " set USE_GDCM"])
304 if(!this->properties["package " + it->first + " set USE_GDC_VTK"])
306 " <li>GDCM_VTK</li>";
307 if(!this->properties["package " + it->first + " set USE_GSMIS"])
310 if(!this->properties["package " + it->first + " set USE_WXWIDGETS"])
312 " <li>wxWidgets</li>";
313 if(!this->properties["package " + it->first + " set USE_KWWIDGETS"])
315 " <li>kwWidgets</li>";
320 " Includes the following additional directories:"
321 " <font color=\"#00CC00\"><ul>";
322 for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++)
324 std::string pkgname = "package " + it->first + " dir";
325 if(it2->first.substr(0,pkgname.size()) == pkgname)
327 std::string directoryName = it2->first.substr(pkgname.size()+1);
329 " <li>" + directoryName + "</li>";
336 " Includes the following libraries:"
337 " <font color=\"#00CC00\"><ul>";
338 for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++)
340 std::string pkgname = "package " + it->first + " lib";
341 if(it2->first.substr(0,pkgname.size()) == pkgname)
343 std::string libraryName = it2->first.substr(pkgname.size()+1);
345 " <li>" + libraryName + "</li>";
352 " <strong>Note:</strong><br>"
353 " Please include the following lines in the package CMakeLists file in order to add a library:<br>"
354 " - In section <strong>SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS</strong> use:"
356 " ../lib/[libraryFolderName]"
358 " - In section <strong>SET(${BBTK_PACKAGE_NAME}_LIBS</strong> use:"
366 " <div id=\"libChk\">"
367 " <h3>Lib CMakeLists.txt</h3>"
369 " Includes libraries:"
370 " <font color=\"#00CC00\"><ul>";
371 for (it = this->properties.begin(); it != this->properties.end(); it++)
373 if(it->second == true && it->first.substr(0, 7) == "lib add")
375 std::string nameLib = it->first.substr(8);
377 " <li>" + nameLib + "</li>";
383 " <p>Doesn't include libraries:"
384 " <font color=\"#FF0000\"><ul>";
385 for (it = this->properties.begin(); it != this->properties.end(); it++)
387 if(it->second == false && it->first.substr(0, 7) == "lib add")
389 std::string nameLib = it->first.substr(8);
391 " <li>" + nameLib + "</li>";
398 " <strong>Note:</strong><br>"
399 " Please include the following lines in the lib CMakeLists file in order to add a library:"
400 " <blockquote>ADD_SUBDIRECTORY([libraryName])</blockquote>"
403 for (it = libs.begin(); it != libs.end(); it++)
406 " <div id=\"library" + it->first + "Chk\">"
407 " <h3>Library " + it->first + " CMakeLists.txt</h3>"
409 " Includes the following libraries:"
410 " <font color=\"#00CC00\"><ul>";
411 for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++)
413 std::string libname = "library " + it->first + " lib";
414 if(it2->second == true && it2->first.substr(0,libname.size()) == libname)
416 std::string libraryName = it2->first.substr(libname.size()+1);
418 " <li>" + libraryName + "</li>";
425 " Doesn't include the following libraries:"
426 " <font color=\"#AAAA00\"><ul>";
427 for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++)
429 std::string libname = "library " + it->first + " lib";
430 if(it2->second == false && it2->first.substr(0,libname.size()) == libname)
432 std::string libraryName = it2->first.substr(libname.size()+1);
434 " <li>" + libraryName + "</li>";
441 " <strong>Note:</strong><br>"
442 " Please include the following line in the library CMakeLists file in order to add a library:"
443 " <blockquote>[libraryName]</blockquote>"
444 " on <strong>SET ( ${LIBRARY_NAME}_LINK_LIBRARIES</strong> section if needed."
449 " <div id=\"appliChk\">"
450 " <h3>Appli CMakeLists.txt</h3>"
452 " Includes applications:"
453 " <font color=\"#00CC00\"><ul>";
454 for (it = this->properties.begin(); it != this->properties.end(); it++)
456 if(it->second == true && it->first.substr(0, 9) == "appli add")
458 std::string nameAppli = it->first.substr(10);
460 " <li>" + nameAppli + "</li>";
466 " <p>Doesn't include applications:"
467 " <font color=\"#FF0000\"><ul>";
468 for (it = this->properties.begin(); it != this->properties.end(); it++)
470 if(it->second == false && it->first.substr(0, 9) == "appli add")
472 std::string nameAppli = it->first.substr(10);
474 " <li>" + nameAppli + "</li>";
481 " <strong>Note:</strong><br>"
482 " Please include the following lines in the appli CMakeLists file in order to add an application:"
483 " <blockquote>ADD_SUBDIRECTORY([applicationName])</blockquote>"
486 for (it = applis.begin(); it != applis.end(); it++)
489 " <div id=\"application" + it->first + "Chk\">"
490 " <h3>Application " + it->first + " CMakeLists.txt</h3>"
492 " Includes the following libraries:"
493 " <font color=\"#00CC00\"><ul>";
494 for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++)
496 std::string appliname = "application " + it->first + " dir";
497 if(it2->second && it2->first.substr(0,appliname.size()) == appliname)
499 std::string directoryName = it2->first.substr(appliname.size()+1);
501 " <li>" + directoryName + "</li>";
508 " Includes the following libraries:"
509 " <font color=\"#00CC00\"><ul>";
510 for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++)
512 std::string appliname = "application " + it->first + " lib";
513 if(it2->second && it2->first.substr(0,appliname.size()) == appliname)
515 std::string libraryName = it2->first.substr(appliname.size()+1);
517 " <li>" + libraryName + "</li>";
524 " Doesn't include the following libraries:"
525 " <font color=\"#AAAA00\"><ul>";
526 for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++)
528 std::string appliname = "application " + it->first + " lib";
529 if(it2->second == false && it2->first.substr(0,appliname.size()) == appliname)
531 std::string libraryName = it2->first.substr(appliname.size()+1);
533 " <li>" + libraryName + "</li>";
540 " <strong>Note:</strong><br>"
541 " Please include the following lines in the application CMakeLists file in order to add a library:<br>"
542 " - In section <strong>INCLUDE_DIRECTORIES(</strong> use:"
544 " ../lib/[libraryFolderName]"
546 " - In section <strong>SET(${EXE_NAME}_LINK_LIBRARIES</strong> use:"
557 return crea::std2wx(report);