pantry/projects/gflags.github.io/package.yml
2023-03-05 17:30:28 -05:00

55 lines
1.4 KiB
YAML

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