Skip to content

Commit

Permalink
examples/c: Use CMake stuff in CI
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
d-e-s-o committed Mar 11, 2024
1 parent b0c8234 commit 315bb7e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/docker/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN apt-get update && apt-get install -y \
llvm-${LLVM_VERSION}-dev \
llvm-${LLVM_VERSION}-runtime \
libllvm${LLVM_VERSION} \
make pkg-config \
make cmake pkg-config \
rustc cargo rustfmt \
sudo \
&& apt-get -y clean
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,20 @@ jobs:
SHORTNAME=jammy
file: ./.github/docker/Dockerfile.ubuntu
tags: build_container
- name: Build examples/c
- name: Build examples/c -- GNU Make
run: |
docker run \
-v $(pwd):/libbpf-bootstrap \
build_container \
/bin/bash -c \
'cd /libbpf-bootstrap/examples/c && make -j`nproc`'
- name: Build examples/c -- CMake
run: |
docker run \
-v $(pwd):/libbpf-bootstrap \
build_container \
/bin/bash -c \
'cd /libbpf-bootstrap/examples/c && cmake ./ && make'
- name: Build examples/rust
run: |
docker run \
Expand Down
2 changes: 1 addition & 1 deletion examples/c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause

cmake_minimum_required(VERSION 3.16)
project(examples)
project(examples C)

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

0 comments on commit 315bb7e

Please sign in to comment.