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