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

NAME

Alien::FLTK2 - Build and use the experimental 2.0.x branch Fast Light Toolkit

Description

This distribution builds and installs libraries for the (experimental) 2.0.x branch of the FLTK GUI toolkit.

Synopsis

    use Alien::FLTK2;
    use ExtUtils::CBuilder;
    my $AF     = Alien::FLTK2->new();
    my $CC     = ExtUtils::CBuilder->new();
    my $source = 'hello_world.cxx';
    open(my $FH, '>', $source) || die '...';
    syswrite($FH, <<'') || die '...'; close $FH;
      #include <fltk/Window.h>
      #include <fltk/Widget.h>
      #include <fltk/run.h>
      using namespace fltk;
      int main(int argc, char **argv) {
        Window *window = new Window(300, 180);
        window->begin();
        Widget *box = new Widget(20, 40, 260, 100, "Hello, World!");
        box->box(UP_BOX);
        box->labelfont(HELVETICA_BOLD_ITALIC);
        box->labelsize(36);
        box->labeltype(SHADOW_LABEL);
        window->end();
        window->show(argc, argv);
        return run();
      }

    my $obj = $CC->compile('C++'                => 1,
                           source               => $source,
                           include_dirs         => [$AF->include_dirs()],
                           extra_compiler_flags => $AF->cxxflags()
    );
    my $exe = $CC->link_executable(objects            => $obj,
                                   extra_linker_flags => $AF->ldflags());
    print system('./' . $exe) ? 'Aww...' : 'Yay!';
    END { unlink grep defined, $source, $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::FLTK2 should create objects with the new constructor.

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

Methods

After creating a new Alien::FLTK2 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:

static

Returns flags to link against a static FLTK library.

FLTK's license allows static linking, but Alien::FLTK2 does not build static libs. ...yet.

gl

Include flags to use GL.

This is an experimental option. Depending on your system, this may also include OpenGL or MesaGL.

images

Include flags to use extra image formats (PNG, JPEG).

branch

    my $revision = $AF->branch( );

Returns the SVN branch of the source Alien::FLTK2 was built with. For the 1.3.x branch of fltk, see Alien::FLTK.

revision

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

Returns the SVN revision number of the source Alien::FLTK2 was built with.

capabilities

    my $caps = $AF->capabilities( );

Returns a list of capabilities supported by your Alien::FLTK2 installation. This list can be handed directly to ldflags( ).

config

    my $configuration = $AF->config( );

Returns a hashref containing the raw configuration data collected during build. This would be helpful when reporting bugs, etc.

Notes

Requirements

Prerequisites differ by system...

Win32

The fltk2 libs and Alien::FLTK2 both build right out of the box with MinGW. Further testing is needed for other setups.

X11/*nix

X11-based systems require several development packages. On Debian, these may be installed with...

  > sudo apt-get install libx11-dev
  > sudo apt-get install libxi-dev
  > sudo apt-get install libxcursor-dev
Darwin/OSX

Uh, yeah, I have no idea.

Installation

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

  > perl Build.PL
  > ./Build
  > ./Build test
  > ./Build install
  • Issue Tracker

    http://github.com/sanko/alien-fltk/issues

    Please only report Alien::FLTK2 related bugs to this tracker. For FLTK issues, use http://github.com/sanko/fltk-perl/issues/

  • Commit Log

    http://github.com/sanko/alien-fltk/commits/master

  • Homepage:

    http://sanko.github.com/fltk-perl/ is the homepage of the FLTK project.

  • License:

    http://www.perlfoundation.org/artistic_license_2_0

    See the License and Legal section of this document.

  • Mailing List

    Once I find someone to host a list for the FLTK project, I'll use it for Alien::FLTK2 too.

  • Repository

    http://github.com/sanko/alien-fltk/ and you are invited to fork it.

Examples

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

Bugs

Numerous, I'm sure.

To Do

Please see Alien::FLTK2::Todo

See Also

FLTK, Alien::FLTK

Acknowledgments

The FLTK Team - http://www.fltk.org/

Author

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

CPAN ID: SANKO

License and Legal

Copyright (C) 2009 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::FLTK2 is based in part on the work of the FLTK project. See http://www.fltk.org/.