add fake ethercat library to build system.

This commit is contained in:
Bjarne von Horn 2024-07-04 19:00:42 +02:00
parent 19779300e9
commit 42b980c0d4
4 changed files with 84 additions and 0 deletions

1
.gitignore vendored
View File

@ -33,6 +33,7 @@ ethercat.spec
examples/dc_user/ec_dc_user_example
examples/user/ec_user_example
examples/user/build/
fake_lib/libfakeethercat.la
lib/*.cmake
lib/libethercat.la
lib/libethercat.pc

View File

@ -47,6 +47,11 @@ SUBDIRS += \
examples
endif
if ENABLE_FAKEUSERLIB
SUBDIRS += \
fake_lib
endif
if ENABLE_TTY
SUBDIRS += tty
endif

View File

@ -1168,6 +1168,37 @@ fi
AM_CONDITIONAL(ENABLE_USERLIB, test "x$userlib" = "x1")
#-----------------------------------------------------------------------------
# Fake Userspace library generation
#-----------------------------------------------------------------------------
AC_MSG_CHECKING([whether to build the fake userspace library])
AC_ARG_ENABLE([fakeuserlib],
AS_HELP_STRING([--enable-fakeuserlib],
[Generation of the userspace library (default: no)]),
[
case "${enableval}" in
yes) fakeuserlib=1
;;
no) fakeuserlib=0
;;
*) AC_MSG_ERROR([Invalid value for --enable-fakeuserlib])
;;
esac
],
[fakeuserlib=0]
)
if test "x${fakeuserlib}" = "x1"; then
AC_MSG_RESULT([yes])
PKG_CHECK_MODULES([RTIPC], [librtipc])
else
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(ENABLE_FAKEUSERLIB, test "x$fakeuserlib" = "x1")
#-----------------------------------------------------------------------------
# TTY driver
#-----------------------------------------------------------------------------
@ -1389,6 +1420,7 @@ AC_CONFIG_FILES([
examples/user/Makefile
examples/xenomai/Makefile
examples/xenomai_posix/Makefile
fake_lib/Makefile
include/Makefile
lib/Makefile
lib/libethercat.pc

46
fake_lib/Makefile.am Normal file
View File

@ -0,0 +1,46 @@
#------------------------------------------------------------------------------
#
# Copyright (C) 2006-2024 Florian Pose, Ingenieurgemeinschaft IgH
#
# This file is part of the IgH EtherCAT master userspace library.
#
# The IgH EtherCAT master userspace library is free software; you can
# redistribute it and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software Foundation; version 2.1 of
# the License.
#
# The IgH EtherCAT master userspace library is distributed in the hope that
# it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with the IgH EtherCAT master userspace library. If not, see
# <http://www.gnu.org/licenses/>.
#
#------------------------------------------------------------------------------
lib_LTLIBRARIES = libfakeethercat.la
#------------------------------------------------------------------------------
libfakeethercat_la_SOURCES = \
fakeethercat.cpp
noinst_HEADERS = \
fakeethercat.h
libfakeethercat_la_CXXFLAGS = \
-fno-strict-aliasing \
-Wall \
-I$(top_srcdir)/include \
-Dethercat_EXPORTS \
-fvisibility=hidden \
$(RTIPC_CFLAGS)
libfakeethercat_la_LDFLAGS = -version-info 3:0:2 \
$(RTIPC_LIBS) \
-Wl,--version-script=$(srcdir)/../lib/libethercat.map \
-fvisibility=hidden
libfakeethercat_la_DEPENDENCIES = ../lib/libethercat.map