Skip to content

Commit

Permalink
(opcua): backports from uniset2
Browse files Browse the repository at this point in the history
  • Loading branch information
vpashka committed Jan 4, 2024
1 parent 938b712 commit 2461e76
Show file tree
Hide file tree
Showing 69 changed files with 6,953 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
# due broken comedi
export CXXFLAGS="$CXXFLAGS -Wl,--unresolved-symbols=ignore-in-shared-libs"
autoreconf -fiv
./configure --disable-netdata --disable-python --disable-pgsql
./configure --disable-netdata --disable-python --disable-pgsql --disable-opcua --disable-tests
make
- name: Show summary of ccache configuration and statistics counters
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
libcomedi-devel libmariadb-devel libpqxx-devel libsqlite3-devel \
libxml2-devel libsigc++2-devel libpoco-devel libev-devel libprotobuf-devel grpc-plugins libgrpc++-devel \
libmosquitto-devel libprotobuf-devel \
libopen62541-devel libopen62541pp-devel \
xsltproc python3-dev python-module-distribute swig iputils
- name: cache
Expand Down
44 changes: 39 additions & 5 deletions conf/libuniset3.spec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
%def_enable logdb
%def_enable opentsdb
%def_enable uwebsocket
%def_enable opcua

%ifarch %ix86
%def_enable com485f
Expand Down Expand Up @@ -68,6 +69,11 @@ BuildRequires: libpqxx-devel >= 7.6.0
BuildRequires: libmosquitto-devel
%endif

%if_enabled opcua
BuildRequires: libopen62541-devel libopen62541pp-devel >= 0.3.0-alt1
%endif


%if_enabled netdata
BuildRequires: netdata
%endif
Expand All @@ -84,10 +90,6 @@ BuildRequires(pre): rpm-build-python3
BuildRequires: doxygen graphviz ImageMagick-tools
%endif

%if_enabled tests
BuildRequires: catch
%endif

#set_verify_elf_method textrel=strict,rpath=strict,unresolved=strict

%description
Expand Down Expand Up @@ -331,6 +333,24 @@ Requires: %name-extension-common-devel = %version-%release
Libraries needed to develop for uniset MQTT extension
%endif

%if_enabled opcua
%package extension-opcua
Group: Development/C++
Summary: OPC UA support for %{name}
Requires: %name-extension-common = %version-%release

%description extension-opcua
OPC UA support for %{name}

%package extension-opcua-devel
Group: Development/C++
Summary: Libraries needed to develop for uniset OPC UA extension
Requires: %name-extension-common-devel = %version-%release

%description extension-opcua-devel
Libraries needed to develop for uniset OPC UA extension
%endif

%if_enabled api
%package extension-api-gateway
Group: Development/C++
Expand All @@ -354,7 +374,10 @@ Libraries needed to develop for uniset HTTP API Gateway extension

%build
%autoreconf
%configure %{subst_enable docs} %{subst_enable mysql} %{subst_enable sqlite} %{subst_enable pgsql} %{subst_enable python} %{subst_enable io} %{subst_enable logicproc} %{subst_enable tests} %{subst_enable mqtt} %{subst_enable api} %{subst_enable netdata} %{subst_enable logdb} %{subst_enable com485f} %{subst_enable opentsdb} %{subst_enable uwebsocket}
%if "%__gcc_version_major" < "12"
%add_optflags -std=c++17
%endif
%configure %{subst_enable docs} %{subst_enable mysql} %{subst_enable sqlite} %{subst_enable pgsql} %{subst_enable python} %{subst_enable io} %{subst_enable logicproc} %{subst_enable tests} %{subst_enable mqtt} %{subst_enable api} %{subst_enable netdata} %{subst_enable logdb} %{subst_enable com485f} %{subst_enable opentsdb} %{subst_enable uwebsocket} %{subst_enable opcua}
%make_build

