Skip to content

Commit

Permalink
meson refactoring
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
marzer committed Sep 5, 2020
1 parent 8ae2eec commit 1381240
Show file tree
Hide file tree
Showing 6 changed files with 571 additions and 510 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- run:
name: Building and testing with clang 9
command: |
CXX=clang++-9 meson build --buildtype=debug -DGENERATE_CMAKE_CONFIG=disabled -DBUILD_EXAMPLES=disabled
CXX=clang++-9 meson build --buildtype=debug -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false
cd build && ninja -v -j 4 && ninja test
release_clang9:
Expand All @@ -49,7 +49,7 @@ jobs:
- run:
name: Building and testing with clang 9
command: |
CXX=clang++-9 meson build --buildtype=release -DGENERATE_CMAKE_CONFIG=disabled -DBUILD_EXAMPLES=disabled
CXX=clang++-9 meson build --buildtype=release -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false
cd build && ninja -v -j 4 && ninja test
debug_gcc9:
Expand All @@ -70,7 +70,7 @@ jobs:
- run:
name: Building and testing with gcc9
command: |
CXX=g++-9 meson build --buildtype=debug -DGENERATE_CMAKE_CONFIG=disabled -DBUILD_EXAMPLES=disabled
CXX=g++-9 meson build --buildtype=debug -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false
cd build && ninja -v -j 4 && ninja test
release_gcc9:
Expand All @@ -91,7 +91,7 @@ jobs:
- run:
name: Building and testing with gcc9
command: |
CXX=g++-9 meson build --buildtype=release -DGENERATE_CMAKE_CONFIG=disabled -DBUILD_EXAMPLES=disabled
CXX=g++-9 meson build --buildtype=release -Dpedantic=true -Dbuild_tests=true -Dbuild_examples=true -Dgenerate_cmake_config=false
cd build && ninja -v -j 4 && ninja test
generate_dox:
Expand Down
34 changes: 17 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,27 @@ If test discovery fails you can usually fix it by enabling
# install ninja, meson, locales (first time only)
sudo apt update && sudo apt install -y locales python3 python3-pip ninja-build
sudo pip3 install meson
sudo locale-gen 'en_US.utf8' \
'ja_JP.utf8' \
'de_DE.utf8' \
'it_IT.utf8' \
'tr_TR.utf8' \
'fi_FI.utf8' \
'fr_FR.utf8' \
'zh_CN.utf8'
sudo locale-gen 'en_US.utf8' \
'ja_JP.utf8' \
'de_DE.utf8' \
'it_IT.utf8' \
'tr_TR.utf8' \
'fi_FI.utf8' \
'fr_FR.utf8' \
'zh_CN.utf8'

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

# run the tests
cd build-gcc-debug && ninja && ninja test \
&& cd ../build-clang-debug && ninja && ninja test \
&& cd ../build-gcc-release && ninja && ninja test \
&& cd ../build-clang-release && ninja && ninja test \
&& cd ..
cd build-gcc-debug && ninja && ninja test \
&& cd ../build-clang-debug && ninja && ninja test \
&& cd ../build-gcc-release && ninja && ninja test \
&& cd ../build-clang-release && ninja && ninja test \
&& cd ..
```


Expand Down
43 changes: 16 additions & 27 deletions examples/meson.build
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
args = []

if compiler.get_id() == 'gcc' or compiler.get_id() == 'clang'
args += [ '-Wno-switch', '-Wno-switch-default', '-Wno-switch-enum' ]
example_args = []
example_args += additional_arguments
if is_gcc or is_clang
example_args += [ '-Wno-switch', '-Wno-switch-default', '-Wno-switch-enum' ]
endif

simple_parser = executable(
examples = [
'simple_parser',
[ 'simple_parser.cpp' ],
include_directories : inc,
cpp_args : args
)

toml_to_json_transcoder = executable(
'toml_to_json_transcoder',
[ 'toml_to_json_transcoder.cpp' ],
include_directories : inc,
cpp_args : args
)

toml_generator = executable(
'toml_generator',
[ 'toml_generator.cpp' ],
include_directories : inc,
cpp_args : args
)
'error_printer'
]

error_printer = executable(
'error_printer',
[ 'error_printer.cpp' ],
include_directories : inc,
cpp_args : args
)
foreach example : examples
executable(
example,
[ example+'.cpp' ],
include_directories : include_dirs,
cpp_args : example_args,
override_options: overrides
)
endforeach
Loading

0 comments on commit 1381240

Please sign in to comment.