1
0
Fork 0

Adapt to recent simgear hla/rti changes.

This commit is contained in:
Mathias Froehlich 2011-08-30 21:51:53 +02:00
parent f835561fbe
commit 1c1722a2e9
3 changed files with 35 additions and 23 deletions

View file

@ -263,29 +263,30 @@ if test "x$with_rti13" != "xno"; then
AC_MSG_CHECKING([for simgear HLA/RTI support])
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([
#include <simgear/hla/HLA13Federate.hxx>
#include <simgear/hla/HLAFederate.hxx>
],[
new simgear::HLA13Federate;
new simgear::HLAFederate;
], simgear_hla=yes, simgear_hla=no)
AC_MSG_RESULT($simgear_hla)
if test "x$simgear_hla" = "xyes" ; then
AC_MSG_CHECKING([for hla libraries])
saved_LIBS="$LIBS"
saved_LDFLAGS="$LDFLAGS"
have_rti13=no
for rti13libs in "-lRTI-NG -lFedTime" "-lRTI-NGd -lFedTimed" ; do
if test "x$hla_libs" = "x" ; then
LIBS="-lsghla13 -lsghla -lsgxml -lsgstructure -lsgmath -lsgdebug -lsgtiming $rti13libs -lrt $saved_LIBS"
LIBS="-lsghla -lsgrti13 -lsgrti -lsgxml -lsgstructure -lsgmath -lsgdebug -lsgtiming $rti13libs -lrt $saved_LIBS"
LDFLAGS="$HLA_LDFLAGS $saved_LDFLAGS"
AC_TRY_LINK([
#include <simgear/hla/HLA13Federate.hxx>
#include <simgear/hla/HLAFederate.hxx>
],[
new simgear::HLA13Federate;
new simgear::HLAFederate;
], [hla_libs="$rti13libs"; have_rti13=yes],)
fi
done
LIBS="$saved_LIBS"
LDFLAGS="$saved_LDFLAGS"
AC_MSG_RESULT($hla_libs)
AC_MSG_RESULT($have_rti13)
fi
AC_LANG_POP()
fi
@ -293,7 +294,7 @@ dnl Currently only the rti13 variant, but in the future also rti1516
AM_CONDITIONAL(WITH_HLA, test "x$have_rti13" = "xyes")
if test "x$have_rti13" = "xyes" ; then
AC_DEFINE([FG_HAVE_HLA], 1, [Define if HLA/RTI is available.])
AC_SUBST(HLA_LIBS, "-lsghla13 -lsghla $hla_libs")
AC_SUBST(HLA_LIBS, "-lsghla -lsgrti13 -lsgrti $hla_libs")
fi
dnl EXPERIMENTAL fgpanel application

View file

@ -61,24 +61,25 @@ get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS)
#message(STATUS "SG libs ${SIMGEAR_LIBRARIES}")
if(RTI_FOUND)
find_sg_component(hla13 SIMGEAR_LIBRARIES)
find_sg_component(hla SIMGEAR_LIBRARIES)
find_sg_component(rti13 SIMGEAR_LIBRARIES)
find_sg_component(rti SIMGEAR_LIBRARIES)
set(HLA_LIBRARIES ${RTI_LIBRARIES})
else()
set(HLA_LIBRARIES "")
endif()
target_link_libraries(fgfs
target_link_libraries(fgfs
${FG_LIBS}
${HLA_LIBRARIES}
${SIMGEAR_LIBRARIES}
${OPENSCENEGRAPH_LIBRARIES}
${OPENAL_LIBRARY}
${OPENSCENEGRAPH_LIBRARIES}
${OPENAL_LIBRARY}
${OPENGL_LIBRARIES}
${ALUT_LIBRARY}
${ALUT_LIBRARY}
${ZLIB_LIBRARIES}
${PLIB_LIBRARIES}
${LIBSVN_LIBRARIES}
${RT_LIBRARY})
install(TARGETS fgfs RUNTIME DESTINATION bin)

View file

@ -37,7 +37,7 @@
#include <simgear/structure/exception.hxx>
#include <simgear/xml/easyxml.hxx>
#include <simgear/hla/HLA13Federate.hxx>
#include <simgear/hla/HLAFederate.hxx>
#include <simgear/hla/HLAArrayDataElement.hxx>
#include <simgear/hla/HLADataElement.hxx>
#include <simgear/hla/HLADataType.hxx>
@ -77,7 +77,7 @@ public:
HLAVersion getRTIVersion() const
{ return _rtiVersion; }
const std::vector<std::string>& getRTIArguments() const
const std::list<std::string>& getRTIArguments() const
{ return _rtiArguments; }
struct DataElement {
@ -318,7 +318,7 @@ private:
std::string _federateObjectModel;
HLAVersion _rtiVersion;
std::vector<std::string> _rtiArguments;
std::list<std::string> _rtiArguments;
ObjectClassConfigList _objectClassConfigList;
};
@ -818,7 +818,8 @@ private:
sg::HLADataElement::IndexPathPair _mpPropertiesIndexPathPair;
};
FGHLA::FGHLA(const std::vector<std::string>& tokens)
FGHLA::FGHLA(const std::vector<std::string>& tokens) :
_hlaFederate(new simgear::HLAFederate)
{
if (1 < tokens.size() && !tokens[1].empty())
set_direction(tokens[1]);
@ -919,14 +920,23 @@ FGHLA::open()
// We need that to communicate to the rti
switch (configReader.getRTIVersion()) {
case RTI13:
_hlaFederate = new simgear::HLA13Federate;
if (!_hlaFederate->connect(simgear::HLAFederate::RTI13, configReader.getRTIArguments())) {
SG_LOG(SG_IO, SG_ALERT, "Could not connect to RTI13 federation.");
return false;
}
break;
case RTI1516:
SG_LOG(SG_IO, SG_ALERT, "HLA version RTI1516 not yet(!?) supported.");
return false;
if (!_hlaFederate->connect(simgear::HLAFederate::RTI1516, configReader.getRTIArguments())) {
SG_LOG(SG_IO, SG_ALERT, "Could not connect to RTI1516 federation.");
return false;
}
break;
case RTI1516E:
SG_LOG(SG_IO, SG_ALERT, "HLA version RTI1516E not yet(!?) supported.");
return false;
if (!_hlaFederate->connect(simgear::HLAFederate::RTI1516E, configReader.getRTIArguments())) {
SG_LOG(SG_IO, SG_ALERT, "Could not connect to RTI1516E federation.");
return false;
}
break;
}
// Try to create a new federation execution
@ -1264,7 +1274,7 @@ FGHLA::close()
_hlaFederate->destroyFederationExecution(_federation);
// throw away the HLAFederate
_hlaFederate = 0;
_hlaFederate->disconnect();
set_enabled(false);