X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FmodelCDMProject.cpp;h=8b93e189a2f3decab2cad2de0d9906fe3332d5bb;hb=327c33758d25e6ff1f90f9ab74ea219eaed934a9;hp=2996910dc4711d9f2b40a215b04ac443e561c895;hpb=eed967098aa87503c59d09c8d5c0dc87485698e2;p=crea.git diff --git a/lib/creaDevManagerLib/modelCDMProject.cpp b/lib/creaDevManagerLib/modelCDMProject.cpp index 2996910..8b93e18 100644 --- a/lib/creaDevManagerLib/modelCDMProject.cpp +++ b/lib/creaDevManagerLib/modelCDMProject.cpp @@ -301,7 +301,11 @@ bool modelCDMProject::SetVersion(const std::string& version, std::string*& resul in.close(); out.close(); //delete old file and rename new file +#ifdef _WIN32 + std::string renameCommand = "move /Y \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#else std::string renameCommand = "mv \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt.tmp\" \"" + this->path + CDMUtilities::SLASH + "CMakeLists.txt\""; +#endif if(system(renameCommand.c_str())) { result = new std::string("An error occurred while running '" + renameCommand + "'."); @@ -373,7 +377,11 @@ modelCDMIProjectTreeNode* modelCDMProject::CreatePackage( //call project to create package : use bbCreatePackage [author] [description] std::string creationCommand = "bbCreatePackage \"" + this->path + "\" \"" + nameFixed + "\" \"" + authorFixed + "\" \"" + descriptionFixed + "\""; //TODO: bbCreatePackage script always returning 0. It should return 1 or greater if any error - if(system(creationCommand.c_str())) + bool resultCommand = 0 != system(creationCommand.c_str()); +#ifdef _WIN32 + resultCommand = false; +#endif + if(resultCommand) { result = new std::string("An error occurred while running '" + creationCommand + "'."); return NULL; @@ -684,6 +692,13 @@ bool modelCDMProject::ConfigureBuild(std::string*& result) //TODO: adjust for windows and mac #ifdef _WIN32 // ------ Windows + if(0 == system("cmake-gui")) + return true; + else + { + result = new std::string("There was an error opening cmake-gui. Please make sure it's installed and that cmake's bin folder is in the system path."); + return false; + } #elif __APPLE__ // ------ Apple #else @@ -723,6 +738,17 @@ bool modelCDMProject::Build(std::string*& result, const std::string& line) //TODO: adjust for windows and mac #ifdef _WIN32 // ------ Windows + //\\..\\IDE\\VCExpress.exe \"" + this->buildPath + CDMUtilities::SLASH + this->nameProject + ".sln\" +// std::string command = "\"" + std::string(getenv("VS90COMNTOOLS")) + "..\\IDE\\VCExpress.exe\" \"" + this->buildPath + CDMUtilities::SLASH + this->nameProject + ".sln\" &"; + std::string command = "\"\"%VS90COMNTOOLS%..\\IDE\\VCExpress.exe\" \"" + this->buildPath + CDMUtilities::SLASH + this->nameProject + ".sln\" &\""; + command = "start cmd.exe /k " + command + " &"; + if(0 == system(command.c_str())) + return true; + else + { + result = new std::string("An error has happened running: \"" + command + "\". Please make sure to have visual c++ express installed and to have the VS90COMNTOOLS environment variable set."); + return false; + } #elif __APPLE__ // ------ Apple #else @@ -768,22 +794,41 @@ bool modelCDMProject::Build(std::string*& result, const std::string& line) return true; } -bool modelCDMProject::Connect(std::string*& result) +bool modelCDMProject::Connect(std::string*& result, const std::string& folder) { - //TODO: adjust for windows and mac + //TODO: adjust for mac #ifdef _WIN32 // ------ Windows + //open binary folder + wxDir dir(crea::std2wx(folder)); + + //if binary folder can't be opened then return false + if (!dir.IsOpened()) + { + result = new std::string("The path could not be opened. Make sure the folder exists and contains a bbtkPackage file."); + return false; + } + //create plug command + std::string plugComm = "bbPlugPackage \"" + folder + "\""; + std::cout << "executing '" << plugComm << "'" << std::endl; + //execute plug command + if(system(std::string("start cmd.exe /k \"" + plugComm + "\"").c_str())) + { + //if there was an error then report it + result = new std::string("There was an error plugging the packages of the project, please check the console to read more about the problem."); + return false; + } #elif __APPLE__ // ------ Apple #else // ------ Linux //open binary folder - wxDir dir(crea::std2wx((this->buildPath).c_str())); + wxDir dir(crea::std2wx(folder)); //if binary folder can't be opened then return false if (!dir.IsOpened()) { - result = new std::string("The build path could not be opened. Make sure to configure the project before compiling it"); + result = new std::string("The path could not be opened. Make sure the folder exists and contains a bbtkPackage file."); return false; } //create plug command @@ -793,7 +838,7 @@ bool modelCDMProject::Connect(std::string*& result) if(system(plugComm.c_str())) { //if there was an error then report it - result = new std::string("There was an error plugging the packages of the project, please check the console to read more about the problem."); + result = new std::string("There was an error plugging the packages of the project, please check the plugging.log in the build folder file to read more about the problem."); return false; } #endif