mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-12 15:28:36 +02:00
implemented compiler options ExecutableType
git-svn-id: trunk@8787 -
This commit is contained in:
parent
e0e2b0cd0e
commit
8ee1876b6e
@ -295,6 +295,7 @@ type
|
|||||||
Flags: TCompilerCmdLineOptions): String; virtual;
|
Flags: TCompilerCmdLineOptions): String; virtual;
|
||||||
function GetXMLConfigPath: String; virtual;
|
function GetXMLConfigPath: String; virtual;
|
||||||
function CreateTargetFilename(const MainSourceFileName: string): string; virtual;
|
function CreateTargetFilename(const MainSourceFileName: string): string; virtual;
|
||||||
|
function GetTargetFileExt: string; virtual;
|
||||||
procedure GetInheritedCompilerOptions(var OptionsList: TList); virtual;
|
procedure GetInheritedCompilerOptions(var OptionsList: TList); virtual;
|
||||||
function GetOwnerName: string; virtual;
|
function GetOwnerName: string; virtual;
|
||||||
function GetInheritedOption(Option: TInheritedCompilerOption;
|
function GetInheritedOption(Option: TInheritedCompilerOption;
|
||||||
@ -1064,6 +1065,9 @@ begin
|
|||||||
PassLinkerOptions := XMLConfigFile.GetValue(p+'Options/PassLinkerOptions/Value', false);
|
PassLinkerOptions := XMLConfigFile.GetValue(p+'Options/PassLinkerOptions/Value', false);
|
||||||
LinkerOptions := f(XMLConfigFile.GetValue(p+'Options/LinkerOptions/Value', ''));
|
LinkerOptions := f(XMLConfigFile.GetValue(p+'Options/LinkerOptions/Value', ''));
|
||||||
Win32GraphicApp := XMLConfigFile.GetValue(p+'Options/Win32/GraphicApplication/Value', false);
|
Win32GraphicApp := XMLConfigFile.GetValue(p+'Options/Win32/GraphicApplication/Value', false);
|
||||||
|
ExecutableType := CompilationExecutableTypeNameToType(
|
||||||
|
XMLConfigFile.GetValue(p+'Options/ExecutableType/Value',''));
|
||||||
|
//DebugLn('TBaseCompilerOptions.LoadTheCompilerOptions ',CompilationExecutableTypeNames[ExecutableType]);
|
||||||
|
|
||||||
{ Messages }
|
{ Messages }
|
||||||
p:=Path+'Other/';
|
p:=Path+'Other/';
|
||||||
@ -1210,6 +1214,10 @@ begin
|
|||||||
XMLConfigFile.SetDeleteValue(p+'Options/PassLinkerOptions/Value', PassLinkerOptions,false);
|
XMLConfigFile.SetDeleteValue(p+'Options/PassLinkerOptions/Value', PassLinkerOptions,false);
|
||||||
XMLConfigFile.SetDeleteValue(p+'Options/LinkerOptions/Value', LinkerOptions,'');
|
XMLConfigFile.SetDeleteValue(p+'Options/LinkerOptions/Value', LinkerOptions,'');
|
||||||
XMLConfigFile.SetDeleteValue(p+'Options/Win32/GraphicApplication/Value', Win32GraphicApp,false);
|
XMLConfigFile.SetDeleteValue(p+'Options/Win32/GraphicApplication/Value', Win32GraphicApp,false);
|
||||||
|
XMLConfigFile.SetDeleteValue(p+'Options/ExecutableType/Value',
|
||||||
|
CompilationExecutableTypeNames[ExecutableType],
|
||||||
|
CompilationExecutableTypeNames[cetProgram]);
|
||||||
|
//DebugLn('TBaseCompilerOptions.SaveCompilerOptions ',CompilationExecutableTypeNames[ExecutableType]);
|
||||||
|
|
||||||
{ Messages }
|
{ Messages }
|
||||||
p:=Path+'Other/';
|
p:=Path+'Other/';
|
||||||
@ -1286,7 +1294,7 @@ function TBaseCompilerOptions.CreateTargetFilename(
|
|||||||
Ext: String;
|
Ext: String;
|
||||||
begin
|
begin
|
||||||
if (ExtractFileName(Result)='') or (ExtractFileExt(Result)<>'') then exit;
|
if (ExtractFileName(Result)='') or (ExtractFileExt(Result)<>'') then exit;
|
||||||
Ext:=GetDefaultExecutableExt;
|
Ext:=GetTargetFileExt;
|
||||||
if Ext<>'' then begin
|
if Ext<>'' then begin
|
||||||
Result:=Result+Ext;
|
Result:=Result+Ext;
|
||||||
exit;
|
exit;
|
||||||
@ -1321,6 +1329,29 @@ begin
|
|||||||
AppendDefaultExt;
|
AppendDefaultExt;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBaseCompilerOptions.GetTargetFileExt: string;
|
||||||
|
begin
|
||||||
|
case ExecutableType of
|
||||||
|
cetProgram:
|
||||||
|
begin
|
||||||
|
if CompareText(fTargetOS, 'win32') = 0 then
|
||||||
|
Result:='.exe'
|
||||||
|
else
|
||||||
|
Result:=GetDefaultExecutableExt;
|
||||||
|
end;
|
||||||
|
cetLibrary:
|
||||||
|
begin
|
||||||
|
if CompareText(fTargetOS, 'win32') = 0 then
|
||||||
|
Result:='.dll'
|
||||||
|
else
|
||||||
|
Result:=GetDefaultLibraryExt;
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
RaiseGDBException('');
|
||||||
|
end;
|
||||||
|
//DebugLn('TBaseCompilerOptions.GetTargetFileExt ',Result);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBaseCompilerOptions.GetInheritedCompilerOptions(
|
procedure TBaseCompilerOptions.GetInheritedCompilerOptions(
|
||||||
var OptionsList: TList);
|
var OptionsList: TList);
|
||||||
begin
|
begin
|
||||||
@ -2225,6 +2256,7 @@ begin
|
|||||||
fPassLinkerOpt := false;
|
fPassLinkerOpt := false;
|
||||||
LinkerOptions := '';
|
LinkerOptions := '';
|
||||||
Win32GraphicApp := false;
|
Win32GraphicApp := false;
|
||||||
|
ExecutableType := cetProgram;
|
||||||
|
|
||||||
// messages
|
// messages
|
||||||
fShowErrors := true;
|
fShowErrors := true;
|
||||||
@ -2329,6 +2361,7 @@ begin
|
|||||||
fPassLinkerOpt := CompOpts.fPassLinkerOpt;
|
fPassLinkerOpt := CompOpts.fPassLinkerOpt;
|
||||||
LinkerOptions := CompOpts.fLinkerOptions;
|
LinkerOptions := CompOpts.fLinkerOptions;
|
||||||
Win32GraphicApp := CompOpts.Win32GraphicApp;
|
Win32GraphicApp := CompOpts.Win32GraphicApp;
|
||||||
|
ExecutableType := CompOpts.ExecutableType;
|
||||||
|
|
||||||
// Messages
|
// Messages
|
||||||
fShowErrors := CompOpts.fShowErrors;
|
fShowErrors := CompOpts.fShowErrors;
|
||||||
@ -2423,6 +2456,7 @@ begin
|
|||||||
and (fPassLinkerOpt = CompOpts.fPassLinkerOpt)
|
and (fPassLinkerOpt = CompOpts.fPassLinkerOpt)
|
||||||
and (fLinkerOptions = CompOpts.fLinkerOptions)
|
and (fLinkerOptions = CompOpts.fLinkerOptions)
|
||||||
and (FWin32GraphicApp = CompOpts.FWin32GraphicApp)
|
and (FWin32GraphicApp = CompOpts.FWin32GraphicApp)
|
||||||
|
and (FExecutableType = CompOpts.FExecutableType)
|
||||||
|
|
||||||
// messages
|
// messages
|
||||||
and (fShowErrors = CompOpts.fShowErrors)
|
and (fShowErrors = CompOpts.fShowErrors)
|
||||||
|
@ -42,6 +42,11 @@ begin
|
|||||||
Result:='darwin';
|
Result:='darwin';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetDefaultLibraryExt: string;
|
||||||
|
begin
|
||||||
|
Result:='.dynlib';
|
||||||
|
end;
|
||||||
|
|
||||||
procedure IfDirectoryExistsAdd(const Directory: string; List: TStrings);
|
procedure IfDirectoryExistsAdd(const Directory: string; List: TStrings);
|
||||||
begin
|
begin
|
||||||
if DirPathExists(Directory) then List.Add(Directory);
|
if DirPathExists(Directory) then List.Add(Directory);
|
||||||
|
@ -46,6 +46,11 @@ procedure GetDefaultLCLLibPaths(List: TStrings);
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetDefaultLibraryExt: string;
|
||||||
|
begin
|
||||||
|
Result:='.so';
|
||||||
|
end;
|
||||||
|
|
||||||
{$I ../unix/lazbaseconf.inc}
|
{$I ../unix/lazbaseconf.inc}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +46,11 @@ procedure GetDefaultLCLLibPaths(List: TStrings);
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetDefaultLibraryExt: string;
|
||||||
|
begin
|
||||||
|
Result:='.so';
|
||||||
|
end;
|
||||||
|
|
||||||
{$I ../unix/lazbaseconf.inc}
|
{$I ../unix/lazbaseconf.inc}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4258,6 +4258,7 @@ begin
|
|||||||
MainFile.IsPartOfProject:=true;
|
MainFile.IsPartOfProject:=true;
|
||||||
AProject.AddFile(MainFile,false);
|
AProject.AddFile(MainFile,false);
|
||||||
AProject.MainFileID:=0;
|
AProject.MainFileID:=0;
|
||||||
|
AProject.LazCompilerOptions.ExecutableType:=cetLibrary;
|
||||||
|
|
||||||
// create program source
|
// create program source
|
||||||
le:=LineEnding;
|
le:=LineEnding;
|
||||||
|
@ -47,6 +47,11 @@ type
|
|||||||
cgcSmallerCode
|
cgcSmallerCode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
TCompilationExecutableType = (
|
||||||
|
cetProgram,
|
||||||
|
cetLibrary
|
||||||
|
);
|
||||||
|
|
||||||
{ TLazCompilerOptions }
|
{ TLazCompilerOptions }
|
||||||
|
|
||||||
TLazCompilerOptions = class(TPersistent)
|
TLazCompilerOptions = class(TPersistent)
|
||||||
@ -113,6 +118,7 @@ type
|
|||||||
fPassLinkerOpt: Boolean;
|
fPassLinkerOpt: Boolean;
|
||||||
fLinkerOptions: String;
|
fLinkerOptions: String;
|
||||||
FWin32GraphicApp: boolean;
|
FWin32GraphicApp: boolean;
|
||||||
|
FExecutableType: TCompilationExecutableType;
|
||||||
|
|
||||||
// Messages:
|
// Messages:
|
||||||
fShowErrors: Boolean;
|
fShowErrors: Boolean;
|
||||||
@ -221,6 +227,8 @@ type
|
|||||||
property PassLinkerOptions: Boolean read fPassLinkerOpt write fPassLinkerOpt;
|
property PassLinkerOptions: Boolean read fPassLinkerOpt write fPassLinkerOpt;
|
||||||
property LinkerOptions: String read fLinkerOptions write SetLinkerOptions;
|
property LinkerOptions: String read fLinkerOptions write SetLinkerOptions;
|
||||||
property Win32GraphicApp: boolean read FWin32GraphicApp write FWin32GraphicApp;
|
property Win32GraphicApp: boolean read FWin32GraphicApp write FWin32GraphicApp;
|
||||||
|
property ExecutableType: TCompilationExecutableType
|
||||||
|
read FExecutableType write FExecutableType;
|
||||||
|
|
||||||
// messages:
|
// messages:
|
||||||
property ShowErrors: Boolean read fShowErrors write fShowErrors;
|
property ShowErrors: Boolean read fShowErrors write fShowErrors;
|
||||||
@ -602,9 +610,16 @@ const
|
|||||||
'None'
|
'None'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CompilationExecutableTypeNames: array[TCompilationExecutableType] of string =(
|
||||||
|
'Program',
|
||||||
|
'Library'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
function ProjectFlagsToStr(Flags: TProjectFlags): string;
|
function ProjectFlagsToStr(Flags: TProjectFlags): string;
|
||||||
function StrToProjectSessionStorage(const s: string): TProjectSessionStorage;
|
function StrToProjectSessionStorage(const s: string): TProjectSessionStorage;
|
||||||
|
function CompilationExecutableTypeNameToType(const s: string
|
||||||
|
): TCompilationExecutableType;
|
||||||
|
|
||||||
procedure RegisterProjectFileDescriptor(FileDesc: TProjectFileDescriptor);
|
procedure RegisterProjectFileDescriptor(FileDesc: TProjectFileDescriptor);
|
||||||
procedure RegisterProjectDescriptor(ProjDesc: TProjectDescriptor);
|
procedure RegisterProjectDescriptor(ProjDesc: TProjectDescriptor);
|
||||||
@ -710,6 +725,14 @@ begin
|
|||||||
Result:=pssInProjectInfo;
|
Result:=pssInProjectInfo;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CompilationExecutableTypeNameToType(const s: string
|
||||||
|
): TCompilationExecutableType;
|
||||||
|
begin
|
||||||
|
for Result:=Low(TCompilationExecutableType) to High(TCompilationExecutableType)
|
||||||
|
do if CompareText(s,CompilationExecutableTypeNames[Result])=0 then exit;
|
||||||
|
Result:=cetProgram;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TProjectFileDescriptor }
|
{ TProjectFileDescriptor }
|
||||||
|
|
||||||
procedure TProjectFileDescriptor.SetResourceClass(
|
procedure TProjectFileDescriptor.SetResourceClass(
|
||||||
|
Loading…
Reference in New Issue
Block a user