IDE: Search in the right location for the compiled units in a Lazarus-package, compiled/installed by FPMake

git-svn-id: trunk@59720 -
This commit is contained in:
joost 2018-12-03 18:58:42 +00:00
parent 0c07ac1983
commit 0e016b16dc
4 changed files with 35 additions and 13 deletions

View File

@ -99,13 +99,11 @@ procedure Register;
var var
OptionsGroup: Integer; OptionsGroup: Integer;
begin begin
FppkgOptions := TFppkgEnvironmentOptions.Create; TFppkgEnvironmentOptions.GetInstance;
OptionsGroup := GetFreeIDEOptionsGroupIndex(GroupEditor); OptionsGroup := GetFreeIDEOptionsGroupIndex(GroupEditor);
RegisterIDEOptionsGroup(OptionsGroup, TFppkgEnvironmentOptions); RegisterIDEOptionsGroup(OptionsGroup, TFppkgEnvironmentOptions);
RegisterIDEOptionsEditor(OptionsGroup, TFppkgEnvironmentOptionsFrame, 1); RegisterIDEOptionsEditor(OptionsGroup, TFppkgEnvironmentOptionsFrame, 1);
FppkgOptions.Load();
end; end;
{ TFppkgEnvironmentOptionsFrame } { TFppkgEnvironmentOptionsFrame }
@ -161,6 +159,11 @@ end;
class function TFppkgEnvironmentOptions.GetInstance: TAbstractIDEOptions; class function TFppkgEnvironmentOptions.GetInstance: TAbstractIDEOptions;
begin begin
if not Assigned(FppkgOptions) then
begin
FppkgOptions := TFppkgEnvironmentOptions.Create;
FppkgOptions.Load();
end;
Result:=FppkgOptions; Result:=FppkgOptions;
end; end;

View File

@ -27,6 +27,7 @@ type
class function Instance: TFppkgHelper; class function Instance: TFppkgHelper;
function HasPackage(const PackageName: string): Boolean; function HasPackage(const PackageName: string): Boolean;
procedure ListPackages(AList: TStringList); procedure ListPackages(AList: TStringList);
function GetPackageUnitPath(const PackageName: string): string;
end; end;
implementation implementation
@ -123,6 +124,14 @@ begin
{$ENDIF VER3_0} {$ENDIF VER3_0}
end; end;
function TFppkgHelper.GetPackageUnitPath(const PackageName: string): string;
var
FppkgPackage: TFPPackage;
begin
FppkgPackage := FFPpkg.FindPackage(PackageName, pkgpkInstalled);
Result := FppkgPackage.PackagesStructure.GetUnitDirectory(FppkgPackage);
end;
finalization finalization
GFppkgHelper.Free; GFppkgHelper.Free;
end. end.

View File

@ -53,7 +53,7 @@ uses
// IDE // IDE
EditDefineTree, CompilerOptions, CompOptsModes, IDEOptionDefs, ProjPackCommon, EditDefineTree, CompilerOptions, CompOptsModes, IDEOptionDefs, ProjPackCommon,
LazarusIDEStrConsts, IDEProcs, TransferMacros, FileReferenceList, LazarusIDEStrConsts, IDEProcs, TransferMacros, FileReferenceList,
PublishModule, ImgList; PublishModule, ImgList, FppkgHelper, FppkgIntf;
type type
TLazPackage = class; TLazPackage = class;
@ -644,6 +644,7 @@ type
function NeedsDefineTemplates: boolean; function NeedsDefineTemplates: boolean;
function SubstitutePkgMacros(const s: string; PlatformIndependent: boolean): string; function SubstitutePkgMacros(const s: string; PlatformIndependent: boolean): string;
procedure WriteInheritedUnparsedOptions; procedure WriteInheritedUnparsedOptions;
function GetActiveBuildMethod: TBuildMethod;
// files // files
function IndexOfPkgFile(PkgFile: TPkgFile): integer; function IndexOfPkgFile(PkgFile: TPkgFile): integer;
function SearchShortFilename(const ShortFilename: string; function SearchShortFilename(const ShortFilename: string;
@ -2143,7 +2144,7 @@ begin
if SysUtils.CompareText(MacroName,'PkgOutDir')=0 then begin if SysUtils.CompareText(MacroName,'PkgOutDir')=0 then begin
Handled:=true; Handled:=true;
if Data=CompilerOptionMacroNormal then if Data=CompilerOptionMacroNormal then
s:=CompilerOptions.ParsedOpts.GetParsedValue(pcosOutputDir) s:=GetOutputDirectory()
else else
s:=CompilerOptions.ParsedOpts.GetParsedPIValue(pcosOutputDir); s:=CompilerOptions.ParsedOpts.GetParsedPIValue(pcosOutputDir);
exit; exit;
@ -2215,6 +2216,17 @@ begin
end; end;
end; end;
function TLazPackage.GetActiveBuildMethod: TBuildMethod;
begin
Result:=BuildMethod;
if Result=bmBoth then begin
if Assigned(FppkgInterface) and FppkgInterface.UseFPMakeWhenPossible then
Result:=bmFPMake
else
Result:=bmLazarus;
end;
end;
function TLazPackage.GetAutoIncrementVersionOnBuild: boolean; function TLazPackage.GetAutoIncrementVersionOnBuild: boolean;
begin begin
Result:=lpfAutoIncrementVersionOnBuild in FFlags; Result:=lpfAutoIncrementVersionOnBuild in FFlags;
@ -3741,7 +3753,11 @@ end;
function TLazPackage.GetOutputDirectory(UseOverride: boolean = true): string; function TLazPackage.GetOutputDirectory(UseOverride: boolean = true): string;
begin begin
if HasDirectory then begin if HasDirectory then begin
Result:=CompilerOptions.ParsedOpts.GetParsedValue(pcosOutputDir,UseOverride); if GetActiveBuildMethod = bmFPMake then begin
Result :=TFppkgHelper.Instance.GetPackageUnitPath(name);
end else begin
Result:=CompilerOptions.ParsedOpts.GetParsedValue(pcosOutputDir,UseOverride);
end;
end else end else
Result:=''; Result:='';
end; end;

View File

@ -4200,13 +4200,7 @@ begin
if (not APackage.CompilerOptions.SkipCompiler) if (not APackage.CompilerOptions.SkipCompiler)
and (not (pcfDoNotCompilePackage in Flags)) then begin and (not (pcfDoNotCompilePackage in Flags)) then begin
BuildMethod:=APackage.BuildMethod; BuildMethod:=APackage.GetActiveBuildMethod;
if BuildMethod=bmBoth then begin
if Assigned(FppkgInterface) and FppkgInterface.UseFPMakeWhenPossible then
BuildMethod:=bmFPMake
else
BuildMethod:=bmLazarus;
end;
if BuildMethod=bmLazarus then begin if BuildMethod=bmLazarus then begin
CompilerFilename:=APackage.GetCompilerFilename; CompilerFilename:=APackage.GetCompilerFilename;