]> git.saurik.com Git - wxWidgets.git/blame - distrib/msw/tmake/lib/wxVersion.pm
Added wxStringBufferLength: works like wxStringBuffer, except
[wxWidgets.git] / distrib / msw / tmake / lib / wxVersion.pm
CommitLineData
a6861c1d
VZ
1package wxVersion;
2
3=head1 NAME
4
5wxVersion
6
7=head1 SYNOPSIS
8
9 use wxVersion qw(GetVersion);
10
11=head1 METHODS
12
13=cut
14
15use strict;
16
17use base 'Exporter';
18use vars qw(@EXPORT_OK);
19
20@EXPORT_OK = qw(GetVersion);
21
22sub GetVersion()
23{
24 my $filename = $ENV{"WXWIN"} . "/include/wx/version.h";
25 open(VERSION_H, $filename) or die "Can't open $filename: $!\n";
26
27 my %versions;
28 my $numGot = 0;
29
30 while ( defined($_ = <VERSION_H>) ) {
31 chomp;
32
33 if ( /\s*#define\s+wxMAJOR_VERSION\s+(\d+)/ ) {
34 $versions{'MAJOR'} = $1;
35 $numGot++;
36 }
37 elsif ( /\s*#define\s+wxMINOR_VERSION\s+(\d+)/ ) {
38 $versions{'MINOR'} = $1;
39 $numGot++;
40 }
41 elsif ( /\s*#define\s+wxRELEASE_NUMBER\s+(\d+)/ ) {
42 $versions{'MICRO'} = $1;
43 $numGot++;
44 }
45
46 last if $numGot == 3 # we've got everything we wanted
47 }
48
49 $numGot == 3 or die "Failed to read the version from $filename.\n";
50
11739586
VZ
51 # release number if used in the DLL file names only for the unstable branch
52 # as for the stable branches the micro releases are supposed to be
53 # backwards compatible and so should have the same name or otherwise it
54 # would be impossible to use them without recompiling the applications
55 # (which is the whole goal of keeping them backwards compatible in the
56 # first place)
57 #
58 # and the final piece of the puzzle: stable branches are those with even
59 # minor version number (and unstable -- with odd)
60 $versions{'MICRO_IF_UNSTABLE'} = $versions{'MINOR'} % 2 ? $versions{'MICRO'}
61 : "";
62
a6861c1d
VZ
63 return %versions;
64}
65