mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-07 05:49:33 +01:00
IDE: reorder few things in TLazarusBuilder.CreateIDEMakeOptions. Prepare to split it.
git-svn-id: trunk@44064 -
This commit is contained in:
parent
6e4452893c
commit
22aab4f9a6
@ -162,6 +162,7 @@ type
|
|||||||
fOutputDirRedirected: boolean;
|
fOutputDirRedirected: boolean;
|
||||||
fTargetFilename: string;
|
fTargetFilename: string;
|
||||||
fTargetDir: string;
|
fTargetDir: string;
|
||||||
|
fUnitOutDir: string;
|
||||||
fWorkingDir: string;
|
fWorkingDir: string;
|
||||||
fProfileChanged: boolean;
|
fProfileChanged: boolean;
|
||||||
// Methods used by MakeLazarus :
|
// Methods used by MakeLazarus :
|
||||||
@ -646,13 +647,11 @@ end;
|
|||||||
|
|
||||||
function TLazarusBuilder.CreateIDEMakeOptions(Flags: TBuildLazarusFlags): TModalResult;
|
function TLazarusBuilder.CreateIDEMakeOptions(Flags: TBuildLazarusFlags): TModalResult;
|
||||||
var
|
var
|
||||||
UnitOutDir, LazDir, s: string;
|
LazDir: string;
|
||||||
DefaultTargetOS, TargetOS: string;
|
DefaultTargetOS, TargetOS: string;
|
||||||
DefaultTargetCPU, TargetCPU: string;
|
DefaultTargetCPU, TargetCPU: string;
|
||||||
DefaultTargetFilename, TargetLCLPlatform: string;
|
DefaultTargetFilename, TargetLCLPlatform: string;
|
||||||
CrossCompiling: Boolean;
|
CrossCompiling: Boolean;
|
||||||
NewTargetDirectoryIsDefault: Boolean;
|
|
||||||
NewTargetFilenameIsDefault: Boolean;
|
|
||||||
begin
|
begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
fOutputDirRedirected:=false;
|
fOutputDirRedirected:=false;
|
||||||
@ -678,8 +677,7 @@ begin
|
|||||||
// Otherwise: Don't touch the target filename.
|
// Otherwise: Don't touch the target filename.
|
||||||
|
|
||||||
fTargetFilename:='';
|
fTargetFilename:='';
|
||||||
UnitOutDir:='';
|
fUnitOutDir:='';
|
||||||
fTargetDir:='';
|
|
||||||
CodeToolBoss.FPCDefinesCache.ConfigCaches.GetDefaultCompilerTarget(
|
CodeToolBoss.FPCDefinesCache.ConfigCaches.GetDefaultCompilerTarget(
|
||||||
EnvironmentOptions.GetParsedCompilerFilename,'',DefaultTargetOS,DefaultTargetCPU);
|
EnvironmentOptions.GetParsedCompilerFilename,'',DefaultTargetOS,DefaultTargetCPU);
|
||||||
if DefaultTargetOS='' then
|
if DefaultTargetOS='' then
|
||||||
@ -704,9 +702,9 @@ begin
|
|||||||
Result:=mrAbort;
|
Result:=mrAbort;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
UnitOutDir:=AppendPathDelim(fTargetDir)+'units';
|
fUnitOutDir:=AppendPathDelim(fTargetDir)+'units';
|
||||||
debugln('CreateBuildLazarusOptions TargetDirectory=',fTargetDir);
|
debugln('CreateBuildLazarusOptions TargetDirectory=',fTargetDir);
|
||||||
debugln('CreateBuildLazarusOptions UnitsTargetDirectory=',UnitOutDir);
|
debugln('CreateBuildLazarusOptions UnitsTargetDirectory=',fUnitOutDir);
|
||||||
end else begin
|
end else begin
|
||||||
// no user defined target directory
|
// no user defined target directory
|
||||||
// => find it automatically
|
// => find it automatically
|
||||||
@ -718,7 +716,7 @@ begin
|
|||||||
fTargetDir:=AppendPathDelim(GetPrimaryConfigPath)+'bin'
|
fTargetDir:=AppendPathDelim(GetPrimaryConfigPath)+'bin'
|
||||||
+PathDelim+TargetCPU+'-'+TargetOS;
|
+PathDelim+TargetCPU+'-'+TargetOS;
|
||||||
// ppu files to <primary config dir>/units/<TargetCPU>-<TargetOS>/<LCLWidgetType>
|
// ppu files to <primary config dir>/units/<TargetCPU>-<TargetOS>/<LCLWidgetType>
|
||||||
UnitOutDir:=AppendPathDelim(GetPrimaryConfigPath)+'units'
|
fUnitOutDir:=AppendPathDelim(GetPrimaryConfigPath)+'units'
|
||||||
+PathDelim+TargetCPU+'-'+TargetOS+PathDelim+TargetLCLPlatform;
|
+PathDelim+TargetCPU+'-'+TargetOS+PathDelim+TargetLCLPlatform;
|
||||||
debugln('CreateBuildLazarusOptions Options.TargetOS=',fProfile.FPCTargetOS,' Options.TargetCPU=',
|
debugln('CreateBuildLazarusOptions Options.TargetOS=',fProfile.FPCTargetOS,' Options.TargetCPU=',
|
||||||
fProfile.FPCTargetCPU,' DefaultOS=',DefaultTargetOS,' DefaultCPU=',DefaultTargetCPU);
|
fProfile.FPCTargetCPU,' DefaultOS=',DefaultTargetOS,' DefaultCPU=',DefaultTargetCPU);
|
||||||
@ -736,12 +734,12 @@ begin
|
|||||||
fUpdateRevInc:=false;
|
fUpdateRevInc:=false;
|
||||||
fTargetDir:=AppendPathDelim(GetPrimaryConfigPath)+'bin';
|
fTargetDir:=AppendPathDelim(GetPrimaryConfigPath)+'bin';
|
||||||
debugln('CreateBuildLazarusOptions LazDir readonly NewTargetDirectory=',fTargetDir);
|
debugln('CreateBuildLazarusOptions LazDir readonly NewTargetDirectory=',fTargetDir);
|
||||||
UnitOutDir:=AppendPathDelim(GetPrimaryConfigPath)+'units'
|
fUnitOutDir:=AppendPathDelim(GetPrimaryConfigPath)+'units'
|
||||||
+PathDelim+TargetCPU+'-'+TargetOS+PathDelim+TargetLCLPlatform;
|
+PathDelim+TargetCPU+'-'+TargetOS+PathDelim+TargetLCLPlatform;
|
||||||
end else begin
|
end else begin
|
||||||
// Case 4. the lazarus directory is writable
|
// Case 4. the lazarus directory is writable
|
||||||
// ppu files to <lazarusdir>/units/<TargetCPU>-<TargetOS>/<LCLWidgetType>
|
// ppu files to <lazarusdir>/units/<TargetCPU>-<TargetOS>/<LCLWidgetType>
|
||||||
UnitOutDir:=AppendPathDelim(fTargetDir)+'units'
|
fUnitOutDir:=AppendPathDelim(fTargetDir)+'units'
|
||||||
+PathDelim+TargetCPU+'-'+TargetOS+PathDelim+TargetLCLPlatform;
|
+PathDelim+TargetCPU+'-'+TargetOS+PathDelim+TargetLCLPlatform;
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
@ -760,54 +758,48 @@ begin
|
|||||||
if not FilenameIsAbsolute(fTargetFilename) then
|
if not FilenameIsAbsolute(fTargetFilename) then
|
||||||
fTargetFilename:=TrimFilename(AppendPathDelim(fTargetDir)+fTargetFilename);
|
fTargetFilename:=TrimFilename(AppendPathDelim(fTargetDir)+fTargetFilename);
|
||||||
|
|
||||||
|
// check if target file is default
|
||||||
|
fOutputDirRedirected:=CompareFilenames(ChompPathDelim(LazDir),
|
||||||
|
ChompPathDelim(fTargetDir))<>0;
|
||||||
|
// ---Cut---
|
||||||
// backup old exe
|
// backup old exe
|
||||||
BackupExe(Flags);
|
BackupExe(Flags);
|
||||||
|
|
||||||
// check if target file is default
|
|
||||||
NewTargetDirectoryIsDefault:=CompareFilenames(ChompPathDelim(LazDir),
|
|
||||||
ChompPathDelim(fTargetDir))=0;
|
|
||||||
NewTargetFilenameIsDefault:=NewTargetDirectoryIsDefault;
|
|
||||||
if NewTargetFilenameIsDefault then begin
|
|
||||||
s:=CreateRelativePath(fTargetFilename,fTargetDir);
|
|
||||||
NewTargetFilenameIsDefault:=s=DefaultTargetFilename;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// create output directories
|
// create output directories
|
||||||
if not NewTargetDirectoryIsDefault then begin
|
if fOutputDirRedirected then begin
|
||||||
Result:=ForceDirectoryInteractive(fTargetDir,[]);
|
Result:=ForceDirectoryInteractive(fTargetDir,[]);
|
||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
end;
|
end;
|
||||||
if UnitOutDir<>'' then begin
|
if fUnitOutDir<>'' then begin
|
||||||
Result:=ForceDirectoryInteractive(UnitOutDir,[]);
|
Result:=ForceDirectoryInteractive(fUnitOutDir,[]);
|
||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
fOutputDirRedirected:=not NewTargetDirectoryIsDefault;
|
|
||||||
|
|
||||||
// create apple bundle if needed
|
// create apple bundle if needed
|
||||||
//debugln(['CreateBuildLazarusOptions NewTargetDirectory=',fTargetDir]);
|
//debugln(['CreateBuildLazarusOptions NewTargetDirectory=',fTargetDir]);
|
||||||
if (fProfile.TargetPlatform in [lpCarbon,lpCocoa])
|
if (fProfile.TargetPlatform in [lpCarbon,lpCocoa])
|
||||||
and (not NewTargetDirectoryIsDefault) and (DirectoryIsWritableCached(fTargetDir)) then
|
and fOutputDirRedirected and DirectoryIsWritableCached(fTargetDir) then
|
||||||
begin
|
begin
|
||||||
Result:=CreateAppleBundle;
|
Result:=CreateAppleBundle;
|
||||||
if not (Result in [mrOk,mrIgnore]) then Exit;
|
if not (Result in [mrOk,mrIgnore]) then Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if UnitOutDir<>'' then
|
if fUnitOutDir<>'' then
|
||||||
// FPC interpretes '\ ' as an escape for a space in a path on Windows,
|
// FPC interpretes '\ ' as an escape for a space in a path on Windows,
|
||||||
// so make sure the directory doesn't end with the path delimiter.
|
// so make sure the directory doesn't end with the path delimiter.
|
||||||
AppendExtraOption('-FU'+ChompPathDelim(UnitOutDir));
|
AppendExtraOption('-FU'+ChompPathDelim(fUnitOutDir));
|
||||||
|
|
||||||
if fTargetDir<>'' then
|
if fTargetDir<>'' then
|
||||||
// FPC interpretes '\ ' as an escape for a space in a path on Windows,
|
// FPC interpretes '\ ' as an escape for a space in a path on Windows,
|
||||||
// so make sure the directory doesn't end with the path delimiter.
|
// so make sure the directory doesn't end with the path delimiter.
|
||||||
AppendExtraOption('-FE'+ChompPathDelim(fTargetDir));
|
AppendExtraOption('-FE'+ChompPathDelim(fTargetDir));
|
||||||
|
|
||||||
if not NewTargetFilenameIsDefault then begin
|
if fOutputDirRedirected then begin
|
||||||
// Note: FPC automatically changes the last extension (append or replace)
|
// Note: FPC automatically changes the last extension (append or replace)
|
||||||
// For example under linux, where executables don't need any extension
|
// For example under linux, where executables don't need any extension
|
||||||
// fpc removes the last extension of the -o option.
|
// fpc removes the last extension of the -o option.
|
||||||
AppendExtraOption('-o'+fTargetFilename);
|
if CreateRelativePath(fTargetFilename,fTargetDir) <> DefaultTargetFilename then
|
||||||
|
AppendExtraOption('-o'+fTargetFilename);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// add package options for IDE
|
// add package options for IDE
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user