Skip to content

Commit c394f9d

Browse files
d-e-s-oanakryiko
authored andcommitted
examples/c: Use CMake stuff in CI
As libbpf#258 showed, we also have a CMake based build infrastructure lying around for the examples. However, currently it is not used in CI and, hence, prone to breakage. Change that fact by building using CMake as part of the build workflow. Signed-off-by: Daniel Müller <deso@posteo.net>
1 parent 303544b commit c394f9d

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.github/docker/Dockerfile.ubuntu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ RUN apt-get update && apt-get install -y \
3737
llvm-${LLVM_VERSION}-dev \
3838
llvm-${LLVM_VERSION}-runtime \
3939
libllvm${LLVM_VERSION} \
40-
make pkg-config \
40+
make cmake pkg-config \
4141
rustc cargo rustfmt \
4242
sudo \
4343
&& apt-get -y clean

.github/workflows/build.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,20 @@ jobs:
4141
SHORTNAME=jammy
4242
file: ./.github/docker/Dockerfile.ubuntu
4343
tags: build_container
44-
- name: Build examples/c
44+
- name: Build examples/c -- GNU Make
4545
run: |
4646
docker run \
4747
-v $(pwd):/libbpf-bootstrap \
4848
build_container \
4949
/bin/bash -c \
5050
'cd /libbpf-bootstrap/examples/c && make -j`nproc`'
51+
- name: Build examples/c -- CMake
52+
run: |
53+
docker run \
54+
-v $(pwd):/libbpf-bootstrap \
55+
build_container \
56+
/bin/bash -c \
57+
'cd /libbpf-bootstrap/examples/c && cmake ./ && make'
5158
- name: Build examples/rust
5259
run: |
5360
docker run \

examples/c/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22

33
cmake_minimum_required(VERSION 3.16)
4-
project(examples)
4+
project(examples C)
55

66
# Tell cmake where to find BpfObject module
77
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../tools/cmake)

0 commit comments

Comments
 (0)