Alien-CSFML

 view release on metacpan or  search on metacpan

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

package Alien::CSFML;
{ $Alien::CSFML::VERSION = 'v0.0.7'; }
use strict;
use warnings;
use File::ShareDir        qw[dist_dir];
use File::Spec::Functions qw[catdir canonpath];

sub new {
    my ( $pkg, %overrides ) = @_;
    return bless { 'C++' => $overrides{'C++'} }, $pkg;
}

sub include_dirs {
    my ($s) = @_;
    return (
        canonpath( catdir( dist_dir('Alien-CSFML'), 'src' ) ),
        canonpath( catdir( dist_dir('Alien-CSFML'), 'sfml', 'include' ) ),
        ( $s->{'C++'} ? () : canonpath( catdir( dist_dir('Alien-CSFML'), 'csfml', 'include' ) ) )
    );
}

sub library_path {
    my ($s) = @_;
    return ( canonpath( catdir( dist_dir('Alien-CSFML'), 'sfml', 'lib' ) ),
        ( $s->{'C++'} ? () : canonpath( catdir( dist_dir('Alien-CSFML'), 'csfml', 'lib' ) ) ) );
}
sub cflags   {''}
sub cxxflags {''}

sub ldflags {
    my ( $s, @args ) = @_;
    @args = qw[graphics window audio network system] if !scalar @args;
    CORE::state $pre;
    $pre //= {    # Windows dependencies
        graphics => [
            ( ( $s->{'C++'} ? '' : 'c' ) . 'sfml-window' ),
            ( ( $s->{'C++'} ? '' : 'c' ) . 'sfml-system' ),
            qw[opengl32 freetype]
        ],
        window => [ ( ( $s->{'C++'} ? '' : 'c' ) . 'sfml-system' ), qw[opengl32 winmm gdi32] ],
        audio  => [
            ( ( $s->{'C++'} ? '' : 'c' ) . 'sfml-system' ),
            qw[openal32 flac vorbisenc vorbisfile vorbis ogg]
        ],
        network => [ ( ( $s->{'C++'} ? '' : 'c' ) . 'sfml-system' ), qw[ws2_32] ],
        system  => [qw[winmm]]
        }
        if $^O eq 'MSWin32';
    join ' ', ' -L' . canonpath( catdir( dist_dir('Alien-CSFML'), 'sfml', 'lib' ) ), (
        $s->{'C++'} ? '' : ' -L' . canonpath( catdir( dist_dir('Alien-CSFML'), 'csfml', 'lib' ) ) ),
        (
        map { '-l' . $_ } (
            ( grep {/^audio$/} @args ) ?
                ( @{ $pre->{audio} }, 'sfml-audio', ( $s->{'C++'} ? () : 'csfml-audio' ) ) :
                ()
        ), (
            ( grep {/^graphics$/} @args ) ?
                ( @{ $pre->{graphics} }, 'sfml-graphics', ( $s->{'C++'} ? () : 'csfml-graphics' ) )
            :
                ()
        ), (
            ( grep {/^network$/} @args ) ?
                ( @{ $pre->{network} }, 'sfml-network', ( $s->{'C++'} ? () : 'csfml-network' ) ) :
                ()
        ), (
            ( grep {/^system$/} @args ) ?
                ( @{ $pre->{system} }, 'sfml-system', ( $s->{'C++'} ? () : 'csfml-system' ) ) :
                ()
        ), (
            ( grep {/^window$/} @args ) ?



( run in 0.452 second using v1.01-cache-2.11-cpan-385001e3568 )