From 0e016b16dc4f55489ce2f082cb3c6049d371cd02 Mon Sep 17 00:00:00 2001 From: joost Date: Mon, 3 Dec 2018 18:58:42 +0000 Subject: [PATCH] IDE: Search in the right location for the compiled units in a Lazarus-package, compiled/installed by FPMake git-svn-id: trunk@59720 - --- .../fppkg/src/fppkg_environmentoptions.pas | 9 +++++--- packager/fppkghelper.pas | 9 ++++++++ packager/packagedefs.pas | 22 ++++++++++++++++--- packager/packagesystem.pas | 8 +------ 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/components/fppkg/src/fppkg_environmentoptions.pas b/components/fppkg/src/fppkg_environmentoptions.pas index f86af18e25..463d30a453 100644 --- a/components/fppkg/src/fppkg_environmentoptions.pas +++ b/components/fppkg/src/fppkg_environmentoptions.pas @@ -99,13 +99,11 @@ procedure Register; var OptionsGroup: Integer; begin - FppkgOptions := TFppkgEnvironmentOptions.Create; + TFppkgEnvironmentOptions.GetInstance; OptionsGroup := GetFreeIDEOptionsGroupIndex(GroupEditor); RegisterIDEOptionsGroup(OptionsGroup, TFppkgEnvironmentOptions); RegisterIDEOptionsEditor(OptionsGroup, TFppkgEnvironmentOptionsFrame, 1); - - FppkgOptions.Load(); end; { TFppkgEnvironmentOptionsFrame } @@ -161,6 +159,11 @@ end; class function TFppkgEnvironmentOptions.GetInstance: TAbstractIDEOptions; begin + if not Assigned(FppkgOptions) then + begin + FppkgOptions := TFppkgEnvironmentOptions.Create; + FppkgOptions.Load(); + end; Result:=FppkgOptions; end; diff --git a/packager/fppkghelper.pas b/packager/fppkghelper.pas index f2c21a0356..7ce54e2cef 100644 --- a/packager/fppkghelper.pas +++ b/packager/fppkghelper.pas @@ -27,6 +27,7 @@ type class function Instance: TFppkgHelper; function HasPackage(const PackageName: string): Boolean; procedure ListPackages(AList: TStringList); + function GetPackageUnitPath(const PackageName: string): string; end; implementation @@ -123,6 +124,14 @@ begin {$ENDIF VER3_0} end; +function TFppkgHelper.GetPackageUnitPath(const PackageName: string): string; +var + FppkgPackage: TFPPackage; +begin + FppkgPackage := FFPpkg.FindPackage(PackageName, pkgpkInstalled); + Result := FppkgPackage.PackagesStructure.GetUnitDirectory(FppkgPackage); +end; + finalization GFppkgHelper.Free; end. diff --git a/packager/packagedefs.pas b/packager/packagedefs.pas index 1a27f231d5..aaf7f95616 100644 --- a/packager/packagedefs.pas +++ b/packager/packagedefs.pas @@ -53,7 +53,7 @@ uses // IDE EditDefineTree, CompilerOptions, CompOptsModes, IDEOptionDefs, ProjPackCommon, LazarusIDEStrConsts, IDEProcs, TransferMacros, FileReferenceList, - PublishModule, ImgList; + PublishModule, ImgList, FppkgHelper, FppkgIntf; type TLazPackage = class; @@ -644,6 +644,7 @@ type function NeedsDefineTemplates: boolean; function SubstitutePkgMacros(const s: string; PlatformIndependent: boolean): string; procedure WriteInheritedUnparsedOptions; + function GetActiveBuildMethod: TBuildMethod; // files function IndexOfPkgFile(PkgFile: TPkgFile): integer; function SearchShortFilename(const ShortFilename: string; @@ -2143,7 +2144,7 @@ begin if SysUtils.CompareText(MacroName,'PkgOutDir')=0 then begin Handled:=true; if Data=CompilerOptionMacroNormal then - s:=CompilerOptions.ParsedOpts.GetParsedValue(pcosOutputDir) + s:=GetOutputDirectory() else s:=CompilerOptions.ParsedOpts.GetParsedPIValue(pcosOutputDir); exit; @@ -2215,6 +2216,17 @@ begin 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; begin Result:=lpfAutoIncrementVersionOnBuild in FFlags; @@ -3741,7 +3753,11 @@ end; function TLazPackage.GetOutputDirectory(UseOverride: boolean = true): string; 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 Result:=''; end; diff --git a/packager/packagesystem.pas b/packager/packagesystem.pas index 7718bd263a..738687a4cd 100644 --- a/packager/packagesystem.pas +++ b/packager/packagesystem.pas @@ -4200,13 +4200,7 @@ begin if (not APackage.CompilerOptions.SkipCompiler) and (not (pcfDoNotCompilePackage in Flags)) then begin - BuildMethod:=APackage.BuildMethod; - if BuildMethod=bmBoth then begin - if Assigned(FppkgInterface) and FppkgInterface.UseFPMakeWhenPossible then - BuildMethod:=bmFPMake - else - BuildMethod:=bmLazarus; - end; + BuildMethod:=APackage.GetActiveBuildMethod; if BuildMethod=bmLazarus then begin CompilerFilename:=APackage.GetCompilerFilename;