diff --git a/.gitignore b/.gitignore index 694273bd..482f9389 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Makefile.am b/Makefile.am index 650863ee..a70206a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,6 +47,11 @@ SUBDIRS += \ examples endif +if ENABLE_FAKEUSERLIB +SUBDIRS += \ + fake_lib +endif + if ENABLE_TTY SUBDIRS += tty endif diff --git a/configure.ac b/configure.ac index 04b78bf4..22007635 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/fake_lib/Makefile.am b/fake_lib/Makefile.am new file mode 100644 index 00000000..18cbe7de --- /dev/null +++ b/fake_lib/Makefile.am @@ -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 +# . +# +#------------------------------------------------------------------------------ + +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