if(wordBits[0] == "BBTK_PACKAGE_NAME")
{
word = wordBits[1];
- for (int i = 2; i < wordBits.size(); i++)
+ for (int i = 2; i < (int)(wordBits.size()); i++)
{
word += " " + wordBits[i];
}
else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_AUTHOR")
{
word = wordBits[1];
- for (int i = 2; i < wordBits.size(); i++)
+ for (int i = 2; i < (int)(wordBits.size()); i++)
{
word += " " + wordBits[i];
}
else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_DESCRIPTION")
{
word = wordBits[1];
- for (int i = 2; i < wordBits.size(); i++)
+ for (int i = 2; i < (int)(wordBits.size()); i++)
{
word += " " + wordBits[i];
}
std::vector<std::string> words;
CDMUtilities::splitter::split(words, authors, ",\n", CDMUtilities::splitter::no_empties);
std::string authorsReal = words[0];
- for (int i = 1; i < words.size(); i++)
+ for (int i = 1; i < (int)(words.size()); i++)
{
authorsReal += "/" + words[i];
}
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 + "'.");
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 + "'.");
std::vector<std::string> words;
CDMUtilities::splitter::split(words, description, " \n", CDMUtilities::splitter::no_empties);
std::string descriptionReal = words[0];
- for (int i = 1; i < words.size(); i++)
+ for (int i = 1; i < (int)(words.size()); i++)
{
descriptionReal += " " + words[i];
}
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 + "'.");
if(wordBits[0] == "BBTK_PACKAGE_NAME")
{
word = wordBits[1];
- for (int i = 2; i < wordBits.size(); i++)
+ for (int i = 2; i < (int)(wordBits.size()); i++)
{
word += " " + wordBits[i];
}
else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_AUTHOR")
{
word = wordBits[1];
- for (int i = 2; i < wordBits.size(); i++)
+ for (int i = 2; i < (int)(wordBits.size()); i++)
{
word += " " + wordBits[i];
}
else if(wordBits[0] == "${BBTK_PACKAGE_NAME}_DESCRIPTION")
{
word = wordBits[1];
- for (int i = 2; i < wordBits.size(); i++)
+ for (int i = 2; i < (int)(wordBits.size()); i++)
{
word += " " + wordBits[i];
}
//check if folder already exist
bool found = false;
- for (int i = 0; !found && i < this->children.size(); i++)
+ for (int i = 0; !found && i < (int)(this->children.size()); i++)
{
if (this->children[i]->GetName() == stdfileName)
{
else
{
bool found = false;
- for (int i = 0; !found && i < this->children.size(); i++)
+ for (int i = 0; !found && i < (int)(this->children.size()); i++)
{
if (this->children[i]->GetName() == stdfileName)
{
this->src = NULL;
}
- for (int i = 0; i < checked.size(); i++)
+ for (int i = 0; i < (int)(checked.size()); i++)
{
if(!checked[i])
{
{
word = words[0];
CDMUtilities::splitter::split(words, word, " ", CDMUtilities::splitter::empties_ok);
- for (int i = 0; i < words.size(); i++)
+ for (int i = 0; i < (int)(words.size()); i++)
{
if(words[i].substr(0,2) == "//")
break;
}
else if (words[0] == "${BBTK_PACKAGE_NAME}_INCLUDE_DIRS")
{
- for (int i = 1; i < words.size(); i++)
+ for (int i = 1; i < (int)(words.size()); i++)
{
if(words[i].substr(0,2) == "${" || words[i].substr(0,2) == "..")
properties["package " + this->name + " dir " + words[i]] = true;
}
else if (words[0] == "${BBTK_PACKAGE_NAME}_LIBS")
{
- for (int i = 1; i < words.size(); i++)
+ for (int i = 1; i < (int)(words.size()); i++)
{
properties["package " + this->name + " lib " + words[i]] = true;
}
}
}
+
+std::map<std::string, bool> modelCDMPackage::Get3rdPartyLibraries()
+{
+ std::map<std::string, std::string> correspondence;
+ correspondence["${BBTK_PACKAGE_NAME}_USE_VTK"] = "VTK";
+ correspondence["${BBTK_PACKAGE_NAME}_USE_ITK"] = "ITK";
+ correspondence["${BBTK_PACKAGE_NAME}_USE_GDCM"] = "GDCM";
+ correspondence["${BBTK_PACKAGE_NAME}_USE_GDCM_VTK"] = "GDCM_VTK";
+ correspondence["${BBTK_PACKAGE_NAME}_USE_GSMIS"] = "GSMIS";
+ correspondence["${BBTK_PACKAGE_NAME}_USE_WXWIDGETS"] = "WxWidgets";
+ correspondence["${BBTK_PACKAGE_NAME}_USE_KWWIDGETS"] = "KWWidgets";
+ std::map<std::string, bool> res;
+ res["VTK"] = false;
+ res["ITK"] = false;
+ res["GDCM"] = false;
+ res["GDCM_VTK"] = false;
+ res["GSMIS"] = false;
+ res["WxWidgets"] = false;
+ res["KWWidgets"] = false;
+
+ if (this->HasCMakeLists())
+ {
+ CDMUtilities::CMLFile cmlFile = CDMUtilities::readCMLFile(this->CMakeLists->GetPath().c_str());
+ // look at every syntax element
+ for (int i = 0; i < cmlFile.size(); ++i)
+ {
+ // if the element is a command and is a SET command
+ if (cmlFile[i].first == "command" && cmlFile[i].second[0] == "SET")
+ {
+ // search first parameter
+ int pos = 1;
+ while (pos < cmlFile[i].second.size())
+ {
+ if (!isspace(cmlFile[i].second[pos][0]) && cmlFile[i].second[pos][0] != '#' && cmlFile[i].second[pos][0] != '(' && cmlFile[i].second[pos][0] != ')')
+ {
+ break;
+ }
+ pos++;
+ }
+ // if the first parameter is a third party statement
+ if (pos < cmlFile[i].second.size() && correspondence.find(cmlFile[i].second[pos]) != correspondence.end())
+ {
+ std::string foundLibrary = cmlFile[i].second[pos];
+ // search for second parameter
+ pos++;
+ while (pos < cmlFile[i].second.size())
+ {
+ if (!isspace(cmlFile[i].second[pos][0]) && cmlFile[i].second[pos][0] != '#' && cmlFile[i].second[pos][0] != '(' && cmlFile[i].second[pos][0] != ')')
+ {
+ break;
+ }
+ pos++;
+ }
+ // if the second parameter is ON
+ if (pos < cmlFile[i].second.size() && cmlFile[i].second[pos] == "ON")
+ {
+ res[correspondence[foundLibrary]] = true;
+ }
+ }
+ }
+ }
+ }
+ return res;
+}
+
+bool modelCDMPackage::Set3rdPartyLibrary(const std::string& library_name,
+ const bool& toInclude)
+{
+ std::map<std::string, std::string> correspondence;
+
+ correspondence["VTK"] = "${BBTK_PACKAGE_NAME}_USE_VTK";
+ correspondence["ITK"] = "${BBTK_PACKAGE_NAME}_USE_ITK";
+ correspondence["GDCM"] = "${BBTK_PACKAGE_NAME}_USE_GDCM";
+ correspondence["GDCM_VTK"] = "${BBTK_PACKAGE_NAME}_USE_GDCM_VTK";
+ correspondence["GSMIS"] = "${BBTK_PACKAGE_NAME}_USE_GSMIS";
+ correspondence["WxWidgets"] = "${BBTK_PACKAGE_NAME}_USE_WXWIDGETS";
+ correspondence["KWWidgets"] = "${BBTK_PACKAGE_NAME}_USE_KWWIDGETS";
+/*
+ if(correspondence.find(library_name) != correspondence.end())
+ {
+ std::string library_command = correspondence[library_name];
+ if (this->HasCMakeLists())
+ {
+ CDMUtilities::CMLFile cmlFile = CDMUtilities::readCMLFile(this->CMakeLists->GetPath().c_str());
+ bool found = false;
+ // look at every syntax element
+ for (int i = 0; i < cmlFile.size(); ++i)
+ {
+ // if the element is a command and is a SET command
+ if (cmlFile[i].first == "command" && cmlFile[i].second[0] == "SET")
+ {
+ // search first parameter
+ int pos = 1;
+ while (pos < cmlFile[i].second.size())
+ {
+ if (!isspace(cmlFile[i].second[pos][0]) && cmlFile[i].second[pos][0] != '#' && cmlFile[i].second[pos][0] != '(' && cmlFile[i].second[pos][0] != ')')
+ {
+ break;
+ }
+ pos++;
+ }
+ // if the first parameter is a third party statement
+ if (pos < cmlFile[i].second.size() && cmlFile[i].second[pos] == library_command)
+ {
+ std::string foundLibrary = cmlFile[i].second[pos];
+ // search for second parameter
+ pos++;
+ while (pos < cmlFile[i].second.size())
+ {
+ if (!isspace(cmlFile[i].second[pos][0]) && cmlFile[i].second[pos][0] != '#' && cmlFile[i].second[pos][0] != '(' && cmlFile[i].second[pos][0] != ')')
+ {
+ break;
+ }
+ pos++;
+ }
+ // if the second parameter is ON
+ if (pos < cmlFile[i].second.size() && cmlFile[i].second[pos] == "ON")
+ {
+ found = true;
+ if (toInclude)
+ {
+ std::cout << "library already included: " << library_name << std::endl;
+ }
+ else
+ {
+ cmlFile[i].first = "comment";
+ cmlFile[i].second[0] = "#" + cmlFile[i].second[0];
+ std::cout << "library include commented: " << library_name << std::endl;
+ }
+ }
+ else if (pos < cmlFile[i].second.size() && cmlFile[i].second[pos] == "OFF")
+ {
+ found = true;
+ if (toInclude)
+ {
+ cmlFile[i].second[pos] = "ON";
+ std::cout << "library include activated: " << library_name << std::endl;
+ }
+ else
+ {
+ std::cout << "library include already disabled: " << library_name << std::endl;
+ }
+ }
+ }
+ } else if (cmlFile[i].first == "comment") {
+ //TODO: check if it is commented
+ }
+ }
+ }
+ }
+*/
+ return false;
+}
+
+std::map<std::string, bool> modelCDMPackage::GetCustomLibraries()
+{
+ std::map<std::string, bool> res;
+ res["Test"] = false;
+ return res;
+}
+
+bool modelCDMPackage::SetCustomLibrary(const std::string& library_name,
+ const bool& toInclude)
+{
+ return false;
+}