mirror of
https://github.com/ivabus/pantry
synced 2024-11-14 04:25:08 +03:00
+gflags
This commit is contained in:
parent
47a7a6cb03
commit
5592fd18dc
1 changed files with 55 additions and 0 deletions
55
projects/gflags.github.io/package.yml
Normal file
55
projects/gflags.github.io/package.yml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
|
||||||
|
distributable:
|
||||||
|
url: https://github.com/gflags/gflags/archive/refs/tags/v{{version}}.tar.gz
|
||||||
|
strip-components: 1
|
||||||
|
|
||||||
|
versions:
|
||||||
|
github: gflags/gflags/tags
|
||||||
|
strip: /^v/
|
||||||
|
|
||||||
|
|
||||||
|
build:
|
||||||
|
dependencies:
|
||||||
|
tea.xyz/gx/cc: c99
|
||||||
|
tea.xyz/gx/make: '*'
|
||||||
|
cmake.org: '*'
|
||||||
|
working-directory: buildroot
|
||||||
|
script: |
|
||||||
|
cmake $ARGS ..
|
||||||
|
make --jobs {{ hw.concurrency }}
|
||||||
|
make install
|
||||||
|
env:
|
||||||
|
ARGS:
|
||||||
|
- -DCMAKE_INSTALL_PREFIX={{prefix}}
|
||||||
|
- -DBUILD_SHARED_LIBS=ON
|
||||||
|
- -DBUILD_STATIC_LIBS=ON
|
||||||
|
- -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||||
|
|
||||||
|
test:
|
||||||
|
dependencies:
|
||||||
|
tea.xyz/gx/cc: c99
|
||||||
|
fixture: |
|
||||||
|
#include <iostream>
|
||||||
|
#include "gflags/gflags.h"
|
||||||
|
DEFINE_bool(verbose, false, "Display program name before message");
|
||||||
|
DEFINE_string(message, "Hello world!", "Message to print");
|
||||||
|
static bool IsNonEmptyMessage(const char *flagname, const std::string &value)
|
||||||
|
{
|
||||||
|
return value[0] != '\0';
|
||||||
|
}
|
||||||
|
DEFINE_validator(message, &IsNonEmptyMessage);
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
gflags::SetUsageMessage("some usage message");
|
||||||
|
gflags::SetVersionString("1.0.0");
|
||||||
|
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||||
|
if (FLAGS_verbose) std::cout << gflags::ProgramInvocationShortName() << ": ";
|
||||||
|
std::cout << FLAGS_message;
|
||||||
|
gflags::ShutDownCommandLineFlags();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
script: |
|
||||||
|
mv $FIXTURE test.cpp
|
||||||
|
g++ test.cpp -lgflags -o test
|
||||||
|
./test
|
Loading…
Reference in a new issue