}
}
+
+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;
+}