Skip to content

Commit 62fa40c

Browse files
authored
Merge pull request #82
Add meson CI workflow
2 parents dc4e72f + 68868cf commit 62fa40c

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

.github/workflows/ci-meson.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Meson Continuous Integrations
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build-and-test:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
cpp_compiler: [g++, clang++]
15+
sanitize: [address ,undefined, thread]
16+
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install Meson and Boost.Test
23+
run: sudo apt-get --quiet --yes install meson libboost-test-dev
24+
25+
- name: Setup
26+
env:
27+
CXX: ${{ matrix.cpp_compiler }}
28+
run: meson setup build -Dwerror=true -Dwarning_level=3 -Db_sanitize=${{ matrix.sanitize }}
29+
30+
- name: Compile
31+
run: meson compile -C build
32+
33+
- name: Test
34+
run: meson test -C build --print-errorlogs

meson.build

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,25 @@ if get_option('tests')
3131
endif
3232

3333
if get_option('benchmarks')
34+
incompatible_cpp_std = ['c++98', 'c++03', 'c++11', 'c++14', 'gnu++03', 'gnu++11', 'gnu++14', 'vc++14']
35+
if incompatible_cpp_std.contains(get_option('cpp_std'))
36+
error('Benchmarks require C++17 or higher')
37+
endif
38+
3439
cxx = meson.get_compiler('cpp')
3540
dl_dep = cxx.find_library('dl')
3641
xenium_dep = declare_dependency(include_directories : '../xenium')
3742
boost_dep = dependency('boost')
3843
tbb_dep = cxx.find_library('tbb')
3944
moodycamel_dep = declare_dependency(include_directories : '../')
4045

41-
executable(
46+
benchmarks_exe = executable(
4247
'benchmarks',
4348
['src/benchmarks.cc', 'src/cpu_base_frequency.cc', 'src/huge_pages.cc'],
4449
include_directories : ['src'],
4550
dependencies : [atomic_queue_dep, dl_dep, xenium_dep, boost_dep, tbb_dep, moodycamel_dep],
4651
)
52+
benchmark('benchmarks', benchmarks_exe)
4753
endif
4854

4955
install_headers(

meson_options.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
option('benchmarks', type : 'boolean', value : true,
2-
description : 'Build benchmarks (requires Boost, TBB, Xenium and moodycamel)')
1+
option('benchmarks', type : 'boolean', value : false,
2+
description : 'Build benchmarks (requires Boost, TBB, Xenium, moodycamel and C++17)')
33
option('tests', type : 'boolean', value : true,
44
description : 'Build tests and example (requires Boost)')

0 commit comments

Comments
 (0)