{ ******************************************************************************** Gestion de Salles Copyright (C) 2000-2012 Geoffray Levasseur . All rights reserved. http://www.geoffray-levasseur.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ******************************************************************************** Description: Version info manipulation functions ******************************************************************************** } unit uVersion; {$MODE objfpc}{$H+} interface uses Classes, SysUtils, InterfaceBase, LCLVersion; type TVersionStade = (vsAlpha, vsBeta, vsReleaseCandidate, vsFinal); TVerRec = record Major: Byte; Minor: Byte; Release: Byte; Build: Word; Add: TVersionStade; end; const // Version info - please don't change (version update made by maintenor) {$ifdef fpc} LCLPlatformDisplayNames: array[TLCLPlatform] of string = ('GTK 1', 'GTK 2', 'Win32/Win64', 'WinCE', 'Carbon', 'QT', 'FpGui', 'NoGui', 'Cocoa' {$IF (lcl_major >= 1) or ((lcl_minor >= 9) and (lcl_release >= 31))} , 'Android' //comment this with Lazarus <= 0.9.30 {$ENDIF} ); {$endif} VersionStadeDisplayNames: array[TVersionStade] of string = ('alpha', 'beta', 'RC', 'stable'); function GetBuildCPU: string; function GetBuildOS: string; function GetBuildDate: string; {$ifdef fpc} function GetLCLWidgetType: TLCLPlatform; function GetFPCVersion: String; function GetLazarusVersion: string; function GetLazarusRevision: string; {$endif} function GetVersionString(VerRec: TVerRec): String; {$I version.inc} var Debug: Boolean; implementation uses uUtils; {$ifdef fpc} function GetBuildOS: string; begin Result := LowerCase({$I %FPCTARGETOS%}); end; function GetBuildCPU: string; begin Result := LowerCase({$I %FPCTARGETCPU%}); end; function GetLCLWidgetType: TLCLPlatform; begin if WidgetSet <> nil then Result := WidgetSet.LCLPlatform else begin {$IFDEF Windows} Result:= lpWin32; {$ELSE} Result:= lpGtk; {$ENDIF} end; end; function GetFPCVersion: String; begin Result := {$I %FPCVERSION%}; end; function GetBuildDate: string; var BuildDate: string; SlPos1, SlPos2: integer; Date: TDateTime; begin BuildDate := {$I %date%}; SlPos1 := Pos('/', BuildDate); SlPos2 := SlPos1 + Pos('/', Copy(BuildDate, SlPos1 + 1, Length(BuildDate)- SlPos1)); Date := EncodeDate(StrToWord(Copy(BuildDate, 1, SlPos1 - 1)), StrToWord(Copy(BuildDate, SlPos1 + 1, SlPos2 - SlPos1 - 1)), StrToWord(Copy(BuildDate, SlPos2 + 1, Length(BuildDate) - SlPos2))); Result := FormatDateTime('yyyy-mm-dd', Date); end; function GetLazarusVersion: string; begin Result := Format('%d.%d.%d', [lcl_major, lcl_minor, lcl_release]); end; function GetLazarusRevision: string; //use the lazarus source code - change path as you need //if you don't have lazarus source code delete the line {$I } and replace //RevisionStr const by 'unknow' {$IFNDEF Windows} {$I ../../../fp-laz/lazarus/ide/revision.inc} {$ENDIF} begin {$IFNDEF Windows} if Trim(RevisionStr) <> '' then Result := 'svn ' + RevisionStr else {$ENDIF} Result := 'inconnue'; end; {$endif} function GetVersionString(VerRec: TVerRec): String; begin Result := InttoStr(VerRec.Major) + '.' + InttoStr(VerRec.Minor) + '.' + InttoStr(VerRec.Release) + '-' + InttoStr(VerRec.Build); case VerRec.Add of vsAlpha: Result := Result + ' alpha'; vsBeta: Result := Result + ' beta'; vsReleaseCandidate: Result := Result + 'RC'; end; {$ifdef fpc} Result := Result + ' ' + LCLPlatformDisplayNames[GetLCLWidgetType]; {$endif} {$ifdef delphi} Result := Result + ' ' + LCLPlatformDisplayNames[3]; {$endif} end; end.