Acme-MITHALDU-BleedingOpenGL

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

      }
      elsif ($interface eq 'AGL')
      {
        if ($^O ne 'darwin' || !$found_libs->{GLUT})
        {
          print "AGL interface requires GLUT.framework\n";
          next;
        }
      }
      elsif ($interface =~ m|GLUT|)
      {
        if ($interface eq 'FREEGLUT')
        {
          if (!$found_libs->{FREEGLUT} && !$found_libs->{FREEGLUT32})
          {
            print "FREEGLUT interface requires FreeGLUT\n";

            if ($found_libs->{GLUT})
            {
              print "Falling back to the GLUT interface\n";
              $interface = 'GLUT';
              $fallback++;
            }
            else
            {
              print "Try installing FREEGLUT first\n";
              next;
            }
          }
        }
        elsif ($interface eq 'GLUT')
        {
          if (!$found_libs->{GLUT} && $found_libs->{FREEGLUT})
          {
            $found_libs->{GLUT} = $found_libs->{FREEGLUT};
          }

          if (!$found_libs->{GLUT32} && $found_libs->{FREEGLUT32})
          {
            $found_libs->{GLUT32} = $found_libs->{FREEGLUT32};
          }

          if ($found_libs->{GLUT})
          {
            delete($found_libs->{FREEGLUT});
          }

          if ($found_libs->{GLUT32})
          {
            delete($found_libs->{FREEGLUT32});
          }

          if (!$found_libs->{GLUT} && !$found_libs->{GLUT32})
          {
            print "GLUT interface requires GLUT or FreeGLUT but libs were not found\n";
            next;
          }
        }
        else
        {
           print "Error in interface argument processing\n";
           next;
        }
      }
      elsif ($interface eq 'GLX')
      {
        if (!$found_libs->{GL} && !$found_libs->{MESA} && !$found_libs->{GLX})
        {
          print "GLX interface requires GLX/X11 but the libraries were not found\n";
          next;
        }
      }
      elsif (!$found_libs->{$interface})
      {
        print "$interface interface not supported\n";
        next;
      }

      push(@interface_opts,$interface);
    }
  }

  my $interfaces = scalar(@interface_opts);
  if (!$interfaces)
  {
    die "ERROR: no supported interfaces found.\n";
  }
  elsif ($interfaces > 1)
  {
    die "ERROR: multiple opengl interfaces requested: @interface_opts.\n";
  }

  ($interface_lib) = @interface_opts;
  print "User set interface to $interface_lib\n" if ($verbose && !$fallback);

  # Strip out interface args
  @ARGV = grep { !m/^interface=/i } @ARGV;
}
# Otherwise use available defaults
elsif ($IS_CYGWIN)
{
  if ($found_libs->{FREEGLUT})
  {
    $interface_lib = 'FREEGLUT'; # CYGWIN will use X11 interface by default
  }
  elsif($found_libs->{GLUT})
  {
    $interface_lib = 'GLUT';
  }
  elsif($found_libs->{GLUT32} || $found_libs->{FREEGLUT32})
  {
    $interface_lib = 'W32API';
  }
  else
  {
    die "No suitable OpenGL+GLUT interface found for CYGWIN\n";
  }
}
elsif ($^O eq 'darwin' && $found_libs->{GLUT} && !$found_libs->{FREEGLUT})
{
  $interface_lib = 'AGL';

Makefile.PL  view on Meta::CPAN

  close(GLEXC);


  # return Distributable Defs
  print "Have Version Data\n" if ($verbose);
  my $defines = '-DHAVE_VER';
  $defines .= " -DGL_VERSION_USED=$GL_VERSION" if ($GL_VERSION);
  return $defines;
}

# Takes as input a INCS string ready for MakeMaker and cleans out
# non-existant directories produce a minimal configuration value
sub clean_incs {
   my $inincs = $_[0];
   return unless defined $inincs;
   print "clean_incs: got input INCS='$inincs'\n" if $verbose>1;

   my @inincs = split / /, $inincs;

   # clean out -I args with non-existent directories
   print "clean_incs: removing bad directories\n" if $verbose>1;
   my @outincs = grep { my $tmp = $_; $tmp =~ s/^-I// and ( -d $tmp or -l $tmp) } @inincs;
   my $outincs = join ' ', @outincs;

   print "clean_incs: returning INCS='$outincs'\n" if $verbose>1;
   $_[0] = $outincs;
}

# Takes as input a LIBS string ready for MakeMaker and cleans out
# non-existant directories and libraries to produce a better,
# minimal configuration value
sub clean_libs {
   my $inlibs = $_[0];
   return unless defined $inlibs;
   print "clean_libs: got input LIBS='$inlibs'\n" if $verbose>1;

   my @inlibs = split ' ', $inlibs;

   # clean out -L args with non-existent directories
   print "clean_libs: removing bad directories\n" if $verbose>1;
   my @outlibs = grep { my $tmp = $_; /^-l/ or $tmp =~ s/^-L// and ( -d $tmp or -l $tmp) } @inlibs;


   my $outlibs = join ' ', @outlibs;

   print "clean_libs: returning LIBS='$outlibs'\n" if $verbose>1;
   $_[0] = $outlibs;
}

# Dump Config.pm
sub WriteConfigPM
{
  my($config) = @_;

  die "Unable to write to Config.pm\n" if (!open(CONFIGPM, ">Config.pm"));

  print CONFIGPM q
{
# This is the Perl OpenGL build configuration file.
# It contains the final OpenGL build arguements from
# the configuration process.  Access the values by
# use OpenGL::Config which defines the variable
# $OpenGL::Config containing the hash arguments from
# the WriteMakefile() call.
#
};

  print CONFIGPM Data::Dumper->Dump( [$config], [qw(Acme::MITHALDU::BleedingOpenGL::Config)] );

  print CONFIGPM qq
{
1;
__END__
};

  close(CONFIGPM);
};



( run in 0.669 second using v1.01-cache-2.11-cpan-39bf76dae61 )