2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
8 # This software is governed by the CeCILL-B license under French law and
9 # abiding by the rules of distribution of free software. You can use,
10 # modify and/ or redistribute the software under the terms of the CeCILL-B
11 # license as circulated by CEA, CNRS and INRIA at the following URL
12 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
13 # or in the file LICENSE.txt.
15 # As a counterpart to the access to the source code and rights to copy,
16 # modify and redistribute granted by the license, users are provided only
17 # with a limited warranty and the software's author, the holder of the
18 # economic rights, and the successive licensors have only limited
21 # The fact that you are presently reading this means that you have had
22 # knowledge of the CeCILL-B license and that you accept its terms.
23 # ------------------------------------------------------------------------ */
27 * ControlCreaDevManagerProject.cpp
29 * Created on: 5/11/2012
33 #include "ControlCreaDevManagerProject.h"
36 #include <wx/dirdlg.h>
37 #include <stdlib.h> // for getenv
39 ControlCreaDevManagerProject::ControlCreaDevManagerProject()
41 // TODO Auto-generated constructor stub
45 ControlCreaDevManagerProject::~ControlCreaDevManagerProject()
47 // TODO Auto-generated destructor stub
50 bool ControlCreaDevManagerProject::CreateProject(const std::string& name, const std::string& dir, const std::string& author, const std::string& description)
55 std::string command("creaNewProject.bat ");
56 std::string command1("creaSed.exe ");
57 std::string command2("del ");
59 command += "\"" + dir + "\" \"" + name + "\"";
60 command1 += "\"" + dir+"\\"+name+"\\CMakeLists.txt.in\" " + "NameOfTheProject " + name + "> \"" + dir + "\\" + name + "\\CMakeLists.txt\"";
61 command2 += "\"" + dir+"\\"+name+"\\CMakeLists.txt.in\"";
62 if ( ! system ( command.c_str() ) )
64 system ( command1.c_str() );
65 system ( command2.c_str() );
67 // Create a Package at the same time. JPR
68 char *author = author.c_str();
69 std::string nomDirectory = dir + "\\" + name;
70 std::string nomPackageDirectory = nomDirectory + "\\" + "bbtk_" + name + "_PKG";
71 std::string bbCreatePackage("bbCreatePackage ");
72 bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
73 system (bbCreatePackage.c_str());
75 add = "echo ADD_SUBDIRECTORY(bbtk_" + name + "_PKG) >> " + nomDirectory + "/CMakeLists.txt";
78 wxMessageBox(_T("New Project created !"),_T("creaNewProject"), wxOK | wxICON_INFORMATION);
82 wxString err(_T("An error occured while running '"));
83 err += crea::std2wx(command) + _T("'");
84 wxMessageBox(err,_T("creaNewProject"),wxOK | wxICON_ERROR);
88 // ------ LINUX / MacOS
91 std::string command("creaNewProject.sh ");
92 command += "\"" + dir + "\"" +" " + name;
93 std::cout << "executing " << command << std::endl;
94 if ( ! system ( command.c_str() ) )
96 //wxMessageBox(_T("New Project created !"),_T("creaNewProject"), wxOK | wxICON_INFORMATION);
98 std::string nomDirectory = dir + "/" + name;
99 std::string nomPackageDirectory = nomDirectory + "/" + "bbtk_" + name + "_PKG";
101 std::string bbCreatePackage("bbCreatePackage ");
102 bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
103 std::cout << "executing " << bbCreatePackage << std::endl;
104 system (bbCreatePackage.c_str());
107 add = "echo 'ADD_SUBDIRECTORY(bbtk_" + name + "_PKG)' >> " + nomDirectory + "/CMakeLists.txt";
108 //std::cout << add << std::endl;
109 std::cout << "executing " << add << std::endl;
115 wxString err(_T("An error occured while running '"));
116 err += crea::std2wx(command) + _T("'");
117 wxMessageBox(err,_T("creaNewProject"),wxOK | wxICON_ERROR);