added compiler options to IDEIntf and made Win32GraphicApp default for application projects

git-svn-id: trunk@6125 -
This commit is contained in:
mattias 2004-10-09 13:24:18 +00:00
parent 45c1fe7cee
commit bce37f242b
5 changed files with 265 additions and 48 deletions

View File

@ -42,9 +42,8 @@ interface
uses
Classes, SysUtils, FileUtil, LCLProc,
Laz_XMLCfg,
IDEProcs, LazConf,
TransferMacros;
Laz_XMLCfg, ProjectIntf,
IDEProcs, LazConf, TransferMacros;
type
@ -167,14 +166,8 @@ type
end;
TCompilationToolClass = class of TCompilationTool;
TCompilationGenerateCode = (
cgcNormalCode,
cgcFasterCode,
cgcSmallerCode
);
TBaseCompilerOptionsClass = class of TBaseCompilerOptions;
TBaseCompilerOptions = class
TBaseCompilerOptions = class(TLazCompilerOptions)
private
FBaseDirectory: string;
FDefaultMakeOptionsFlags: TCompilerCmdLineOptions;
@ -183,9 +176,7 @@ type
fInheritedOptGraphStamps: integer;
fLoaded: Boolean;
FModified: boolean;
FOnModified: TNotifyEvent;
fOptionsString: String;
fOwner: TObject;
FParsedOpts: TParsedCompilerOptions;
fTargetFilename: string;
FWin32GraphicApp: boolean;
@ -278,30 +269,29 @@ type
fCompilerPath: String;
fExecuteBefore: TCompilationTool;
fExecuteAfter: TCompilationTool;
protected
procedure SetBaseDirectory(const AValue: string); virtual;
procedure SetCompilerPath(const AValue: String); virtual;
procedure SetCustomOptions(const AValue: string); virtual;
procedure SetIncludeFiles(const AValue: String); virtual;
procedure SetLibraries(const AValue: String); virtual;
procedure SetLinkerOptions(const AValue: String); virtual;
procedure SetOtherUnitFiles(const AValue: String); virtual;
procedure SetUnitOutputDir(const AValue: string); virtual;
procedure SetObjectPath(const AValue: string); virtual;
procedure SetSrcPath(const AValue: string); virtual;
procedure SetDebugPath(const AValue: string); virtual;
procedure SetTargetCPU(const AValue: string); virtual;
procedure SetTargetProc(const AValue: Integer); virtual;
procedure SetTargetOS(const AValue: string); virtual;
procedure SetBaseDirectory(const AValue: string); override;
procedure SetCompilerPath(const AValue: String); override;
procedure SetCustomOptions(const AValue: string); override;
procedure SetIncludeFiles(const AValue: String); override;
procedure SetLibraries(const AValue: String); override;
procedure SetLinkerOptions(const AValue: String); override;
procedure SetOtherUnitFiles(const AValue: String); override;
procedure SetUnitOutputDir(const AValue: string); override;
procedure SetObjectPath(const AValue: string); override;
procedure SetSrcPath(const AValue: string); override;
procedure SetDebugPath(const AValue: string); override;
procedure SetTargetCPU(const AValue: string); override;
procedure SetTargetProc(const AValue: Integer); override;
procedure SetTargetOS(const AValue: string); override;
procedure SetModified(const AValue: boolean); override;
protected
procedure LoadTheCompilerOptions(const Path: string); virtual;
procedure SaveTheCompilerOptions(const Path: string); virtual;
procedure SetModified(const AValue: boolean); virtual;
procedure ClearInheritedOptions;
procedure SetDefaultMakeOptionsFlags(const AValue: TCompilerCmdLineOptions);
public
constructor Create(const AOwner: TObject); virtual;
constructor Create(const AOwner: TObject); override;
constructor Create(const AOwner: TObject; const AToolClass: TCompilationToolClass);
destructor Destroy; override;
procedure Clear; virtual;
@ -311,7 +301,7 @@ type
procedure LoadCompilerOptions(UseExistingFile: Boolean);
procedure SaveCompilerOptions(UseExistingFile: Boolean);
procedure Assign(CompOpts: TBaseCompilerOptions); virtual;
procedure Assign(Source: TPersistent); override;
function IsEqual(CompOpts: TBaseCompilerOptions): boolean; virtual;
function MakeOptionsString(Globals: TGlobalCompilerOptions;
@ -341,9 +331,6 @@ type
function GetEffectiveLCLWidgetType: string;
public
{ Properties }
property Owner: TObject read fOwner write fOwner;
property Modified: boolean read FModified write SetModified;
property OnModified: TNotifyEvent read FOnModified write FOnModified;
property ParsedOpts: TParsedCompilerOptions read FParsedOpts;
property BaseDirectory: string read FBaseDirectory write SetBaseDirectory;
property TargetFilename: String read fTargetFilename write fTargetFilename;
@ -787,8 +774,7 @@ end;
constructor TBaseCompilerOptions.Create(const AOwner: TObject;
const AToolClass: TCompilationToolClass);
begin
inherited Create;
FOwner := AOwner;
inherited Create(AOwner);
FParsedOpts := TParsedCompilerOptions.Create;
FExecuteBefore := AToolClass.Create;
FExecuteAfter := AToolClass.Create;
@ -2143,8 +2129,15 @@ begin
fExecuteAfter.Clear;
end;
procedure TBaseCompilerOptions.Assign(CompOpts: TBaseCompilerOptions);
procedure TBaseCompilerOptions.Assign(Source: TPersistent);
var
CompOpts: TBaseCompilerOptions;
begin
if not (Source is TBaseCompilerOptions) then begin
inherited Assign(Source);
exit;
end;
CompOpts:=TBaseCompilerOptions(Source);
fOptionsString := CompOpts.fOptionsString;
fLoaded := CompOpts.fLoaded;

View File

@ -38,6 +38,7 @@ interface
uses
Forms, Classes, LCLProc, SysUtils, ComCtrls, Buttons, StdCtrls, ExtCtrls,
Graphics, LResources, FileUtil, Dialogs, Controls, GraphType,
ProjectIntf,
PathEditorDlg, LazarusIDEStrConsts, IDEOptionDefs, LazConf, IDEProcs,
CompilerOptions, ShowCompilerOpts, Project, PackageDefs;

View File

@ -258,7 +258,7 @@ type
function GetOwnerName: string; override;
function GetDefaultMainSourceFileName: string; override;
procedure GetInheritedCompilerOptions(var OptionsList: TList); override;
procedure Assign(CompOpts: TBaseCompilerOptions); override;
procedure Assign(Source: TPersistent); override;
function IsEqual(CompOpts: TBaseCompilerOptions): boolean; override;
public
property OwnerProject: TProject read FOwnerProject;
@ -401,6 +401,7 @@ type
const OldUnitName, NewUnitName: string;
CheckIfAllowed: boolean; var Allowed: boolean);
procedure SetAutoOpenDesignerFormsDisabled(const AValue: boolean);
procedure SetCompilerOptions(const AValue: TProjectCompilerOptions);
procedure SetModified(const AValue: boolean);
procedure SetProjectInfoFile(const NewFilename: string);
procedure SetTargetFilename(const NewTargetFilename: string);
@ -534,7 +535,7 @@ type
write SetAutoOpenDesignerFormsDisabled;
property Bookmarks: TProjectBookmarkList read fBookmarks write fBookmarks;
property CompilerOptions: TProjectCompilerOptions
read fCompilerOptions write fCompilerOptions;
read fCompilerOptions write SetCompilerOptions;
property DefineTemplates: TProjectDefineTemplates read FDefineTemplates;
property Destroying: boolean read fDestroying;
property FirstAutoRevertLockedUnit: TUnitInfo read GetFirstAutoRevertLockedUnit;
@ -1180,7 +1181,7 @@ begin
fActiveEditorIndexAtStart := -1;
FAutoCreateForms := true;
fBookmarks := TProjectBookmarkList.Create;
fCompilerOptions := TProjectCompilerOptions.Create(Self);
CompilerOptions := TProjectCompilerOptions.Create(Self);
FDefineTemplates:=TProjectDefineTemplates.Create(Self);
FFlags:=DefaultProjectFlags;
fIconPath := '';
@ -2511,6 +2512,12 @@ begin
FAutoOpenDesignerFormsDisabled:=AValue;
end;
procedure TProject.SetCompilerOptions(const AValue: TProjectCompilerOptions);
begin
fCompilerOptions:=AValue;
inherited SetLazCompilerOptions(AValue);
end;
function TProject.JumpHistoryCheckPosition(
APosition:TProjectJumpHistoryPosition): boolean;
var i: integer;
@ -2773,11 +2780,11 @@ begin
FGlobals.TargetOS:=TargetOS;
end;
procedure TProjectCompilerOptions.Assign(CompOpts: TBaseCompilerOptions);
procedure TProjectCompilerOptions.Assign(Source: TPersistent);
begin
inherited Assign(CompOpts);
if CompOpts is TProjectCompilerOptions
then FCompileReasons := TProjectCompilerOptions(CompOpts).FCompileReasons
inherited Assign(Source);
if Source is TProjectCompilerOptions
then FCompileReasons := TProjectCompilerOptions(Source).FCompileReasons
else FCompileReasons := [crCompile, crBuild, crRun];
UpdateGlobals;
@ -3050,6 +3057,7 @@ begin
AProject.AddSrcPath('$(LazarusDir)/lcl;'
+'$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)');
AProject.AddPackageDependency('LCL');
AProject.LazCompilerOptions.Win32GraphicApp:=true;
end;
procedure TProjectApplicationDescriptor.CreateStartFiles(AProject: TLazProject
@ -3121,6 +3129,9 @@ end.
{
$Log$
Revision 1.168 2004/10/09 13:24:18 mattias
added compiler options to IDEIntf and made Win32GraphicApp default for application projects
Revision 1.167 2004/10/01 13:18:41 mattias
removed uneeded function TProject.AddNewFile

View File

@ -35,6 +35,200 @@ const
ProjDescNameCustomProgram = 'custom program';
type
{ TLazCompilerOptions }
TCompilationGenerateCode = (
cgcNormalCode,
cgcFasterCode,
cgcSmallerCode
);
TLazCompilerOptions = class(TPersistent)
private
fAdditionalConfigFile: Boolean;
fAllowLabel: Boolean;
fAssemblerStyle: Integer;
fCMacros: Boolean;
fConfigFilePath: String;
fCPPInline: Boolean;
fCStyleOp: Boolean;
fCustomOptions: string;
fD2Ext: Boolean;
FDebugPath: string;
fDelphiCompat: Boolean;
fDontUseConfigFile: Boolean;
FEmulatedFloatOpcodes: boolean;
fGenDebugDBX: Boolean;
fGenDebugInfo: Boolean;
fGenerate: TCompilationGenerateCode;
fGenGProfCode: Boolean;
fGPCCompat: Boolean;
fHeapSize: Integer;
fIncludeAssertionCode: Boolean;
fIncludeFiles: String;
fInitConst: Boolean;
fIOChecks: Boolean;
fLCLWidgetType: string;
fLibraries: String;
fLinkerOptions: String;
fLinkStyle: Integer;
FModified: boolean;
FObjectPath: string;
FOnModified: TNotifyEvent;
fOptLevel: Integer;
fOtherUnitFiles: String;
fOverflowChecks: Boolean;
fOwner: TObject;
fPassLinkerOpt: Boolean;
fRangeChecks: Boolean;
fShowAll: Boolean;
fShowAllProcsOnError: Boolean;
fShowCompProc: Boolean;
fShowCond: Boolean;
fShowDebugInfo: Boolean;
fShowDefMacros: Boolean;
fShowErrors: Boolean;
fShowGenInfo: Boolean;
fShowHints: Boolean;
fShowHintsForUnusedUnitsInMainSrc: Boolean;
fShowLineNum: Boolean;
fShowNotes: Boolean;
fShowNothing: Boolean;
fShowTriedFiles: Boolean;
fShowUsedFiles: Boolean;
fShowWarn: Boolean;
FSrcPath: string;
fStackChecks: Boolean;
fStaticKwd: Boolean;
fStopAfterErrCount: integer;
fStripSymbols: Boolean;
fTargetCPU: string;
fTargetOS: string;
fTargetProc: Integer;
fTPCompat: Boolean;
fUncertainOpt: Boolean;
fUnitOutputDir: string;
fUnitStyle: Integer;
fUseAnsiStr: Boolean;
fUseHeaptrc: Boolean;
fUseLineInfoUnit: Boolean;
fUseValgrind: Boolean;
fVarsInReg: Boolean;
FWin32GraphicApp: boolean;
fWriteFPCLogo: Boolean;
protected
procedure SetBaseDirectory(const AValue: string); virtual; abstract;
procedure SetCompilerPath(const AValue: String); virtual; abstract;
procedure SetCustomOptions(const AValue: string); virtual; abstract;
procedure SetIncludeFiles(const AValue: String); virtual; abstract;
procedure SetLibraries(const AValue: String); virtual; abstract;
procedure SetLinkerOptions(const AValue: String); virtual; abstract;
procedure SetOtherUnitFiles(const AValue: String); virtual; abstract;
procedure SetUnitOutputDir(const AValue: string); virtual; abstract;
procedure SetObjectPath(const AValue: string); virtual; abstract;
procedure SetSrcPath(const AValue: string); virtual; abstract;
procedure SetDebugPath(const AValue: string); virtual; abstract;
procedure SetTargetCPU(const AValue: string); virtual; abstract;
procedure SetTargetProc(const AValue: Integer); virtual; abstract;
procedure SetTargetOS(const AValue: string); virtual; abstract;
procedure SetModified(const AValue: boolean); virtual; abstract;
public
constructor Create(const TheOwner: TObject); virtual;
public
property Owner: TObject read fOwner write fOwner;
property Modified: boolean read FModified write SetModified;
property OnModified: TNotifyEvent read FOnModified write FOnModified;
// search paths:
property IncludeFiles: String read fIncludeFiles write SetIncludeFiles;
property Libraries: String read fLibraries write SetLibraries;
property OtherUnitFiles: String read fOtherUnitFiles write SetOtherUnitFiles;
property ObjectPath: string read FObjectPath write SetObjectPath;
property SrcPath: string read FSrcPath write SetSrcPath;
property UnitOutputDirectory: string read fUnitOutputDir write SetUnitOutputDir;
property DebugPath: string read FDebugPath write SetDebugPath;
property LCLWidgetType: string read fLCLWidgetType write fLCLWidgetType;
// parsing:
property AssemblerStyle: Integer read fAssemblerStyle write fAssemblerStyle;
property D2Extensions: Boolean read fD2Ext write fD2Ext;
property CStyleOperators: Boolean read fCStyleOp write fCStyleOp;
property IncludeAssertionCode: Boolean
read fIncludeAssertionCode write fIncludeAssertionCode;
property DelphiCompat: Boolean read fDelphiCompat write fDelphiCompat;
property AllowLabel: Boolean read fAllowLabel write fAllowLabel;
property UseAnsiStrings: Boolean read fUseAnsiStr write fUseAnsiStr;
property CPPInline: Boolean read fCPPInline write fCPPInline;
property CStyleMacros: Boolean read fCMacros write fCMacros;
property TPCompatible: Boolean read fTPCompat write fTPCompat;
property GPCCompat: Boolean read fGPCCompat write fGPCCompat;
property InitConstructor: Boolean read fInitConst write fInitConst;
property StaticKeyword: Boolean read fStaticKwd write fStaticKwd;
// code generation:
property UnitStyle: Integer read fUnitStyle write fUnitStyle;
property IOChecks: Boolean read fIOChecks write fIOChecks;
property RangeChecks: Boolean read fRangeChecks write fRangeChecks;
property OverflowChecks: Boolean read fOverflowChecks write fOverflowChecks;
property StackChecks: Boolean read fStackChecks write fStackChecks;
property EmulatedFloatOpcodes: boolean read FEmulatedFloatOpcodes
write FEmulatedFloatOpcodes;
property HeapSize: Integer read fHeapSize write fHeapSize;
property VerifyObjMethodCall: boolean read FEmulatedFloatOpcodes
write FEmulatedFloatOpcodes;
property Generate: TCompilationGenerateCode read fGenerate write fGenerate;
property TargetCPU: string read fTargetCPU write SetTargetCPU; // general type
property TargetProcessor: Integer read fTargetProc write SetTargetProc; // specific
property TargetOS: string read fTargetOS write SetTargetOS;
property VariablesInRegisters: Boolean read fVarsInReg write fVarsInReg;
property UncertainOptimizations: Boolean read fUncertainOpt write fUncertainOpt;
property OptimizationLevel: Integer read fOptLevel write fOptLevel;
// linking:
property GenerateDebugInfo: Boolean read fGenDebugInfo write fGenDebugInfo;
property GenerateDebugDBX: Boolean read fGenDebugDBX write fGenDebugDBX;
property UseLineInfoUnit: Boolean read fUseLineInfoUnit write fUseLineInfoUnit;
property UseHeaptrc: Boolean read fUseHeaptrc write fUseHeaptrc;
property UseValgrind: Boolean read fUseValgrind write fUseValgrind;
property GenGProfCode: Boolean read fGenGProfCode write fGenGProfCode;
property StripSymbols: Boolean read fStripSymbols write fStripSymbols;
property LinkStyle: Integer read fLinkStyle write fLinkStyle;
property PassLinkerOptions: Boolean read fPassLinkerOpt write fPassLinkerOpt;
property LinkerOptions: String read fLinkerOptions write SetLinkerOptions;
property Win32GraphicApp: boolean read FWin32GraphicApp write FWin32GraphicApp;
// messages:
property ShowErrors: Boolean read fShowErrors write fShowErrors;
property ShowWarn: Boolean read fShowWarn write fShowWarn;
property ShowNotes: Boolean read fShowNotes write fShowNotes;
property ShowHints: Boolean read fShowHints write fShowHints;
property ShowGenInfo: Boolean read fShowGenInfo write fShowGenInfo;
property ShowLineNum: Boolean read fShowLineNum write fShowLineNum;
property ShowAll: Boolean read fShowAll write fShowAll;
property ShowAllProcsOnError: Boolean
read fShowAllProcsOnError write fShowAllProcsOnError;
property ShowDebugInfo: Boolean read fShowDebugInfo write fShowDebugInfo;
property ShowUsedFiles: Boolean read fShowUsedFiles write fShowUsedFiles;
property ShowTriedFiles: Boolean read fShowTriedFiles write fShowTriedFiles;
property ShowDefMacros: Boolean read fShowDefMacros write fShowDefMacros;
property ShowCompProc: Boolean read fShowCompProc write fShowCompProc;
property ShowCond: Boolean read fShowCond write fShowCond;
property ShowNothing: Boolean read fShowNothing write fShowNothing;
property ShowHintsForUnusedUnitsInMainSrc: Boolean
read fShowHintsForUnusedUnitsInMainSrc write fShowHintsForUnusedUnitsInMainSrc;
property WriteFPCLogo: Boolean read fWriteFPCLogo write fWriteFPCLogo;
property StopAfterErrCount: integer
read fStopAfterErrCount write fStopAfterErrCount;
// other
property DontUseConfigFile: Boolean read fDontUseConfigFile
write fDontUseConfigFile;
property AdditionalConfigFile: Boolean read fAdditionalConfigFile
write fAdditionalConfigFile;
property ConfigFilePath: String read fConfigFilePath write fConfigFilePath;
property CustomOptions: string read fCustomOptions write SetCustomOptions;
end;
{ TLazProjectFile }
TLazProjectFile = class(TPersistent)
@ -204,8 +398,10 @@ type
TLazProject = class(TPersistent)
private
FFlags: TProjectFlags;
FLazCompilerOptions: TLazCompilerOptions;
fTitle: String;
protected
procedure SetLazCompilerOptions(const AValue: TLazCompilerOptions);
function GetMainFile: TLazProjectFile; virtual; abstract;
function GetMainFileID: Integer; virtual; abstract;
procedure SetMainFileID(const AValue: Integer); virtual; abstract;
@ -230,6 +426,8 @@ type
property MainFile: TLazProjectFile read GetMainFile;
property Title: String read fTitle write SetTitle;
property Flags: TProjectFlags read FFlags write SetFlags;
property LazCompilerOptions: TLazCompilerOptions read FLazCompilerOptions
write SetLazCompilerOptions;
end;
@ -588,6 +786,12 @@ begin
FFlags:=AValue;
end;
procedure TLazProject.SetLazCompilerOptions(const AValue: TLazCompilerOptions);
begin
if FLazCompilerOptions=AValue then exit;
FLazCompilerOptions:=AValue;
end;
procedure TLazProject.SetTitle(const AValue: String);
begin
if fTitle=AValue then exit;
@ -606,6 +810,14 @@ begin
FIsPartOfProject:=AValue;
end;
{ TLazCompilerOptions }
constructor TLazCompilerOptions.Create(const TheOwner: TObject);
begin
inherited Create;
FOwner := TheOwner;
end;
initialization
ProjectFileDescriptors:=nil;

View File

@ -345,7 +345,7 @@ type
function GetDefaultMainSourceFileName: string; override;
function CreateTargetFilename(const MainSourceFileName: string): string; override;
procedure Assign(CompOpts: TBaseCompilerOptions); override;
procedure Assign(Source: TPersistent); override;
function IsEqual(CompOpts: TBaseCompilerOptions): boolean; override;
public
property LazPackage: TLazPackage read FLazPackage write SetLazPackage;
@ -3143,12 +3143,12 @@ begin
Result:='';
end;
procedure TPkgCompilerOptions.Assign(CompOpts: TBaseCompilerOptions);
procedure TPkgCompilerOptions.Assign(Source: TPersistent);
begin
inherited Assign(CompOpts);
if CompOpts is TPkgCompilerOptions
inherited Assign(Source);
if Source is TPkgCompilerOptions
then begin
FSkipCompiler := TPkgCompilerOptions(CompOpts).FSkipCompiler;
FSkipCompiler := TPkgCompilerOptions(Source).FSkipCompiler;
end
else begin
FSkipCompiler := False;