Skip to content

Commit f7d7054

Browse files
committed
Add meson build to CI
Add x86_64 only meson build for now, meson requires some cross-compile files to be passed. Signed-off-by: Neil Armstrong <[email protected]>
1 parent 606a242 commit f7d7054

File tree

5 files changed

+42
-32
lines changed

5 files changed

+42
-32
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,16 @@ jobs:
187187
echo "############################################"
188188
printenv
189189
190+
- name: Meson init
191+
if: ${{ matrix.arch == 'x86-64' && matrix.container != 'ubuntu:xenial' }}
192+
run: |
193+
mkdir build
194+
meson . build
195+
196+
- name: Ninja build
197+
if: ${{ matrix.arch == 'x86-64' && matrix.container != 'ubuntu:xenial' }}
198+
run: ninja -C build
199+
190200
- name: Compile
191201
run: make -j$(nproc)
192202

ci/archlinux.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pacman -Syu --noconfirm \
2222
systemd-libs \
2323
make \
2424
pkgconf \
25+
meson \
2526
$PKGS_CC
2627

2728
echo "Install finished: $0"

ci/debian.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ apt install -y --no-install-recommends \
3333
libudev-dev \
3434
libyaml-dev \
3535
make \
36+
meson \
3637
$PKGS_CC
3738

3839
echo "Install finished: $0"

ci/fedora.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ dnf -y install \
2121
libudev-devel \
2222
libyaml-devel \
2323
make \
24+
meson \
2425
$PKGS_CC
2526

2627
echo "Install finished: $0"

meson.build

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,45 @@
22

33
project('cdba',
44
'c',
5+
license : [ 'BSD-3-Clause'],
6+
meson_version : '>= 0.43.0', # for compiler.get_supported_arguments()
57
default_options: [
68
'warning_level=2', # sets -Wextra
79
'buildtype=release',
810
])
911

12+
# Set advanced compiler flags
1013
compiler = meson.get_compiler('c')
1114

12-
# If compiler variables are detectable, add some selected ones
13-
if meson.version().version_compare('>=0.43.0')
14-
base_cflags = ['-Wno-unused-parameter',
15-
'-Wno-unused-result',
16-
'-Wno-missing-field-initializers',
17-
'-Wno-sign-compare',
18-
'-Wundef',
19-
'-Wnull-dereference',
20-
'-Wdouble-promotion',
21-
'-Wshadow',
22-
'-Wpointer-arith',
23-
'-Wwrite-strings',
24-
'-Wstrict-overflow=4']
15+
compiler_cflags = ['-Wno-unused-parameter',
16+
'-Wno-unused-result',
17+
'-Wno-missing-field-initializers',
18+
'-Wno-sign-compare',
19+
'-Wundef',
20+
'-Wnull-dereference',
21+
'-Wdouble-promotion',
22+
'-Wshadow',
23+
'-Wpointer-arith',
24+
'-Wwrite-strings',
25+
'-Wstrict-overflow=4']
2526

26-
if compiler.get_id() == 'gcc'
27-
compiler_cflags = ['-Werror', # Only set it on GCC
28-
'-Wformat-signedness',
29-
'-Wduplicated-cond',
30-
'-Wduplicated-branches',
31-
'-Wvla-larger-than=1',
32-
'-Walloc-zero',
33-
'-Wunsafe-loop-optimizations',
34-
'-Wcast-align',
35-
'-Wlogical-op',
36-
'-Wjump-misses-init']
37-
elif compiler.get_id() == 'clang'
38-
# TODO add clang specific options
39-
compiler_cflags = []
40-
endif
41-
42-
add_global_arguments(compiler.get_supported_arguments(base_cflags),
43-
compiler.get_supported_arguments(compiler_cflags),
44-
language: 'c')
27+
# TODO add clang specific options
28+
if compiler.get_id() == 'gcc'
29+
compiler_cflags += ['-Werror', # Only set it on GCC
30+
'-Wformat-signedness',
31+
'-Wduplicated-cond',
32+
'-Wduplicated-branches',
33+
'-Wvla-larger-than=1',
34+
'-Walloc-zero',
35+
'-Wunsafe-loop-optimizations',
36+
'-Wcast-align',
37+
'-Wlogical-op',
38+
'-Wjump-misses-init']
4539
endif
4640

41+
add_global_arguments(compiler.get_supported_arguments(compiler_cflags),
42+
language: 'c')
43+
4744
client_srcs = ['cdba.c',
4845
'circ_buf.c']
4946
executable('cdba',

0 commit comments

Comments
 (0)