Merge branch 'fix_cmake' (also) into stable.

This commit is contained in:
Florian Pose 2022-03-04 10:12:12 +01:00
parent 3ee5e50a48
commit 9b1be4848b
5 changed files with 48 additions and 9 deletions

3
.gitignore vendored
View File

@ -32,7 +32,8 @@ configure
ethercat.spec
examples/dc_user/ec_dc_user_example
examples/user/ec_user_example
lib/EtherCATConfig.cmake
examples/user/build/
lib/*.cmake
lib/libethercat.la
lib/libethercat.pc
libtool

View File

@ -10,6 +10,34 @@ build:
- make -j8 all modules
- make DISTCHECK_CONFIGURE_FLAGS="--with-linux-dir=/usr/src/linux-obj/$(uname -i)/default" distcheck
test cmake:
stage: test
script:
- ./bootstrap
- ./configure --prefix=/tmp/ethercat_test_dir --disable-kernel
- make -j8 install
- cd examples/user
- mkdir build && cd build
- cmake -DCMAKE_PREFIX_PATH=/tmp/ethercat_test_dir -DCMAKE_BUILD_TYPE=Release ..
- make
- ldd userexample
pages:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == "stable-1.5"
script:
- ./bootstrap
- ./configure --with-linux-dir=/usr/src/linux-obj/$(uname -i)/default --disable-8139too --enable-tty --with-devices=2 --enable-ccat
- doxygen
- mkdir public
- echo "/ethercat /ethercat/v1 301" > public/_redirects
- mv doxygen-output/html/ public/v1/
artifacts:
paths:
- public/
# from 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml', but on all branches
workflow:
rules:

View File

@ -0,0 +1,10 @@
project(EtherCatUserExample C)
cmake_minimum_required(VERSION 3.2)
find_package(EtherCAT REQUIRED)
add_executable(userexample
main.c
)
target_link_libraries(userexample PUBLIC EtherLab::ethercat)

View File

@ -75,11 +75,11 @@ libethercat_la_LDFLAGS = -version-info 2:0:1
pkgconfig_DATA = libethercat.pc
cmakedir = $(libdir)/cmake
cmakedir = $(libdir)/cmake/ethercat
cmake_DATA = EtherCATConfig.cmake
cmake_DATA = ethercat-config.cmake
EXTRA_DIST = EtherCATConfig.cmake.in
EXTRA_DIST = ethercat-config.cmake.in
CLEANFILES = $(cmake_DATA)
@ -110,5 +110,5 @@ endif
# we need to replace the variables manually, because autotools does not expand them.
EtherCATConfig.cmake: $(srcdir)/EtherCATConfig.cmake.in Makefile
ethercat-config.cmake: $(srcdir)/ethercat-config.cmake.in Makefile
$(SED) -e 's,%libdir%,$(libdir),' -e 's,%includedir%,$(includedir),' $< > $@

View File

@ -29,7 +29,7 @@
find_library(EtherCAT_LIBRARY
NAMES EtherCAT
NAMES ethercat
PATHS %libdir%
)
@ -40,9 +40,9 @@ find_path(EtherCAT_INCLUDE_DIR
mark_as_advanced(EtherCAT_LIBRARY EtherCAT_INCLUDE_DIR)
if(NOT TARGET EtherLab::EtherCAT)
add_library(EtherLab::EtherCAT SHARED IMPORTED)
set_target_properties(EtherLab::EtherCAT PROPERTIES
if(NOT TARGET EtherLab::ethercat)
add_library(EtherLab::ethercat SHARED IMPORTED)
set_target_properties(EtherLab::ethercat PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${EtherCAT_INCLUDE_DIR}"
IMPORTED_LOCATION "${EtherCAT_LIBRARY}"
)