Skip to content

Commit 34fe2af

Browse files
authored
support search schemaPath from OpenModelica super project (#1267)
1 parent ffd0d88 commit 34fe2af

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/OMSimulatorLib/XercesValidator.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,22 @@ oms_status_enu_t oms::XercesValidator::validateSSP(const char *ssd, const std::s
163163
// the shared libraries are put in "install/lib/x86_64-linux-gnu/", so to find the schema location we have to move two directories back
164164
if (!filesystem::exists(schemaSSDPath))
165165
{
166+
// schema path from OMSimulator standalone builds
166167
schemaSSDPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureDescription.xsd";
167168
schemaSSVPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureParameterValues.xsd";
168169
schemaSSMPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureParameterMapping.xsd";
169170
schemaSSCPath = schemaRootPath / "../../share/OMSimulator/schema/ssp/SystemStructureCommon.xsd";
170171
}
171172

173+
// search schema path from top superproject OpenModelica location, shared libs are put in "build/lib/x86_64-linux-gnu/omc/libOMSimulator.so"
174+
if (!filesystem::exists(schemaSSDPath))
175+
{
176+
schemaSSDPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureDescription.xsd";
177+
schemaSSVPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureParameterValues.xsd";
178+
schemaSSMPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureParameterMapping.xsd";
179+
schemaSSCPath = schemaRootPath / "../../../share/OMSimulator/schema/ssp/SystemStructureCommon.xsd";
180+
}
181+
172182
XercesDOMParser domParser;
173183

174184
// load the schema
@@ -252,9 +262,16 @@ oms_status_enu_t oms::XercesValidator::validateFMU(const char *modeldescription,
252262
// the shared libraries are put in "install/lib/x86_64-linux-gnu/", so to find the schema location we have to move two directories back
253263
if (!filesystem::exists(schemaFmiModeldescriptionPath))
254264
{
265+
// schema path from standalone OMSimulator build
255266
schemaFmiModeldescriptionPath = schemaRootPath / "../../share/OMSimulator/schema/fmi2/fmi2ModelDescription.xsd";
256267
}
257268

269+
// schema path from top superproject OpenModelica location, shared libs are put in "build/lib/x86_64-linux-gnu/omc/libOMSimulator.so"
270+
if (!filesystem::exists(schemaFmiModeldescriptionPath))
271+
{
272+
schemaFmiModeldescriptionPath = schemaRootPath / "../../../share/OMSimulator/schema/fmi2/fmi2ModelDescription.xsd";
273+
}
274+
258275
XercesDOMParser domParser;
259276

260277
// load the schema

0 commit comments

Comments
 (0)