/* # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image # pour la Sant�) # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton # Previous Authors : Laurent Guigues, Jean-Pierre Roux # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil # # This software is governed by the CeCILL-B license under French law and # abiding by the rules of distribution of free software. You can use, # modify and/ or redistribute the software under the terms of the CeCILL-B # license as circulated by CEA, CNRS and INRIA at the following URL # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # or in the file LICENSE.txt. # # As a counterpart to the access to the source code and rights to copy, # modify and redistribute granted by the license, users are provided only # with a limited warranty and the software's author, the holder of the # economic rights, and the successive licensors have only limited # liability. # # The fact that you are presently reading this means that you have had # knowledge of the CeCILL-B license and that you accept its terms. # ------------------------------------------------------------------------ */ /* * wxCDMProjectStructureReportDialog.cpp * * Created on: 17/1/2013 * Author: Daniel Felipe Gonzalez Obando */ #include "wxCDMProjectStructureReportDialog.h" #include "creaDevManagerIds.h" #include #include #include "CDMUtilities.h" BEGIN_EVENT_TABLE(wxCDMProjectStructureReportDialog, wxDialog) EVT_BUTTON(ID_BUTTON_CANCEL, wxCDMProjectStructureReportDialog::OnFinish) END_EVENT_TABLE() wxCDMProjectStructureReportDialog::wxCDMProjectStructureReportDialog( wxWindow* parent, const std::map& properties, wxWindowID id, const wxString& caption, const wxPoint& position, const wxSize& size, long style ) { this->properties = properties; wxCDMProjectStructureReportDialog::Create(parent, id, caption, position, size, style); } wxCDMProjectStructureReportDialog::~wxCDMProjectStructureReportDialog() { } bool wxCDMProjectStructureReportDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& position, const wxSize& size, long int style ) { wxDialog::Create(parent, id, caption, position, size, style); this->CreateControls(); return TRUE; } void wxCDMProjectStructureReportDialog::CreateControls() { wxBoxSizer* v_sizer1 = new wxBoxSizer(wxVERTICAL); wxHtmlWindow* htmlWindow = new wxHtmlWindow(this, wxID_ANY); htmlWindow->SetPage(this->GetContent()); v_sizer1->Add(htmlWindow, 1, wxEXPAND); v_sizer1->Add(new wxButton(this, ID_BUTTON_CANCEL, wxT("Close")),0,wxEXPAND); SetSizer(v_sizer1); } void wxCDMProjectStructureReportDialog::OnFinish(wxCommandEvent& event) { this->EndDialog(wxID_CANCEL); } wxString wxCDMProjectStructureReportDialog::GetContent() { std::map::iterator it, it2; std::map pkgs; std::map libs; std::map applis; for (it = this->properties.begin(); it != this->properties.end(); it++) { std::cout << it->first << " " << it->second << std::endl; if(it->first.substr(0,7) == "package") { std::vector words; CDMUtilities::splitter::split(words, it->first, " ", CDMUtilities::splitter::no_empties); pkgs[words[1]] = true; } else if(it->first.substr(0,7) == "library") { std::vector words; CDMUtilities::splitter::split(words, it->first, " ", CDMUtilities::splitter::no_empties); libs[words[1]] = true; } else if(it->first.substr(0,11) == "application") { std::vector words; CDMUtilities::splitter::split(words, it->first, " ", CDMUtilities::splitter::no_empties); applis[words[1]] = true; } } std::string report = ""; report += "" "" " Project Structure Check Report" "" "" "

Project Structure Check Report

" "
" "

Project CMakeLists.txt

" "

" " Includes the following built-in libraries:" "

    "; if(this->properties["project set USE_CREA"]) report += "
  • Crea
  • "; if(this->properties["project set USE_GDCM"]) report += "
  • GDCM
  • "; if(this->properties["project set USE_GDCM_VTK"]) report += "
  • GDCM_VTK
  • "; if(this->properties["project set USE_GDCM2"]) report += "
  • GDCM2
  • "; if(this->properties["project set USE_WXWIDGETS"]) report += "
  • wxWidgets
  • "; if(this->properties["project set USE_KWWIDGETS"]) report += "
  • kwWidgets
  • "; if(this->properties["project set USE_VTK"]) report += "
  • VTK
  • "; if(this->properties["project set USE_ITK"]) report += "
  • ITK
  • "; if(this->properties["project set USE_BOOST"]) report += "
  • Boost
  • "; report+= "
" "

" "