%install
Expand Down Expand Up @@ -519,6 +542,17 @@ rm -f %buildroot%_docdir/%oname/html/*.md5
%_includedir/%oname/extensions/mqtt/
%endif

%if_enabled opcua
%files extension-opcua
%_bindir/%oname-opcua*
%_libdir/libUniSet3OPCUA*.so.*

%files extension-opcua-devel
%_pkgconfigdir/libUniSet3OPCUA*.pc
%_libdir/libUniSet3OPCUA*.so
%_includedir/%oname/extensions/opcua/
%endif

%if_enabled api
%if_enabled uwebsocket
%files extension-wsgate
Expand Down
27 changes: 26 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,23 @@ fi
AM_CONDITIONAL(DISABLE_OPENTSDB, test ${buildtsdb} = false)
AM_CONDITIONAL(ENABLE_OPENTSDB, test ${buildtsdb} = true)

#check opc-ua support
AC_MSG_CHECKING([opc-ua support])
buildopcua=true
AC_ARG_ENABLE(opcua, AC_HELP_STRING([--disable-opcua], [disable OPC-UA support]),
[ if test $enableval = yes; then buildopcua=true; else buildopcua=false; fi],[ buildopcua=true; ])

if test ${buildopcua} = true; then
AC_MSG_RESULT([enabled])
PKG_CHECK_MODULES(OPEN62541PP, open62541pp)
PKG_CHECK_MODULES(OPEN62541, open62541)
else
AC_MSG_RESULT([disabled])
fi

AM_CONDITIONAL(DISABLE_OPCUA, test ${buildopcua} = false)
AM_CONDITIONAL(ENABLE_OPCUA, test ${buildopcua} = true)

#check io support
AC_MSG_CHECKING([io support])
buildio=true
Expand Down Expand Up @@ -259,7 +276,6 @@ fi

AM_CONDITIONAL(HAVE_EXTENTIONS, test ${ext} = true)


#check python support
AC_MSG_CHECKING([python support])
buildpython=true
Expand Down Expand Up @@ -432,6 +448,8 @@ if test ${buildtests} = true; then
AC_CONFIG_TESTDIR(extensions/URepository/tests)
AC_CONFIG_TESTDIR(extensions/HttpAPIGateway/tests)
AC_CONFIG_TESTDIR(extensions/UWebSocketGate/tests)
AC_CONFIG_TESTDIR(extensions/OPCUAServer/tests)
AC_CONFIG_TESTDIR(extensions/OPCUAExchange/tests)

TESTSUITE_DIR="\$(top_builddir)/testsuite"
AC_SUBST(TESTSUITE_DIR)
Expand Down Expand Up @@ -542,6 +560,7 @@ AC_CONFIG_FILES([Makefile
tests/PocoTest/Makefile
tests/UHttpTest/Makefile
tests/TCPSocketTest/Makefile
tests/Open62541Test/Makefile
docs/Makefile
docs/UniSetDox.cfg
docs/UniSetDoxDevel.cfg
Expand Down Expand Up @@ -602,6 +621,12 @@ AC_CONFIG_FILES([Makefile
extensions/UWebSocketGate/Makefile
extensions/UWebSocketGate/tests/Makefile
extensions/UWebSocketGate/libUniSet3UWebSocketGate.pc
extensions/OPCUAServer/Makefile
extensions/OPCUAServer/tests/Makefile
extensions/OPCUAServer/libUniSet3OPCUAServer.pc
extensions/OPCUAExchange/Makefile
extensions/OPCUAExchange/tests/Makefile
extensions/OPCUAExchange/libUniSet3OPCUAExchange.pc
extensions/HttpAPIGateway/Makefile
extensions/HttpAPIGateway/tests/Makefile
extensions/HttpAPIGateway/libUniSet3HttpAPIGateway.pc
Expand Down
1 change: 1 addition & 0 deletions extensions/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SUBDIRS = lib include SharedMemory SharedMemory/tests IOControl IOControl/tests
DBServer-MySQL DBServer-SQLite DBServer-PostgreSQL MQTTPublisher \
tests ModbusMaster/tests ModbusSlave/tests LogDB LogDB/tests \
Backend-OpenTSDB URepository URepository/tests UWebSocketGate UWebSocketGate/tests \
OPCUAServer OPCUAServer/tests OPCUAExchange OPCUAExchange/tests \
HttpAPIGateway HttpAPIGateway/tests


Expand Down
39 changes: 39 additions & 0 deletions extensions/OPCUAExchange/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
if ENABLE_OPCUA
# не забывайте править версию в2.pc-файле
OPCUA_CLI_VER=@LIBVER@

lib_LTLIBRARIES = libUniSet3OPCUAExchange.la
libUniSet3OPCUAExchange_la_LDFLAGS = -version-info $(OPCUA_CLI_VER)
libUniSet3OPCUAExchange_la_LIBADD = $(top_builddir)/lib/libUniSet3.la \
$(top_builddir)/extensions/SharedMemory/libUniSet3SharedMemory.la \
$(top_builddir)/extensions/lib/libUniSet3Extensions.la \
$(SIGC_LIBS) $(OPEN62541_LIBS)
libUniSet3OPCUAExchange_la_CXXFLAGS = -I$(top_builddir)/extensions/include -I$(top_builddir)/extensions/SharedMemory $(SIGC_CFLAGS) $(OPEN62541_CFLAGS)
libUniSet3OPCUAExchange_la_SOURCES = OPCUAExchange.cc OPCUAClient.cc

bin_PROGRAMS = @PACKAGE@-opcua-exchange @PACKAGE@-opcua-tester

@PACKAGE@_opcua_exchange_SOURCES = main.cc
@PACKAGE@_opcua_exchange_LDADD = libUniSet3OPCUAExchange.la $(top_builddir)/lib/libUniSet3.la \
$(top_builddir)/extensions/SharedMemory/libUniSet3SharedMemory.la \
$(top_builddir)/extensions/lib/libUniSet3Extensions.la \
$(SIGC_LIBS) $(OPEN62541_LIBS)
@PACKAGE@_opcua_exchange_CXXFLAGS = -I$(top_builddir)/extensions/include -I$(top_builddir)/extensions/SharedMemory $(SIGC_CFLAGS) $(OPEN62541_CFLAGS)


@PACKAGE@_opcua_tester_SOURCES = client.cc
@PACKAGE@_opcua_tester_LDADD = libUniSet3OPCUAExchange.la $(top_builddir)/lib/libUniSet3.la \
$(top_builddir)/extensions/SharedMemory/libUniSet3SharedMemory.la \
$(top_builddir)/extensions/lib/libUniSet3Extensions.la \
$(SIGC_LIBS) $(OPEN62541_LIBS)
@PACKAGE@_opcua_tester_CXXFLAGS = -I$(top_builddir)/extensions/include -I$(top_builddir)/extensions/SharedMemory $(SIGC_CFLAGS) $(OPEN62541_CFLAGS)

# install
devel_include_HEADERS = *.h
devel_includedir = $(pkgincludedir)/extensions/opcua

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSet3OPCUAExchange.pc

include $(top_builddir)/include.mk
endif
Loading

0 comments on commit 2461e76

Please sign in to comment.