added wxVersion.pm here as apparently cvs doesn't allow adding the file added on the trunk on a branch as well
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19303 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
53
distrib/msw/tmake/wxVersion.pm
Normal file
53
distrib/msw/tmake/wxVersion.pm
Normal 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 = "../../../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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user