" " Doesn't include the following built-in libraries:" "

    "; if(!this->properties["project set USE_CREA"]) report += "
  • Crea
  • "; if(!this->properties["project set USE_GDCM"]) report += "
  • GDCM
  • "; if(!this->properties["project set USE_GDCM_VTK"]) report += "
  • GDCM_VTK
  • "; if(!this->properties["project set USE_GDCM2"]) report += "
  • GDCM2
  • "; if(!this->properties["project set USE_WXWIDGETS"]) report += "
  • wxWidgets
  • "; if(!this->properties["project set USE_KWWIDGETS"]) report += "
  • kwWidgets
  • "; if(!this->properties["project set USE_VTK"]) report += "
  • VTK
  • "; if(!this->properties["project set USE_ITK"]) report += "
  • ITK
  • "; if(!this->properties["project set USE_BOOST"]) report += "
  • Boost
  • "; report+= "
" "

" "

" " Includes:" "

    "; if(this->properties["project add lib"]) report += "
  • Lib
  • "; if(this->properties["project add appli"]) report += "
  • Appli
  • "; for (it = this->properties.begin(); it != this->properties.end(); it++) { if(it->second == true && it->first.substr(0,11) == "project add") { std::string namePkg = it->first.substr(12); if (namePkg.substr(0,4) == "bbtk") report += "
  • Package " + namePkg + "
  • "; } } report+= "
" "

" "

Doesn't include:" "

    "; if(!this->properties["project add lib"]) report += "
  • " " Lib: use" "
    ADD_SUBDIRECTORY(lib)
    " " in the project CMakeLists file." "
  • "; if(!this->properties["project add appli"]) report += "
  • " " Appli: use" "
    ADD_SUBDIRECTORY(appli)
    " " in the project CMakeLists file." "
  • "; for (it = this->properties.begin(); it != this->properties.end(); it++) { if(it->second == false && it->first.substr(0,11) == "project add") { std::string namePkg = it->first.substr(12); report += "
  • " " Package \"" + namePkg + "\": use" "
    ADD_SUBDIRECTORY(" + namePkg + ")
    " " in the project CMakeLists file." "
  • "; } } report+= "
" "

" "
"; for (it = pkgs.begin(); it != pkgs.end(); it++) { report += "
first + "Chk\">" "

Package " + it->first + " CMakeLists.txt

" "

" " Includes the following built-in libraries:" "

    "; if(this->properties["package " + it->first + " set USE_VTK"]) report += "
  • VTK
  • "; if(this->properties["package " + it->first + " set USE_ITK"]) report += "
  • ITK
  • "; if(this->properties["package " + it->first + " set USE_GDCM"]) report += "
  • GDCM
  • "; if(this->properties["package " + it->first + " set USE_GDC_VTK"]) report += "
  • GDCM_VTK
  • "; if(this->properties["package " + it->first + " set USE_GSMIS"]) report += "
  • GSMIS
  • "; if(this->properties["package " + it->first + " set USE_WXWIDGETS"]) report += "
  • wxWidgets
  • "; if(this->properties["package " + it->first + " set USE_KWWIDGETS"]) report += "
  • kwWidgets
  • "; report += "
" "

" "

" " Doesn't include the following built-in libraries:" "

    "; if(!this->properties["package " + it->first + " set USE_VTK"]) report += "
  • VTK
  • "; if(!this->properties["package " + it->first + " set USE_ITK"]) report += "
  • ITK
  • "; if(!this->properties["package " + it->first + " set USE_GDCM"]) report += "
  • GDCM
  • "; if(!this->properties["package " + it->first + " set USE_GDC_VTK"]) report += "
  • GDCM_VTK
  • "; if(!this->properties["package " + it->first + " set USE_GSMIS"]) report += "
  • GSMIS
  • "; if(!this->properties["package " + it->first + " set USE_WXWIDGETS"]) report += "
  • wxWidgets
  • "; if(!this->properties["package " + it->first + " set USE_KWWIDGETS"]) report += "
  • kwWidgets
  • "; report += "
" "

" "

" " Includes the following additional directories:" "

    "; for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) { std::string pkgname = "package " + it->first + " dir"; if(it2->first.substr(0,pkgname.size()) == pkgname) { std::string directoryName = it2->first.substr(pkgname.size()+1); report += "
  • " + directoryName + "
  • "; } } report += "
" "

" "

" " Includes the following libraries:" "

    "; for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) { std::string pkgname = "package " + it->first + " lib"; if(it2->first.substr(0,pkgname.size()) == pkgname) { std::string libraryName = it2->first.substr(pkgname.size()+1); report += "
  • " + libraryName + "
  • "; } } report += "
