Skip to content

Commit 1381240

Browse files
committed
meson refactoring
- renamed options to `snake_case` - tests, examples and cmake config now explicitly disabled when used as a subproject - removed small_binaries (it's now implicit when building as release) - added minimum meson version 0.53
1 parent 8ae2eec commit 1381240

6 files changed

Lines changed: 571 additions & 510 deletions

File tree

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- run:
2525
name: Building and testing with clang 9
2626
command: |
27-
CXX=clang++-9 meson build --buildtype=debug -DGENERATE_CMAKE_CONFIG=disabled -DBUILD_EXAMPLES=disabled
27+
CXX=clang++-9 meson build --buildtype=debug -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false
2828
cd build && ninja -v -j 4 && ninja test
2929
3030
release_clang9:
@@ -49,7 +49,7 @@ jobs:
4949
- run:
5050
name: Building and testing with clang 9
5151
command: |
52-
CXX=clang++-9 meson build --buildtype=release -DGENERATE_CMAKE_CONFIG=disabled -DBUILD_EXAMPLES=disabled
52+
CXX=clang++-9 meson build --buildtype=release -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false
5353
cd build && ninja -v -j 4 && ninja test
5454
5555
debug_gcc9:
@@ -70,7 +70,7 @@ jobs:
7070
- run:
7171
name: Building and testing with gcc9
7272
command: |
73-
CXX=g++-9 meson build --buildtype=debug -DGENERATE_CMAKE_CONFIG=disabled -DBUILD_EXAMPLES=disabled
73+
CXX=g++-9 meson build --buildtype=debug -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false
7474
cd build && ninja -v -j 4 && ninja test
7575
7676
release_gcc9:
@@ -91,7 +91,7 @@ jobs:
9191
- run:
9292
name: Building and testing with gcc9
9393
command: |
94-
CXX=g++-9 meson build --buildtype=release -DGENERATE_CMAKE_CONFIG=disabled -DBUILD_EXAMPLES=disabled
94+
CXX=g++-9 meson build --buildtype=release -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false
9595
cd build && ninja -v -j 4 && ninja test
9696
9797
generate_dox:

CONTRIBUTING.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,27 @@ If test discovery fails you can usually fix it by enabling
3939
# install ninja, meson, locales (first time only)
4040
sudo apt update && sudo apt install -y locales python3 python3-pip ninja-build
4141
sudo pip3 install meson
42-
sudo locale-gen 'en_US.utf8' \
43-
'ja_JP.utf8' \
44-
'de_DE.utf8' \
45-
'it_IT.utf8' \
46-
'tr_TR.utf8' \
47-
'fi_FI.utf8' \
48-
'fr_FR.utf8' \
49-
'zh_CN.utf8'
42+
sudo locale-gen 'en_US.utf8' \
43+
'ja_JP.utf8' \
44+
'de_DE.utf8' \
45+
'it_IT.utf8' \
46+
'tr_TR.utf8' \
47+
'fi_FI.utf8' \
48+
'fr_FR.utf8' \
49+
'zh_CN.utf8'
5050

5151
# create the build configs (first time only)
52-
CXX=g++ meson build-gcc-debug -DGENERATE_CMAKE_CONFIG=disabled -DALL_WARNINGS=true
53-
CXX=clang++ meson build-clang-debug -DGENERATE_CMAKE_CONFIG=disabled -DALL_WARNINGS=true
54-
CXX=g++ meson build-gcc-release -DGENERATE_CMAKE_CONFIG=disabled -DALL_WARNINGS=true --buildtype=release
55-
CXX=clang++ meson build-clang-release -DGENERATE_CMAKE_CONFIG=disabled -DALL_WARNINGS=true --buildtype=release
52+
CXX=g++ meson build-gcc-debug --buildtype=debug -Dpedantic=true -Dbuild_tests=true -Dgenerate_cmake_config=false
53+
CXX=clang++ meson build-clang-debug --buildtype=debug -Dpedantic=true -Dbuild_tests=true -Dgenerate_cmake_config=false
54+
CXX=g++ meson build-gcc-release --buildtype=release -Dpedantic=true -Dbuild_tests=true -Dgenerate_cmake_config=false
55+
CXX=clang++ meson build-clang-release --buildtype=release -Dpedantic=true -Dbuild_tests=true -Dgenerate_cmake_config=false
5656

5757
# run the tests
58-
cd build-gcc-debug && ninja && ninja test \
59-
&& cd ../build-clang-debug && ninja && ninja test \
60-
&& cd ../build-gcc-release && ninja && ninja test \
61-
&& cd ../build-clang-release && ninja && ninja test \
62-
&& cd ..
58+
cd build-gcc-debug && ninja && ninja test \
59+
&& cd ../build-clang-debug && ninja && ninja test \
60+
&& cd ../build-gcc-release && ninja && ninja test \
61+
&& cd ../build-clang-release && ninja && ninja test \
62+
&& cd ..
6363
```
6464

6565

examples/meson.build

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,22 @@
1-
args = []
2-
3-
if compiler.get_id() == 'gcc' or compiler.get_id() == 'clang'
4-
args += [ '-Wno-switch', '-Wno-switch-default', '-Wno-switch-enum' ]
1+
example_args = []
2+
example_args += additional_arguments
3+
if is_gcc or is_clang
4+
example_args += [ '-Wno-switch', '-Wno-switch-default', '-Wno-switch-enum' ]
55
endif
66

7-
simple_parser = executable(
7+
examples = [
88
'simple_parser',
9-
[ 'simple_parser.cpp' ],
10-
include_directories : inc,
11-
cpp_args : args
12-
)
13-
14-
toml_to_json_transcoder = executable(
159
'toml_to_json_transcoder',
16-
[ 'toml_to_json_transcoder.cpp' ],
17-
include_directories : inc,
18-
cpp_args : args
19-
)
20-
21-
toml_generator = executable(
2210
'toml_generator',
23-
[ 'toml_generator.cpp' ],
24-
include_directories : inc,
25-
cpp_args : args
26-
)
11+
'error_printer'
12+
]
2713

28-
error_printer = executable(
29-
'error_printer',
30-
[ 'error_printer.cpp' ],
31-
include_directories : inc,
32-
cpp_args : args
33-
)
14+
foreach example : examples
15+
executable(
16+
example,
17+
[ example+'.cpp' ],
18+
include_directories : include_dirs,
19+
cpp_args : example_args,
20+
override_options: overrides
21+
)
22+
endforeach

0 commit comments

Comments
 (0)