get the version info directly from wx/version.h instead of hardcoding it here

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19300 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-02-24 00:26:50 +00:00
parent ca1aac5387
commit a6861c1dc8
3 changed files with 87 additions and 19 deletions

View File

@@ -0,0 +1,53 @@
package wxVersion;
=head1 NAME
wxVersion
=head1 SYNOPSIS
use wxVersion qw(GetVersion);
=head1 METHODS
=cut
use strict;
use base 'Exporter';
use vars qw(@EXPORT_OK);
@EXPORT_OK = qw(GetVersion);
sub GetVersion()
{
my $filename = $ENV{"WXWIN"} . "/include/wx/version.h";
open(VERSION_H, $filename) or die "Can't open $filename: $!\n";
my %versions;
my $numGot = 0;
while ( defined($_ = <VERSION_H>) ) {
chomp;
if ( /\s*#define\s+wxMAJOR_VERSION\s+(\d+)/ ) {
$versions{'MAJOR'} = $1;
$numGot++;
}
elsif ( /\s*#define\s+wxMINOR_VERSION\s+(\d+)/ ) {
$versions{'MINOR'} = $1;
$numGot++;
}
elsif ( /\s*#define\s+wxRELEASE_NUMBER\s+(\d+)/ ) {
$versions{'MICRO'} = $1;
$numGot++;
}
last if $numGot == 3 # we've got everything we wanted
}
$numGot == 3 or die "Failed to read the version from $filename.\n";
return %versions;
}