Const-Introspect-C

 view release on metacpan or  search on metacpan

lib/Const/Introspect/C.pm  view on Meta::CPAN

package Const::Introspect::C;

use Moo;
use 5.020;
use experimental qw( signatures postderef );
use Ref::Util qw( is_plain_arrayref );
use Config;
use Text::ParseWords ();
use Path::Tiny ();
use Capture::Tiny qw( capture capture_merged );
use Const::Introspect::C::Constant;
use Data::Section::Simple ();
use Template ();
use FFI::Platypus 1.00;
use FFI::Build;

# ABSTRACT: Find and evaluate C/C++ constants for use in Perl
our $VERSION = '0.01'; # VERSION


has headers => (
  is      => 'ro',
  isa     => sub { die "headers should be a plain array ref" unless is_plain_arrayref($_[0]) },
  default => sub { [] },
);


has lang => (
  is      => 'ro',
  isa     => sub {
    die "lang should be one of c or c++" unless $_[0] =~ /^c(|\+\+)$/;
  },
  default => 'c',
);


has cc => (
  is      => 'ro',
  default => sub { [Text::ParseWords::shellwords($Config{cc})] },
);


has ppflags => (
  is      => 'ro',
  lazy    => 1,
  default => sub ($self) {
    ['-dM', '-E', '-x' => $self->lang];
  },
);


has cflags => (
  is      => 'ro',
  default => sub { [Text::ParseWords::shellwords($Config{ccflags})] },
);


has extra_cflags => (
  is      => 'ro',
  default => sub { [] },
);


has source => (
  is      => 'ro',
  lazy    => 1,



( run in 1.668 second using v1.01-cache-2.11-cpan-39bf76dae61 )