From a6861c1dc86a4e48e6f984b3f12290d1db575e59 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 24 Feb 2003 00:26:50 +0000 Subject: [PATCH] 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 --- distrib/msw/tmake/lib/wxVersion.pm | 53 ++++++++++++++++++++++++++++++ distrib/msw/tmake/vc6base.t | 27 +++++++++------ distrib/msw/tmake/vc6msw.t | 26 ++++++++++----- 3 files changed, 87 insertions(+), 19 deletions(-) create mode 100644 distrib/msw/tmake/lib/wxVersion.pm diff --git a/distrib/msw/tmake/lib/wxVersion.pm b/distrib/msw/tmake/lib/wxVersion.pm new file mode 100644 index 0000000000..943e06cb46 --- /dev/null +++ b/distrib/msw/tmake/lib/wxVersion.pm @@ -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($_ = ) ) { + 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; +} + diff --git a/distrib/msw/tmake/vc6base.t b/distrib/msw/tmake/vc6base.t index 48a0d7424a..83a00a3bb7 100644 --- a/distrib/msw/tmake/vc6base.t +++ b/distrib/msw/tmake/vc6base.t @@ -7,6 +7,9 @@ #! Version: $Id$ #!############################################################################# #${ + use lib './lib'; + use wxVersion qw(GetVersion); + #! include the code which parses filelist.txt file and initializes #! %wxCommon, %wxGeneric and %wxMSW hashes. IncludeTemplate("filelist.t"); @@ -44,7 +47,12 @@ $project{"WXMSWHEADERS"} .= $file . " " } - $project{"WXVERSION"} = "250"; + #! LINK_VERSION is the value of the linker /version switch, + #! DLL_VERSION is the version string for the DLL filename + my %versions = GetVersion(); + my ($verMaj, $verMin) = ( $versions{'MAJOR'}, $versions{'MINOR'} ); + $project{"LINK_VERSION"} = "$verMaj.$verMin"; + $project{"DLL_VERSION"} = "$verMaj$verMin"; #$} # Microsoft Developer Studio Project File - Name="wxBase" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 @@ -106,8 +114,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../lib/wxbase#$ $text = $project{"WXVERSION"} . 'u.dll"' -# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlib.lib ../lib/regex.lib /nologo /version:2.3 /dll /machine:I386 /out:"../lib/wxbase#$ $text = $project{"WXVERSION"} . 'u.dll"' +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../lib/wxbase#$ $text = $project{"DLL_VERSION"} . 'u.dll"' +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlib.lib ../lib/regex.lib /nologo #$ $text = '/version:' . $project{LINK_VERSION} . ' /dll /machine:I386 /out:"../lib/wxbase' . $project{DLL_VERSION} . 'u.dll"' !ELSEIF "$(CFG)" == "wxBase - Win32 Debug Unicode DLL" @@ -132,9 +140,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxbase#$ $text = $project{"WXVERSION"} . 'ud.dll"' -# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlibd.lib ../lib/regexd.lib /nologo /version:2.2 /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxbase#$ $text = $project{"WXVERSION"} . 'ud.dll"' - +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxbase#$ $text = $project{"DLL_VERSION"} . 'ud.dll"' +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlibd.lib ../lib/regexd.lib /nologo #$ $text = '/version:' . $project{LINK_VERSION} . ' /dll /machine:I386 /out:"../lib/wxbase' . $project{DLL_VERSION} . 'ud.dll"' !ELSEIF "$(CFG)" == "wxBase - Win32 Release Unicode" # PROP BASE Use_MFC 0 @@ -204,8 +211,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../lib/wxbase#$ $text = $project{"WXVERSION"} . '.dll"' -# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlib.lib ../lib/regex.lib /nologo /version:2.3 /dll /machine:I386 /out:"../lib/wxbase#$ $text = $project{"WXVERSION"} . '.dll"' +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../lib/wxbase#$ $text = $project{"DLL_VERSION"} . '.dll"' +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlib.lib ../lib/regex.lib /nologo #$ $text = '/version:' . $project{LINK_VERSION} . ' /dll /machine:I386 /out:"../lib/wxbase' . $project{DLL_VERSION} . '.dll"' !ELSEIF "$(CFG)" == "wxBase - Win32 Debug DLL" @@ -230,8 +237,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxbase#$ $text = $project{"WXVERSION"} . 'd.dll"' -# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlibd.lib ../lib/regexd.lib /nologo /version:2.2 /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxbase#$ $text = $project{"WXVERSION"} . 'd.dll"' +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxbase#$ $text = $project{"DLL_VERSION"} . 'd.dll"' +# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib wsock32.lib ../lib/zlibd.lib ../lib/regexd.lib /nologo #$ $text = '/version:' . $project{LINK_VERSION} . ' /dll /machine:I386 /out:"../lib/wxbase' . $project{DLL_VERSION} . 'd.dll"' !ELSEIF "$(CFG)" == "wxBase - Win32 Release" diff --git a/distrib/msw/tmake/vc6msw.t b/distrib/msw/tmake/vc6msw.t index 5dbec98308..9ffe12df52 100644 --- a/distrib/msw/tmake/vc6msw.t +++ b/distrib/msw/tmake/vc6msw.t @@ -9,6 +9,9 @@ #! Version: $Id$ #!############################################################################# #${ + use lib './lib'; + use wxVersion qw(GetVersion); + #! include the code which parses filelist.txt file and initializes #! %wxCommon, %wxGeneric and %wxMSW hashes. IncludeTemplate("filelist.t"); @@ -60,7 +63,12 @@ $project{"WXHTMLHEADERS"} .= $file . " " } - $project{"WXVERSION"} = "250"; + #! LINK_VERSION is the value of the linker /version switch, + #! DLL_VERSION is the version string for the DLL filename + my %versions = GetVersion(); + my ($verMaj, $verMin) = ( $versions{'MAJOR'}, $versions{'MINOR'} ); + $project{"LINK_VERSION"} = "$verMaj.$verMin"; + $project{"DLL_VERSION"} = "$verMaj$verMin"; #$} # Microsoft Developer Studio Project File - Name="wxWindows" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 @@ -122,8 +130,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpeg.lib ..\lib\tiff.lib ..\lib\png.lib ..\lib\regex.lib ..\lib\zlib.lib /nologo /dll /machine:I386 /out:"../lib/wxmsw#$ $text = $project{"WXVERSION"} . 'u.dll"' -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpeg.lib ..\lib\tiff.lib ..\lib\png.lib ..\lib\regex.lib ..\lib\zlib.lib /nologo /version:2.3 /dll /machine:I386 /out:"../lib/wxmsw#$ $text = $project{"WXVERSION"} . 'u.dll"' +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpeg.lib ..\lib\tiff.lib ..\lib\png.lib ..\lib\regex.lib ..\lib\zlib.lib /nologo /dll /machine:I386 /out:"../lib/wxmsw#$ $text = $project{"DLL_VERSION"} . 'u.dll"' +# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpeg.lib ..\lib\tiff.lib ..\lib\png.lib ..\lib\regex.lib ..\lib\zlib.lib /nologo #$ $text = '/version:' . $project{LINK_VERSION} . ' /dll /machine:I386 /out:"../lib/wxmsw' . $project{DLL_VERSION} . 'u.dll"' !ELSEIF "$(CFG)" == "wxWindows - Win32 Debug Unicode DLL" @@ -148,8 +156,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxmsw#$ $text = $project{"WXVERSION"} . 'ud.dll"' -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /nologo /version:2.3 /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxmsw#$ $text = $project{"WXVERSION"} . 'ud.dll"' +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxmsw#$ $text = $project{"DLL_VERSION"} . 'ud.dll"' +# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /nologo #$ $text = '/version:' . $project{LINK_VERSION} . ' /dll /machine:I386 /out:"../lib/wxmsw' . $project{DLL_VERSION} . 'ud.dll"' !ELSEIF "$(CFG)" == "wxWindows - Win32 Release Unicode" @@ -220,8 +228,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpeg.lib ..\lib\tiff.lib ..\lib\png.lib ..\lib\regex.lib ..\lib\zlib.lib /nologo /dll /machine:I386 /out:"../lib/wxmsw#$ $text = $project{"WXVERSION"} . '.dll"' -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpeg.lib ..\lib\tiff.lib ..\lib\png.lib ..\lib\regex.lib ..\lib\zlib.lib /nologo /version:2.3 /dll /machine:I386 /out:"../lib/wxmsw#$ $text = $project{"WXVERSION"} . '.dll"' +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpeg.lib ..\lib\tiff.lib ..\lib\png.lib ..\lib\regex.lib ..\lib\zlib.lib /nologo /dll /machine:I386 /out:"../lib/wxmsw#$ $text = $project{"DLL_VERSION"} . '.dll"' +# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpeg.lib ..\lib\tiff.lib ..\lib\png.lib ..\lib\regex.lib ..\lib\zlib.lib /nologo #$ $text = '/version:' . $project{LINK_VERSION} . ' /dll /machine:I386 /out:"../lib/wxmsw' . $project{DLL_VERSION} . '.dll"' !ELSEIF "$(CFG)" == "wxWindows - Win32 Debug DLL" @@ -246,8 +254,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxmsw#$ $text = $project{"WXVERSION"} . 'd.dll"' -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /nologo /version:2.3 /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxmsw#$ $text = $project{"WXVERSION"} . 'd.dll"' +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /dll /debug /machine:I386 /pdbtype:sept /out:"../lib/wxmsw#$ $text = $project{"DLL_VERSION"} . 'd.dll"' +# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comdlg32.lib shell32.lib ole32.lib oleaut32.lib odbc32.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib winmm.lib ..\lib\jpegd.lib ..\lib\tiffd.lib ..\lib\pngd.lib ..\lib\regexd.lib ..\lib\zlibd.lib /nologo #$ $text = '/version:' . $project{LINK_VERSION} . ' /dll /machine:I386 /out:"../lib/wxmsw' . $project{DLL_VERSION} . 'd.dll"' !ELSEIF "$(CFG)" == "wxWindows - Win32 Release"