Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ a.out*
/Makefile
/CMakeFiles/*
/cmake_install.cmake
/*.kdev4
!/meson.build
16 changes: 16 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@ jobs:
- template: .ci/azure-build.yml
- template: .ci/azure-test.yml

- job: Meson
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
- script: python3 -m pip install meson ninja
- script: meson build
displayName: Run meson to generate build
workingDirectory: tests/mesonTest
- script: ninja -C tests/mesonTest/build
displayName: Build with Ninja
- script: ./tests/mesonTest/build/main --help
displayName: Run help

- job: Docker
variables:
cli11.single: OFF
Expand Down
11 changes: 11 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
project('CLI11', ['cpp'],
version : run_command(find_program('scripts/ExtractVersion.py')).stdout().strip(),
default_options : ['cpp_std=c++11']
)

CLI11_inc = include_directories(['include'])

CLI11_dep = declare_dependency(
include_directories : CLI11_inc,
version : meson.project_version(),
)
17 changes: 17 additions & 0 deletions scripts/ExtractVersion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python3

import os
import re

base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
config_h = os.path.join(base_path, 'include', 'CLI', 'Version.hpp')
data = {'MAJOR': 0, 'MINOR': 0, 'PATCH': 0}
reg = re.compile(r'^\s*#define\s+CLI11_VERSION_([A-Z]+)\s+([0-9]+).*$')

with open(config_h, 'r') as fp:
for l in fp:
m = reg.match(l)
if m:
data[m.group(1)] = int(m.group(2))

print('{}.{}.{}'.format(data['MAJOR'], data['MINOR'], data['PATCH']))
10 changes: 10 additions & 0 deletions tests/mesonTest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# CLI11 Meson test / example

Requirements: meson, ninja

## Build

```bash
meson build
ninja -C build
```
11 changes: 11 additions & 0 deletions tests/mesonTest/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <CLI/CLI.hpp>

int main(int argc, char **argv) {
CLI::App app{"App description"};

std::string filename = "default";
app.add_option("-f,--file", filename, "A help string");

CLI11_PARSE(app, argc, argv);
return 0;
}
5 changes: 5 additions & 0 deletions tests/mesonTest/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
project('mesonTest', ['c', 'cpp'], default_options: ['cpp_std=c++11'])

cli11_dep = subproject('CLI11').get_variable('CLI11_dep')

mainExe = executable('main', ['main.cpp'], dependencies: [cli11_dep])
1 change: 1 addition & 0 deletions tests/mesonTest/subprojects/CLI11