forked from CLIUtils/CLI11
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
meson: Basic meson support (CLIUtils#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
- Loading branch information
Showing
8 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ a.out* | |
/Makefile | ||
/CMakeFiles/* | ||
/cmake_install.cmake | ||
/*.kdev4 | ||
!/meson.build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../.. |