Commit dbd49335066bae6984df76fd0b31302fe5cb8239
Committed by
Henry Schreiner
1 parent
f583e5ba
meson: Basic meson support (#299)
* meson: Basic meson support With this patch, CLI11 can be used as a meson subproject: http://mesonbuild.com/Subprojects.html However, CMake is still required for testing and installation. The current meson.build is not a complete replacement. * meson: Added meson test * Adding Azure test
Showing
8 changed files
with
73 additions
and
0 deletions
.gitignore
azure-pipelines.yml
| ... | ... | @@ -48,6 +48,22 @@ jobs: |
| 48 | 48 | - template: .ci/azure-build.yml |
| 49 | 49 | - template: .ci/azure-test.yml |
| 50 | 50 | |
| 51 | +- job: Meson | |
| 52 | + pool: | |
| 53 | + vmImage: 'ubuntu-latest' | |
| 54 | + steps: | |
| 55 | + - task: UsePythonVersion@0 | |
| 56 | + inputs: | |
| 57 | + versionSpec: '3.6' | |
| 58 | + - script: python3 -m pip install meson ninja | |
| 59 | + - script: meson build | |
| 60 | + displayName: Run meson to generate build | |
| 61 | + workingDirectory: tests/mesonTest | |
| 62 | + - script: ninja -C tests/mesonTest/build | |
| 63 | + displayName: Build with Ninja | |
| 64 | + - script: ./tests/mesonTest/build/main --help | |
| 65 | + displayName: Run help | |
| 66 | + | |
| 51 | 67 | - job: Docker |
| 52 | 68 | variables: |
| 53 | 69 | cli11.single: OFF | ... | ... |
meson.build
0 → 100644
| 1 | +project('CLI11', ['cpp'], | |
| 2 | + version : run_command(find_program('scripts/ExtractVersion.py')).stdout().strip(), | |
| 3 | + default_options : ['cpp_std=c++11'] | |
| 4 | +) | |
| 5 | + | |
| 6 | +CLI11_inc = include_directories(['include']) | |
| 7 | + | |
| 8 | +CLI11_dep = declare_dependency( | |
| 9 | + include_directories : CLI11_inc, | |
| 10 | + version : meson.project_version(), | |
| 11 | +) | ... | ... |
scripts/ExtractVersion.py
0 → 100755
| 1 | +#!/usr/bin/env python3 | |
| 2 | + | |
| 3 | +import os | |
| 4 | +import re | |
| 5 | + | |
| 6 | +base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | |
| 7 | +config_h = os.path.join(base_path, 'include', 'CLI', 'Version.hpp') | |
| 8 | +data = {'MAJOR': 0, 'MINOR': 0, 'PATCH': 0} | |
| 9 | +reg = re.compile(r'^\s*#define\s+CLI11_VERSION_([A-Z]+)\s+([0-9]+).*$') | |
| 10 | + | |
| 11 | +with open(config_h, 'r') as fp: | |
| 12 | + for l in fp: | |
| 13 | + m = reg.match(l) | |
| 14 | + if m: | |
| 15 | + data[m.group(1)] = int(m.group(2)) | |
| 16 | + | |
| 17 | +print('{}.{}.{}'.format(data['MAJOR'], data['MINOR'], data['PATCH'])) | ... | ... |
tests/mesonTest/README.md
0 → 100644
tests/mesonTest/main.cpp
0 → 100644
tests/mesonTest/meson.build
0 → 100644
tests/mesonTest/subprojects/CLI11
0 → 120000