1 package SDL::Build::MSWin32;
7 use File::Spec::Functions;
11 croak "Environment variable INCLUDE is empty\n" unless $ENV{INCLUDE};
13 return map { $_ => 1 } grep { $_ } split( ';', $ENV{INCLUDE} );
18 for my $key (qw( LIBS PATH ))
20 carp "Environment variable $key is empty\n" unless $ENV{$key};
21 carp "This will probably fail the compile \nSet $key manually or try building anyway\n" unless $ENV{$key};
24 my ( $self, $header, $includes ) = @_;
25 ( my $dll = $header ) =~ s/\.h/\.dll/;
29 for my $inc_dir ( keys %$includes )
31 next unless -e catfile( $inc_dir, $header );
32 $include_dir = $inc_dir;
35 return unless $include_dir;
37 for my $lib_path ( map { split(';', ( $ENV{$_} || '' )) }
40 return ( $include_dir, $header ) if -e catfile( $lib_path, $dll );
57 my $subsystems = $self->SUPER::subsystems();
58 my $gl_ss_method = $self->gl_vendor( $ENV{SDL_GL_VENDOR} ) . '_subsystems';
60 $subsystems->{OpenGL}{libraries} = $self->$gl_ss_method();
67 my $libraries = $self->SUPER::libraries();
68 my $gl_lib_method = $self->gl_vendor( $ENV{SDL_GL_VENDOR} ) . '_libraries';
70 $libraries->{OpenGL}{define} .= ' -D' . $self->$gl_lib_method();
76 my ( $self, $vendor ) = @_;
78 return 'ms_gl' unless defined $vendor;
80 return 'mesa_gl' if $vendor eq 'MESA';
81 return 'ms_gl' if $vendor eq 'MS';
83 croak "Unrecognized GL vendor '$vendor'\n";
88 return [qw( OpenGL GLU )];
91 sub mesa_gl_subsystems
93 return [qw( mesagl mesaglu osmesa )];
98 define => 'OPENGL_VENDOR_MS';
101 sub mesa_gl_libraries
103 define => 'OPENGL_VENDOR_MESA';
109 my ( $blib, $rib ) = @_;
111 # until ExtUtils::ParseXS is patched, avoid warnings from cl.exe
114 $rib =~ s{^src[\\/]}{};
115 $rib =~ s{[\\/]}{::}g;
117 local $self->{properties}{module_name} = $rib;
118 $self->SUPER::link_c( @_ );