Alien-FLTK

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


Version 0.07008017 | 2010-02-10 07:18:40Z (Wed, 10 Feb 2010) | 364f273

     Resolved Issues/Bug Fixes:
     * X11-related libs are now linked in the correct, working order (I hope)

Version 0.07008016 | 2010-02-09 21:35:54Z (Tue, 09 Feb 2010) | 37735bc

    Internal/Behavioral Changes:
     * Alien::FLTK has been split into two projects. See Notes below.
     * cflags() and cxxflags() no longer include list of include directories
     * Renamed include_path() => include_dirs() now that it returns all
          required include directories
     * Internal method config('blah') now returns blah's data in the config
          hash
     * Compile using Quartz drawing instead of X11 on Apple OS X
     * Four months of stuff I forgot to keep the changelog up to date for. You
           could check out the commit logs if you're bored.

    Notes:
     * When stable, this will be an API-breakin' release

README.md  view on Meta::CPAN

        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](https://metacpan.org/pod/Alien%3A%3AFLTK) should
create objects with the `new` constructor.

README.md  view on Meta::CPAN

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:

- `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).

# Notes

## Requirements

Prerequisites differ by system...

- Win32

    The fltk libs and [Alien::FLTK](https://metacpan.org/pod/Alien%3A%3AFLTK) both build right out of the box

examples/opengl.pl  view on Meta::CPAN


#define FLTK_DEBUG 0

#define PERL_NO_GET_CONTEXT 1

#define __cplusplus 1
#include <EXTERN.h>
#include <perl.h>
#define NO_XSLOCKS // XSUB.h will otherwise override various things we need
#include <XSUB.h>
#define NEED_sv_2pv_flags
//#include "ppport.h"

#include <FL/Fl.H>
#include <FL/Fl_Gl_Window.H>
#include <FL/gl.h>
#include <GL/glu.h>
#include <string.h>
#include <stdio.h>

// Tetrahedron points

examples/opengl.pl  view on Meta::CPAN

     Fl_Window win(500, 300);
     MyGlWindow mygl(10, 10, win.w()-20, win.h()-20);
     win.show();
     return(Fl::run());
}

END
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('gl')
    );
print system('./' . $EXE) ? 'Aww...' : 'Yay!';
END { unlink grep defined, $SRC, $OBJ, $EXE; }

examples/synopsis.pl  view on Meta::CPAN

  box->labelsize(36);
  box->labeltype(FL_SHADOW_LABEL);
  window->end();
  window->show(argc, argv);
  return Fl::run();
}
END
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('gl')
    );
print system('./' . $EXE) ? 'Aww...' : 'Yay!';
END { unlink grep defined, $SRC, $OBJ, $EXE; }

inc/MBTFLTK.pm  view on Meta::CPAN

        print "Extracting...";

        my $ae = Archive::Extract->new(archive => $libinfo{archive});

        exit print " Fail! " . $ae->error if !$ae->extract();
        print " Done\nConfigure...\n";
        chdir($ae->extract_path);

        system q[NOCONFIGURE=1 ./autogen.sh];
        system q[sh ./configure --enable-shared];
        $libinfo{cflags}     = `sh ./fltk-config --cflags --optim`;
        $libinfo{cxxflags}   = `sh ./fltk-config --cxxflags --optim`;
        $libinfo{ldflags}    = `sh ./fltk-config --ldflags`;
        $libinfo{ldflags_gl} = `sh ./fltk-config --ldflags --use-gl`;
        $libinfo{ldflags_gl_images}
            = `sh ./fltk-config --ldflags --use-gl --use-images`;
        $libinfo{ldflags_images} = `sh ./fltk-config --ldflags --use-images`;

        # XXX - The following block is a mess!!!
        chdir 'src';
        my $gmake = can_run('gmake');
        my $make  = can_run('make');
        printf "Checking for gmake... %s\n", ($gmake ? 'yes' : 'no');
        printf "Checking for make... %s\n",  ($make  ? 'yes' : 'no');
        #system(($gmake ? 'g' : '') . q[make -ns > build.sh]);
        #system q[sh build.sh];
        system(($gmake ? 'g' : '') . q[make -j 10]);

lib/Alien/FLTK.pm  view on Meta::CPAN


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

lib/Alien/FLTK.pm  view on Meta::CPAN

        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; }

=head1 Constructor

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

lib/Alien/FLTK.pm  view on Meta::CPAN

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

=head2 C<library_path>

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

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

=head2 C<cflags>

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

Returns additional C compiler flags to be used.

=head2 C<cxxflags>

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

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

=head2 C<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:

=over

=item C<gl>

Include flags to use GL.

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

=item C<images>

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

=back

=head1 Notes

=head2 Requirements

Prerequisites differ by system...

=over

t/0002_exe.t  view on Meta::CPAN

  window->show(argc, argv);    X11 w/o a display. Testing the creation of the
  wait(0.1);                   window and a widget should be enough.
  window->hide();           */
  return 0;
}
END
my $OBJ = $CC->compile(
                  'C++'                => 1,
                  source               => $SRC,
                  include_dirs         => [$AF->include_dirs()],
                  extra_compiler_flags => $AF->cxxflags() . ' -fno-exceptions'
);
ok($OBJ, 'Compile with FLTK headers');
my $EXE =
    $CC->link_executable(objects            => $OBJ,
                         extra_linker_flags => '-L'
                             . $AF->library_path . ' '
                             . $AF->ldflags()
                             . ' -lstdc++ '
    );
ok($EXE,          'Link exe with fltk 1.3.x');
ok(!system($EXE), sprintf 'Run exe');
unlink $OBJ, $EXE, $SRC;

=pod

=head1 Author



( run in 4.464 seconds using v1.01-cache-2.11-cpan-94b05bcf43c )