Refactor civitweb linkage #1188

This commit is contained in:
Penn, John M 047828115 2021-10-14 18:17:04 -05:00
parent 4a9d9482ef
commit 1179703b6d
7 changed files with 45 additions and 11 deletions

View File

@ -105,9 +105,10 @@ AC_DEFUN([AX_CIVETWEB_HOME],[
AS_IF([test "$CIVETWEB_HOME" = "no"],
[CIVETWEB_HOME=""],
# 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"],
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.
[AC_CHECK_HEADER(civetweb.h,

37
configure vendored
View File

@ -10159,10 +10159,43 @@ eval ac_res=\$$as_ac_File
printf "%s\n" "$ac_res" >&6; }
if eval test \"x\$"$as_ac_File"\" = x"yes"
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
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
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

View File

@ -12,8 +12,8 @@ PURPOSE: (Represent the state and initial conditions of an http server.)
#include <sys/socket.h>
#include <arpa/inet.h>
#include <vector>
#include "trick/WebSocketSession.hh"
class WebSocketSession;
typedef WebSocketSession* (*WebSocketSessionMaker)(struct mg_connection *nc);
typedef void (*httpMethodHandler)(struct mg_connection *, void* cbdata);

View File

@ -4,7 +4,6 @@ PURPOSE: (Represent Websocket connection.)
#ifndef WEB_SOCKET_SESSION_HH
#define WEB_SOCKET_SESSION_HH
#if USE_CIVETWEB
#include <string>
#ifndef SWIG
#include "civet/CivetServer.h"
@ -24,8 +23,7 @@ class WebSocketSession {
virtual void sendMessage()=0;
virtual int handleMessage(std::string)=0;
struct mg_connection* connection;
struct mg_connection* connection; /* ** */
};
#endif
#endif

View File

@ -174,9 +174,11 @@ ifneq ($(GSL_HOME),)
endif
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_SYSTEM_CXXFLAGS += -DUSE_CIVETWEB
TRICK_SYSTEM_ICG_EXCLUDE += ${CIVETWEB_HOME}
endif
# We pipe the output of compiler through tee. If the user wanted gcc color, make sure they get it.

View File

@ -12,7 +12,7 @@ PURPOSE: (Represent the state of a variable server websocket connection.)
#include "civet/CivetServer.h"
#endif
#include "WebSocketSession.hh"
#include "trick/WebSocketSession.hh"
#include "VariableServerVariable.hh"
class VariableServerSession : public WebSocketSession {

View File

@ -18,7 +18,7 @@ PURPOSE: (Represent the state and initial conditions for my server)
#include "trick/exec_proto.h"
#include "simpleJSON.hh"
#include "VariableServerSession.hh"
#include "WebSocketSession.hh"
#include "trick/WebSocketSession.hh"
#ifndef SWIG
#include "civet/CivetServer.h"