Skip to content

Commit 47eeb55

Browse files
authored
remove xerces validator from OMSimulator (#1543)
* update 3rdParty
1 parent acb56d9 commit 47eeb55

9 files changed

Lines changed: 24 additions & 1282 deletions

File tree

3rdParty

src/OMSimulatorLib/CMakeLists.txt

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ set(OMSIMULATORLIB_SOURCES
6060
SystemSC.cpp
6161
SystemWC.cpp
6262
Values.cpp
63-
Variable.cpp
64-
whereami.c
65-
XercesValidator.cpp)
63+
Variable.cpp)
6664

6765
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/Version.cpp" @ONLY)
6866
list(APPEND OMSIMULATORLIB_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/Version.cpp")
@@ -84,7 +82,6 @@ target_link_libraries(OMSimulatorLib
8482
oms::3rd::lua
8583
oms::3rd::pugixml::header
8684
oms::3rd::json::header
87-
oms::3rd::xerces
8885
oms::3rd::ctpl::header)
8986

9087
target_link_libraries(OMSimulatorLib PUBLIC ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
@@ -116,7 +113,6 @@ target_link_libraries(OMSimulatorLib_static
116113
oms::3rd::lua
117114
oms::3rd::pugixml::header
118115
oms::3rd::json::header
119-
oms::3rd::xerces
120116
oms::3rd::ctpl::header)
121117

122118
target_link_libraries(OMSimulatorLib_static PUBLIC ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
@@ -126,27 +122,27 @@ if(MINGW)
126122
endif()
127123

128124
## copy dependent DLL's for mingw artifacts
129-
if(ICU_FOUND)
130-
message(STATUS "ICU_LIBRARIES_FOUND: ${ICU_LIBRARIES}")
131-
if (MINGW)
132-
list(GET ICU_LIBRARIES 0 ICU_PATH)
133-
get_filename_component(DLL_DIR "${ICU_PATH}/../../bin" ABSOLUTE)
134-
message(STATUS "DLL_DIR: ${DLL_DIR}")
135-
# collect all DLLs matching the pattern
136-
file(GLOB DLL_LIST
137-
"${DLL_DIR}/libicuuc*.dll"
138-
"${DLL_DIR}/libicudt*.dll"
139-
"${DLL_DIR}/libstdc++*.dll"
140-
"${DLL_DIR}/libwinpthread*.dll"
141-
"${DLL_DIR}/libgcc_*.dll")
142-
# Check if the DLL_LIST is not empty before installing
143-
if (DLL_LIST)
144-
# Install the files from the list to the 'bin' directory
145-
install(FILES ${DLL_LIST} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
146-
message(STATUS "Copied files from: ${DLL_LIST} to ${CMAKE_INSTALL_PREFIX}/bin")
147-
else()
148-
message(WARNING "No DLLs found matching the pattern")
149-
endif()
125+
if (MINGW)
126+
# Extract compiler path (g++ path)
127+
get_filename_component(COMPILER_DIR "${CMAKE_CXX_COMPILER}" DIRECTORY)
128+
129+
# MinGW DLLs are usually in the same directory
130+
set(MINGW_BIN_DIR "${COMPILER_DIR}")
131+
132+
message(STATUS "Detected MinGW bin directory: ${MINGW_BIN_DIR}")
133+
134+
file(GLOB DLL_LIST
135+
"${MINGW_BIN_DIR}/libstdc++*.dll"
136+
"${MINGW_BIN_DIR}/libwinpthread*.dll"
137+
"${MINGW_BIN_DIR}/libgcc_*.dll"
138+
)
139+
# Check if the DLL_LIST is not empty before installing
140+
if (DLL_LIST)
141+
# Install the files from the list to the 'bin' directory
142+
install(FILES ${DLL_LIST} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
143+
message(STATUS "Copied files from: ${DLL_LIST} to ${CMAKE_INSTALL_PREFIX}/bin")
144+
else()
145+
message(WARNING "No DLLs found matching the pattern")
150146
endif()
151147
endif()
152148

src/OMSimulatorLib/Scope.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
*/
3131

3232
#include "Scope.h"
33-
#include "XercesValidator.h"
3433
#include "Flags.h"
3534
#include "System.h"
3635
#include "Component.h"
@@ -197,9 +196,6 @@ oms_status_enu_t oms::Scope::importModel(const std::string& filename, char** _cr
197196
if (!systemStructure)
198197
return logError("failed to extract \"SystemStructure.ssd\" from \"" + std::string(filename) + "\"");
199198

200-
XercesValidator xercesValidator;
201-
xercesValidator.validateSSP(systemStructure, filename);
202-
203199
Snapshot snapshot;
204200
oms_status_enu_t status = snapshot.importResourceMemory("SystemStructure.ssd", systemStructure);
205201
::miniunz_free(systemStructure);

src/OMSimulatorLib/Values.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "Logging.h"
3636
#include "ssd/Tags.h"
3737
#include "Util.h"
38-
#include "XercesValidator.h"
3938

4039
#include <iostream>
4140
#include <map>
@@ -865,14 +864,6 @@ oms_status_enu_t oms::Values::importFromSnapshot(const pugi::xml_node& node, con
865864
std::string ssvFile = parameterBindingNode.attribute("source").as_string();
866865
if (!ssvFile.empty()) // parameter binding provided with .ssv file
867866
{
868-
// validate ssv files against SSP schem, only if the file exists, because it is possible we use importSnapShot API
869-
// to go back to old states and in this case we should not validate those ssv files in memory until it is exported to a ssp
870-
if (filesystem::exists(ssvFile))
871-
{
872-
XercesValidator xercesValidator;
873-
xercesValidator.validateSSP("", ssvFile);
874-
}
875-
876867
//resourceFiles.push_back(ssvFile);
877868
pugi::xml_node parameterSet = snapshot.getResourceNode(ssvFile);
878869
if (!parameterSet)
@@ -889,12 +880,6 @@ oms_status_enu_t oms::Values::importFromSnapshot(const pugi::xml_node& node, con
889880
std::string ssmFileSource = ssd_parameterMapping.attribute("source").as_string();
890881
if (!ssmFileSource.empty())
891882
{
892-
// validate ssm file only if it exists
893-
if (filesystem::exists(ssmFileSource))
894-
{
895-
XercesValidator xercesValidator;
896-
xercesValidator.validateSSP("", ssmFileSource);
897-
}
898883
pugi::xml_node ssm_parameterMapping = snapshot.getResourceNode(ssmFileSource);
899884
if (!ssm_parameterMapping)
900885
return logError("loading <oms:file> \"" + ssmFileSource + "\" from <oms:snapshot> failed");
@@ -1707,10 +1692,6 @@ oms_status_enu_t oms::Values::parseModelDescriptionFmi3(const filesystem::path&
17071692

17081693
const char* modelDescription = ::miniunz_onefile_to_memory(root.generic_string().c_str(), "modelDescription.xml");
17091694

1710-
// TODO validate modeldescription.xml against schema fmi3ModelDescription.xsd
1711-
// XercesValidator xercesValidator;
1712-
// xercesValidator.validateFMU(modelDescription, root.generic_string());
1713-
17141695
Snapshot snapshot;
17151696
oms_status_enu_t status = snapshot.importResourceMemory("modelDescription.xml", modelDescription);
17161697
::miniunz_free(modelDescription);

0 commit comments

Comments
 (0)