The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Build Status

NAME

Alien::FLTK - Build and use the stable 1.3.3 branch of the Fast Light Toolkit

Description

This distribution builds and installs libraries for the (stable) 1.3.3 branch of the FLTK GUI toolkit.

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()
);
my $EXE =
    $CC->link_executable(
     objects            => $OBJ,
     extra_linker_flags => '-L' . $AF->library_path . ' ' . $AF->ldflags()
    );
print system('./' . $EXE) ? 'Aww...' : 'Yay!';
END { unlink grep defined, $SRC, $OBJ, $EXE; }

Constructor

There are no per-object configuration options as of this version, but there may be in the future, so any new code using Alien::FLTK should create objects with the new constructor.

my $AF = Alien::FLTK->new( );

Methods

After creating a new Alien::FLTK object, use the following methods to gather information:

include_dirs

my @include_dirs = $AF->include_dirs( );

Returns a list of the locations of the headers installed during the build process and those required for compilation.

library_path

my $lib_path = $AF->library_path( );

Returns the location of the private libraries we made and installed during the build process.

cflags

my $cflags = $AF->cflags( );

Returns additional C compiler flags to be used.

cxxflags

my $cxxflags = $AF->cxxflags( );

Returns additional flags to be used to when compiling C++ using FLTK.

ldflags

my $ldflags = $AF->ldflags( qw[gl images] );

Returns additional linker flags to be used. This method can automatically add appropriate flags based on how you plan on linking to fltk. Acceptable arguments are:

Notes

Requirements

Prerequisites differ by system...

Installation

The distribution is based on Module::Build, so use the following procedure:

> perl Build.PL
> ./Build
> ./Build test
> ./Build install

Examples

Please see the Synopsis and the files in the /examples/.

Bugs

Numerous, I'm sure.

To Do

Please see Alien::FLTK::Todo

See Also

FLTK, Alien::FLTK2

Acknowledgments

Author

Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/

CPAN ID: SANKO

License and Legal

Copyright (C) 2009-2016 by Sanko Robinson <sanko@cpan.org>

This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or http://www.perlfoundation.org/artistic_license_2_0. For clarification, see http://www.perlfoundation.org/artistic_2_0_notes.

When separated from the distribution, all POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See http://creativecommons.org/licenses/by-sa/3.0/us/legalcode. For clarification, see http://creativecommons.org/licenses/by-sa/3.0/us/.

Alien::FLTK is based in part on the work of the FLTK project. See http://www.fltk.org/.