5 # Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org>
7 # ------------------------------------------------------------------------------
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 # ------------------------------------------------------------------------------
25 # Please feel free to send questions, suggestions or improvements to:
31 package SDL::Build::MSWin32;
35 use base 'SDL::Build';
36 use File::Spec::Functions;
40 die "Environment variable INCLUDE is empty\n" unless $ENV{INCLUDE};
42 return map { $_ => 1 } grep { $_ } split( ';', $ENV{INCLUDE} );
47 for my $key (qw( LIBS PATH ))
49 die "Environment variable $key is empty\n" unless $ENV{$key};
52 my ( $self, $header, $includes ) = @_;
53 ( my $dll = $header ) =~ s/\.h/\.dll/;
57 for my $inc_dir ( keys %$includes )
59 next unless -e catfile( $inc_dir, $header );
60 $include_dir = $inc_dir;
63 return unless $include_dir;
65 for my $lib_path ( map { split(';', ( $ENV{$_} || '' )) }
68 return ( $include_dir, $header ) if -e catfile( $lib_path, $dll );
85 my $subsystems = $self->SUPER::subsystems();
86 my $gl_ss_method = $self->gl_vendor( $ENV{SDL_GL_VENDOR} ) . '_subsystems';
88 $subsystems->{OpenGL}{libraries} = $self->$gl_ss_method();
95 my $libraries = $self->SUPER::libraries();
96 my $gl_lib_method = $self->gl_vendor( $ENV{SDL_GL_VENDOR} ) . '_libraries';
98 $libraries->{OpenGL}{define} .= ' -D' . $self->$gl_lib_method();
104 my ( $self, $vendor ) = @_;
106 return 'ms_gl' unless defined $vendor;
108 return 'mesa_gl' if $vendor eq 'MESA';
109 return 'ms_gl' if $vendor eq 'MS';
111 die "Unrecognized GL vendor '$vendor'\n";
116 return [qw( OpenGL GLU )];
119 sub mesa_gl_subsystems
121 return [qw( mesagl mesaglu osmesa )];
126 define => 'OPENGL_VENDOR_MS';
129 sub mesa_gl_libraries
131 define => 'OPENGL_VENDOR_MESA';
137 my ( $blib, $rib ) = @_;
139 # until ExtUtils::ParseXS is patched, avoid warnings from cl.exe
142 $rib =~ s{^src[\\/]}{};
143 $rib =~ s{[\\/]}{::}g;
145 local $self->{properties}{module_name} = $rib;
146 $self->SUPER::link_c( @_ );