Alien-uPB
view release on metacpan or search on metacpan
inc/AU/Build.pm view on Meta::CPAN
my $builder = ExtUtils::CBuilder->new(quiet => 0);
die "C++ compiler not found"
unless $builder->have_cplusplus;
my %cxx_flags = ExtUtils::CppGuess->new->module_build_options;
my ($version, $flags) = _check_flags(
$builder, \%cxx_flags,
compiler_flags => '-I. ' . Alien::ProtoBuf->cflags,
linker_flags => '-Llib -lupb.bindings.googlepb -lupb ' . Alien::ProtoBuf->libs,
);
die "It seems something went wrong while building uPB"
unless $version;
return $version;
}
sub alien_generate_manual_pkgconfig {
my $self = shift;
my $config = $self->SUPER::alien_generate_manual_pkgconfig(@_);
# -DNDEBUG works around https://github.com/google/upb/issues/63
$config->{keywords}{Cflags} = '-I${pcfiledir}/include -DNDEBUG';
$config->{keywords}{Libs} =
'-L${pcfiledir}/lib ' .
join " ", map "-l$_", qw(
upb.bindings.googlepb upb.pb upb.json upb.descriptor upb
);
return $config;
}
sub _check_flags {
my ($builder, $cxx_flags, %flags) = @_;
my $object = $builder->object_file($base . '/inc/AU/test.cpp');
my $exe = $builder->exe_file($object);
inc/AU/check_upb.cpp view on Meta::CPAN
#include <upb/def.h>
#include <upb/bindings/googlepb/bridge.h>
#include <stdio.h>
using namespace upb;
using namespace upb::googlepb;
using namespace google::protobuf;
using namespace std;
int main(int argc, char **argv) {
reffed_ptr<MessageDef> def1 = MessageDef::New();
DefBuilder builder;
( run in 0.974 second using v1.01-cache-2.11-cpan-2398b32b56e )