Alien-FLTK
view release on metacpan or search on metacpan
lib/Alien/FLTK.pm view on Meta::CPAN
package Alien::FLTK;
{ $Alien::FLTK::VERSION = 'v1.3.5'; }
use strict;
use warnings;
use File::ShareDir qw[dist_dir];
use File::Spec::Functions qw[catdir canonpath];
use JSON::Tiny qw[decode_json];
use File::Slurp qw[read_file];
use lib '../../blib/lib', '../blib/lib', 'blib/lib', 'lib';
sub new {
my ( $class, $overrides ) = @_; # XXX - overrides are unsupported
return
bless decode_json(
read_file( canonpath( catdir( dist_dir('Alien-FLTK'), 'config.json' ) ) ) ), shift;
}
sub include_dirs {
my ($self) = @_;
return canonpath( catdir( dist_dir('Alien-FLTK'), 'include' ) );
}
sub library_path {
my ($self) = @_;
return canonpath( catdir( dist_dir('Alien-FLTK'), 'lib' ) );
}
sub cflags { +shift->{cflags} }
sub cxxflags { +shift->{cxxflags} }
sub ldflags {
my ( $self, @args ) = @_;
return +shift->{ join '_', 'ldflags', sort @args };
}
1;
=pod
=head1 NAME
Alien::FLTK - Build and use the stable 1.3.x branch of the Fast Light Toolkit
=head1 Description
This distribution builds and installs libraries for the (stable) C<1.3.x>
branch of the FLTK GUI toolkit.
=head1 Synopsis
use Alien::FLTK;
use ExtUtils::CBuilder;
my $AF = Alien::FLTK->new();
my $CC = ExtUtils::CBuilder->new();
my $SRC = 'hello_world.cxx';
open(my $FH, '>', $SRC) || die '...';
syswrite($FH, <<'') || die '...'; close $FH;
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
int main(int argc, char **argv) {
Fl_Window *window = new Fl_Window(300,180);
Fl_Box *box = new Fl_Box(FL_UP_BOX, 20, 40, 260, 100, "Hello, World!");
box->labelfont(FL_BOLD + FL_ITALIC);
box->labelsize(36);
box->labeltype(FL_SHADOW_LABEL);
window->end();
window->show(argc, argv);
return Fl::run();
}
my $OBJ = $CC->compile('C++' => 1,
source => $SRC,
include_dirs => [$AF->include_dirs()],
extra_compiler_flags => $AF->cxxflags()
);
( run in 1.343 second using v1.01-cache-2.11-cpan-39bf76dae61 )