mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Refactor civitweb linkage #1188
This commit is contained in:
parent
4a9d9482ef
commit
1179703b6d
@ -105,9 +105,10 @@ AC_DEFUN([AX_CIVETWEB_HOME],[
|
|||||||
AS_IF([test "$CIVETWEB_HOME" = "no"],
|
AS_IF([test "$CIVETWEB_HOME" = "no"],
|
||||||
[CIVETWEB_HOME=""],
|
[CIVETWEB_HOME=""],
|
||||||
# else --with-civet was provided with a directory path.
|
# else --with-civet was provided with a directory path.
|
||||||
AC_CHECK_FILE([$CIVETWEB_HOME/include/civetweb.h],
|
AC_CHECK_FILES([$CIVETWEB_HOME/include/civetweb.h $CIVETWEB_HOME/lib/libcivetweb.a],
|
||||||
[USE_CIVETWEB="1"],
|
[USE_CIVETWEB="1"],
|
||||||
AC_MSG_ERROR([could not find $CIVETWEB_HOME/include/civetweb.h]))))
|
AC_MSG_ERROR([Could not find all of the civetweb files.]))
|
||||||
|
))
|
||||||
],
|
],
|
||||||
# --with option not provided.
|
# --with option not provided.
|
||||||
[AC_CHECK_HEADER(civetweb.h,
|
[AC_CHECK_HEADER(civetweb.h,
|
||||||
|
37
configure
vendored
37
configure
vendored
@ -10159,10 +10159,43 @@ eval ac_res=\$$as_ac_File
|
|||||||
printf "%s\n" "$ac_res" >&6; }
|
printf "%s\n" "$ac_res" >&6; }
|
||||||
if eval test \"x\$"$as_ac_File"\" = x"yes"
|
if eval test \"x\$"$as_ac_File"\" = x"yes"
|
||||||
then :
|
then :
|
||||||
USE_CIVETWEB="1"
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define `printf "%s\n" "HAVE_$CIVETWEB_HOME/include/civetweb.h" | $as_tr_cpp` 1
|
||||||
|
_ACEOF
|
||||||
|
USE_CIVETWEB="1"
|
||||||
else $as_nop
|
else $as_nop
|
||||||
as_fn_error $? "could not find $CIVETWEB_HOME/include/civetweb.h" "$LINENO" 5
|
as_fn_error $? "Could not find all of the civetweb files." "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
as_ac_File=`printf "%s\n" "ac_cv_file_$CIVETWEB_HOME/lib/libcivetweb.a" | $as_tr_sh`
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CIVETWEB_HOME/lib/libcivetweb.a" >&5
|
||||||
|
printf %s "checking for $CIVETWEB_HOME/lib/libcivetweb.a... " >&6; }
|
||||||
|
if eval test \${$as_ac_File+y}
|
||||||
|
then :
|
||||||
|
printf %s "(cached) " >&6
|
||||||
|
else $as_nop
|
||||||
|
test "$cross_compiling" = yes &&
|
||||||
|
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
|
||||||
|
if test -r "$CIVETWEB_HOME/lib/libcivetweb.a"; then
|
||||||
|
eval "$as_ac_File=yes"
|
||||||
|
else
|
||||||
|
eval "$as_ac_File=no"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
eval ac_res=\$$as_ac_File
|
||||||
|
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||||
|
printf "%s\n" "$ac_res" >&6; }
|
||||||
|
if eval test \"x\$"$as_ac_File"\" = x"yes"
|
||||||
|
then :
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define `printf "%s\n" "HAVE_$CIVETWEB_HOME/lib/libcivetweb.a" | $as_tr_cpp` 1
|
||||||
|
_ACEOF
|
||||||
|
USE_CIVETWEB="1"
|
||||||
|
else $as_nop
|
||||||
|
as_fn_error $? "Could not find all of the civetweb files." "$LINENO" 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -12,8 +12,8 @@ PURPOSE: (Represent the state and initial conditions of an http server.)
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "trick/WebSocketSession.hh"
|
||||||
|
|
||||||
class WebSocketSession;
|
|
||||||
typedef WebSocketSession* (*WebSocketSessionMaker)(struct mg_connection *nc);
|
typedef WebSocketSession* (*WebSocketSessionMaker)(struct mg_connection *nc);
|
||||||
typedef void (*httpMethodHandler)(struct mg_connection *, void* cbdata);
|
typedef void (*httpMethodHandler)(struct mg_connection *, void* cbdata);
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ PURPOSE: (Represent Websocket connection.)
|
|||||||
#ifndef WEB_SOCKET_SESSION_HH
|
#ifndef WEB_SOCKET_SESSION_HH
|
||||||
#define WEB_SOCKET_SESSION_HH
|
#define WEB_SOCKET_SESSION_HH
|
||||||
|
|
||||||
#if USE_CIVETWEB
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
#include "civet/CivetServer.h"
|
#include "civet/CivetServer.h"
|
||||||
@ -24,8 +23,7 @@ class WebSocketSession {
|
|||||||
virtual void sendMessage()=0;
|
virtual void sendMessage()=0;
|
||||||
virtual int handleMessage(std::string)=0;
|
virtual int handleMessage(std::string)=0;
|
||||||
|
|
||||||
struct mg_connection* connection;
|
struct mg_connection* connection; /* ** */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
@ -174,9 +174,11 @@ ifneq ($(GSL_HOME),)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (${USE_CIVETWEB},1)
|
ifeq (${USE_CIVETWEB},1)
|
||||||
TRICK_LIBS += ${CIVETWEB_HOME}/libcivetweb.a ${TRICK_LIB_DIR}/libtrickCivet.a
|
TRICK_LIBS += -ltrickCivet
|
||||||
|
TRICK_EXEC_LINK_LIBS += -L${CIVETWEB_HOME}/lib -lcivetweb -lz
|
||||||
TRICK_SWIG_FLAGS += -DUSE_CIVETWEB
|
TRICK_SWIG_FLAGS += -DUSE_CIVETWEB
|
||||||
TRICK_SYSTEM_CXXFLAGS += -DUSE_CIVETWEB
|
TRICK_SYSTEM_CXXFLAGS += -DUSE_CIVETWEB
|
||||||
|
TRICK_SYSTEM_ICG_EXCLUDE += ${CIVETWEB_HOME}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# We pipe the output of compiler through tee. If the user wanted gcc color, make sure they get it.
|
# We pipe the output of compiler through tee. If the user wanted gcc color, make sure they get it.
|
||||||
|
@ -12,7 +12,7 @@ PURPOSE: (Represent the state of a variable server websocket connection.)
|
|||||||
#include "civet/CivetServer.h"
|
#include "civet/CivetServer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "WebSocketSession.hh"
|
#include "trick/WebSocketSession.hh"
|
||||||
#include "VariableServerVariable.hh"
|
#include "VariableServerVariable.hh"
|
||||||
|
|
||||||
class VariableServerSession : public WebSocketSession {
|
class VariableServerSession : public WebSocketSession {
|
||||||
|
@ -18,7 +18,7 @@ PURPOSE: (Represent the state and initial conditions for my server)
|
|||||||
#include "trick/exec_proto.h"
|
#include "trick/exec_proto.h"
|
||||||
#include "simpleJSON.hh"
|
#include "simpleJSON.hh"
|
||||||
#include "VariableServerSession.hh"
|
#include "VariableServerSession.hh"
|
||||||
#include "WebSocketSession.hh"
|
#include "trick/WebSocketSession.hh"
|
||||||
|
|
||||||
#ifndef SWIG
|
#ifndef SWIG
|
||||||
#include "civet/CivetServer.h"
|
#include "civet/CivetServer.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user