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 * ControlCreaDevManagerProject.cpp
32 * Created on: 5/11/2012
36 #include "ControlCreaDevManagerProject.h"
39 #include <wx/dirdlg.h>
40 #include <stdlib.h> // for getenv
42 ControlCreaDevManagerProject::ControlCreaDevManagerProject()
44 // TODO Auto-generated constructor stub
48 ControlCreaDevManagerProject::~ControlCreaDevManagerProject()
50 // TODO Auto-generated destructor stub
53 bool ControlCreaDevManagerProject::CreateProject(const std::string& name, const std::string& dir, const std::string& author, const std::string& description)
58 std::string command("creaNewProject.bat ");
59 std::string command1("creaSed.exe ");
60 std::string command2("del ");
62 command += "\"" + dir + "\" \"" + name + "\"";
63 command1 += "\"" + dir+"\\"+name+"\\CMakeLists.txt.in\" " + "NameOfTheProject " + name + "> \"" + dir + "\\" + name + "\\CMakeLists.txt\"";
64 command2 += "\"" + dir+"\\"+name+"\\CMakeLists.txt.in\"";
65 if ( ! system ( command.c_str() ) )
67 system ( command1.c_str() );
68 system ( command2.c_str() );
70 // Create a Package at the same time. JPR
71 char *author = author.c_str();
72 std::string nomDirectory = dir + "\\" + name;
73 std::string nomPackageDirectory = nomDirectory + "\\" + "bbtk_" + name + "_PKG";
74 std::string bbCreatePackage("bbCreatePackage ");
75 bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
76 system (bbCreatePackage.c_str());
78 add = "echo ADD_SUBDIRECTORY(bbtk_" + name + "_PKG) >> " + nomDirectory + "/CMakeLists.txt";
81 wxMessageBox(_T("New Project created !"),_T("creaNewProject"), wxOK | wxICON_INFORMATION);
85 wxString err(_T("An error occured while running '"));
86 err += crea::std2wx(command) + _T("'");
87 wxMessageBox(err,_T("creaNewProject"),wxOK | wxICON_ERROR);
91 // ------ LINUX / MacOS
94 std::string command("creaNewProject.sh ");
95 command += "\"" + dir + "\"" +" " + name;
96 std::cout << "executing " << command << std::endl;
97 if ( ! system ( command.c_str() ) )
99 //wxMessageBox(_T("New Project created !"),_T("creaNewProject"), wxOK | wxICON_INFORMATION);
101 std::string nomDirectory = dir + "/" + name;
102 std::string nomPackageDirectory = nomDirectory + "/" + "bbtk_" + name + "_PKG";
104 std::string bbCreatePackage("bbCreatePackage ");
105 bbCreatePackage += nomDirectory + " " + name + " " + author + " " + description;
106 std::cout << "executing " << bbCreatePackage << std::endl;
107 system (bbCreatePackage.c_str());
110 add = "echo 'ADD_SUBDIRECTORY(bbtk_" + name + "_PKG)' >> " + nomDirectory + "/CMakeLists.txt";
111 //std::cout << add << std::endl;
112 std::cout << "executing " << add << std::endl;
118 wxString err(_T("An error occured while running '"));
119 err += crea::std2wx(command) + _T("'");
120 wxMessageBox(err,_T("creaNewProject"),wxOK | wxICON_ERROR);