" "

" "

" " Note:
" " Please include the following lines in the package CMakeLists file in order to add a library:
" " - In section SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS use:" "

" " ../lib/[libraryFolderName]" "
" " - In section SET(${BBTK_PACKAGE_NAME}_LIBS use:" "
" " [libraryName]" "
" "

" "
"; } report += "
" "

Lib CMakeLists.txt

" "

" " Includes libraries:" "

    "; for (it = this->properties.begin(); it != this->properties.end(); it++) { if(it->second == true && it->first.substr(0, 7) == "lib add") { std::string nameLib = it->first.substr(8); report += "
  • " + nameLib + "
  • "; } } report += "
" "

" "

Doesn't include libraries:" "

    "; for (it = this->properties.begin(); it != this->properties.end(); it++) { if(it->second == false && it->first.substr(0, 7) == "lib add") { std::string nameLib = it->first.substr(8); report += "
  • " + nameLib + "
  • "; } } report += "
" "

" "

" " Note:
" " Please include the following lines in the lib CMakeLists file in order to add a library:" "

ADD_SUBDIRECTORY([libraryName])
" "

" "
"; for (it = libs.begin(); it != libs.end(); it++) { report += "
first + "Chk\">" "

Library " + it->first + " CMakeLists.txt

" "

" " Includes the following libraries:" "

    "; for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) { std::string libname = "library " + it->first + " lib"; if(it2->second == true && it2->first.substr(0,libname.size()) == libname) { std::string libraryName = it2->first.substr(libname.size()+1); report += "
  • " + libraryName + "
  • "; } } report += "
" "

" "

" " Doesn't include the following libraries:" "

    "; for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) { std::string libname = "library " + it->first + " lib"; if(it2->second == false && it2->first.substr(0,libname.size()) == libname) { std::string libraryName = it2->first.substr(libname.size()+1); report += "
  • " + libraryName + "
  • "; } } report += "
" "

" "

" " Note:
" " Please include the following line in the library CMakeLists file in order to add a library:" "

[libraryName]
" " on SET ( ${LIBRARY_NAME}_LINK_LIBRARIES section if needed." "

" "
"; } report += "
" "

Appli CMakeLists.txt

" "

" " Includes applications:" "

    "; for (it = this->properties.begin(); it != this->properties.end(); it++) { if(it->second == true && it->first.substr(0, 9) == "appli add") { std::string nameAppli = it->first.substr(10); report += "
  • " + nameAppli + "
  • "; } } report += "
" "

" "

Doesn't include applications:" "

    "; for (it = this->properties.begin(); it != this->properties.end(); it++) { if(it->second == false && it->first.substr(0, 9) == "appli add") { std::string nameAppli = it->first.substr(10); report += "
  • " + nameAppli + "
  • "; } } report += "
" "

" "

" " Note:
" " Please include the following lines in the appli CMakeLists file in order to add an application:" "

ADD_SUBDIRECTORY([applicationName])
" "

" "
"; for (it = applis.begin(); it != applis.end(); it++) { report += "
first + "Chk\">" "

Application " + it->first + " CMakeLists.txt

" "

" " Includes the following libraries:" "

    "; for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) { std::string appliname = "application " + it->first + " dir"; if(it2->second && it2->first.substr(0,appliname.size()) == appliname) { std::string directoryName = it2->first.substr(appliname.size()+1); report += "
  • " + directoryName + "
  • "; } } report += "
" "

" "

" " Includes the following libraries:" "

    "; for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) { std::string appliname = "application " + it->first + " lib"; if(it2->second && it2->first.substr(0,appliname.size()) == appliname) { std::string libraryName = it2->first.substr(appliname.size()+1); report += "
  • " + libraryName + "
  • "; } } report += "
" "

" "

" " Doesn't include the following libraries:" "

    "; for (it2 = this->properties.begin(); it2 != this->properties.end(); it2++) { std::string appliname = "application " + it->first + " lib"; if(it2->second == false && it2->first.substr(0,appliname.size()) == appliname) { std::string libraryName = it2->first.substr(appliname.size()+1); report += "
  • " + libraryName + "
  • "; } } report += "
" "

" "

" " Note:
" " Please include the following lines in the application CMakeLists file in order to add a library:
" " - In section INCLUDE_DIRECTORIES( use:" "

" " ../lib/[libraryFolderName]" "
" " - In section SET(${EXE_NAME}_LINK_LIBRARIES use:" "
" " [libraryName]" "
" "

" "
"; } report += "" "" ; return crea::std2wx(report); }