This commit is contained in:
Marc Seitz 2023-03-05 10:35:49 -07:00 committed by Jacob Heider
parent 47a7a6cb03
commit 5592fd18dc

View 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