build user example with cmake and test it

This commit is contained in:
Bjarne von Horn 2022-02-22 23:28:42 +01:00
parent 9d484de82a
commit 7e4aba9a6d
3 changed files with 25 additions and 1 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,19 @@ 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:

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)