diff --git a/applications/projects/SceneChecking/CMakeLists.txt b/applications/projects/SceneChecking/CMakeLists.txt index f4ce6b70cab..eff291e4ce0 100644 --- a/applications/projects/SceneChecking/CMakeLists.txt +++ b/applications/projects/SceneChecking/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.22) project(SceneChecking LANGUAGES CXX) +option(SOFA_SCENECHECKING_WARNINGS_ARE_ERRORS "Consider SceneChecking warnings as errors." OFF) + find_package(Sofa.Config REQUIRED) sofa_find_package(Sofa.Simulation.Core REQUIRED) sofa_find_package(Sofa.Component.SceneUtility REQUIRED) diff --git a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionPipelineAndModels.cpp b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionPipelineAndModels.cpp index fad0c9e50d3..9b012c6e97d 100644 --- a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionPipelineAndModels.cpp +++ b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionPipelineAndModels.cpp @@ -96,7 +96,7 @@ void SceneCheckCollisionPipelineAndModels::doPrintSummary() { if(!m_message.empty()) { - msg_warning(this->getName()) << m_message; + scnchecking_warning(this->getName()) << m_message; } } diff --git a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionResponse.cpp b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionResponse.cpp index 687eec987c3..7c5494c85a2 100644 --- a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionResponse.cpp +++ b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckCollisionResponse.cpp @@ -144,7 +144,7 @@ void SceneCheckCollisionResponse::doPrintSummary() { if(m_checkDone && m_message.str()!= "") { - msg_warning(this->getName()) << m_message.str(); + scnchecking_warning(this->getName()) << m_message.str(); } } diff --git a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckDuplicatedName.cpp b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckDuplicatedName.cpp index 78e032f1e27..a5b7924106c 100644 --- a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckDuplicatedName.cpp +++ b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckDuplicatedName.cpp @@ -86,7 +86,7 @@ void SceneCheckDuplicatedName::doPrintSummary() { if(m_hasDuplicates) { - msg_warning(this->getName()) << msgendl + scnchecking_warning(this->getName()) << msgendl << m_duplicatedMsg.str() << "Nodes with similar names at the same level in your scene can " "crash certain operations, please rename them"; diff --git a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckEmptyNodeName.cpp b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckEmptyNodeName.cpp index 96eaa647c59..75774659bf2 100644 --- a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckEmptyNodeName.cpp +++ b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckEmptyNodeName.cpp @@ -50,8 +50,11 @@ void SceneCheckEmptyNodeName::doCheckOn(sofa::simulation::Node* node) void SceneCheckEmptyNodeName::doPrintSummary() { - msg_warning_when(m_nbNodesWithEmptyName > 0, getName()) << "Nodes with empty name are found in" - " the scene. This can lead to undefined behaviors. It is recommended to give a name to all Nodes."; + if (m_nbNodesWithEmptyName > 0) + { + scnchecking_warning(getName()) << "Nodes with empty name are found in" + " the scene. This can lead to undefined behaviors. It is recommended to give a name to all Nodes."; + } } -} // namespace sofa::scenechecking \ No newline at end of file +} // namespace sofa::scenechecking diff --git a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckMissingRequiredPlugin.cpp b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckMissingRequiredPlugin.cpp index 1f75b7b65a9..8242fe3705e 100644 --- a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckMissingRequiredPlugin.cpp +++ b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckMissingRequiredPlugin.cpp @@ -95,7 +95,7 @@ void SceneCheckMissingRequiredPlugin::printSummary(simulation::SceneLoader* scen { tmp << "Note that XML syntax is assumed in the suggested lines to add."; } - msg_warning(this->getName()) + scnchecking_warning(this->getName()) << "This scene is using component defined in plugins but is not importing the required plugins." << msgendl << indent << "Your scene may not work on a sofa environment with different pre-loaded plugins." << msgendl << indent << "To fix your scene and remove this warning you just need to cut & paste the following lines at the beginning of your scene: " << msgendl diff --git a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckUsingAlias.cpp b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckUsingAlias.cpp index cde238845e9..a94e895a5cc 100644 --- a/applications/projects/SceneChecking/src/SceneChecking/SceneCheckUsingAlias.cpp +++ b/applications/projects/SceneChecking/src/SceneChecking/SceneCheckUsingAlias.cpp @@ -99,7 +99,7 @@ void SceneCheckUsingAlias::doPrintSummary() if(i.first != m_componentsCreatedUsingAlias.rbegin()->first) usingAliasesWarning << msgendl; } - msg_warning(this->getName()) << usingAliasesWarning.str(); + scnchecking_warning(this->getName()) << usingAliasesWarning.str(); m_componentsCreatedUsingAlias.clear(); } diff --git a/applications/projects/SceneChecking/src/SceneChecking/config.h.in b/applications/projects/SceneChecking/src/SceneChecking/config.h.in index f246ef32f8a..90c211d024e 100644 --- a/applications/projects/SceneChecking/src/SceneChecking/config.h.in +++ b/applications/projects/SceneChecking/src/SceneChecking/config.h.in @@ -34,3 +34,11 @@ namespace sofa::scenechecking constexpr const char* MODULE_NAME = "@PROJECT_NAME@"; constexpr const char* MODULE_VERSION = "@PROJECT_VERSION@"; } // namespace sofa::scenechecking + +#cmakedefine SOFA_SCENECHECKING_WARNINGS_ARE_ERRORS + +#if defined(SOFA_SCENECHECKING_WARNINGS_ARE_ERRORS) + #define scnchecking_warning msg_error +#else + #define scnchecking_warning msg_warning +#endif