Forum > General

Sharing same source file in two projects

<< < (10/10)

marcov:

--- Quote from: y.ivanov on October 07, 2021, 09:17:33 pm ---@marcov,
What if the suggested check is performed only on the .ppu's residing into intermediate directory? The compiler should know that directory by its command-line parameters, I believe.

--- End quote ---

Theoretically possible. However I think it too narrow an usecase. But as said, I'm no compilerdevel.

In the IDE it is also possible with ppu scanning, but the compiler only scans required files, and that is harder in the IDE, so a file removed from the project (and a leftover ppu) could trip up this. PPU scanning could alleviate this somewhat, but depends on a build of the same project being succeeded before.

y.ivanov:

--- Quote from: marcov on October 07, 2021, 11:03:13 pm ---
--- Quote from: y.ivanov on October 07, 2021, 09:17:33 pm ---@marcov,
What if the suggested check is performed only on the .ppu's residing into intermediate directory? The compiler should know that directory by its command-line parameters, I believe.

--- End quote ---

Theoretically possible. However I think it too narrow an usecase. But as said, I'm no compilerdevel.

In the IDE it is also possible with ppu scanning, but the compiler only scans required files, and that is harder in the IDE, so a file removed from the project (and a leftover ppu) could trip up this. PPU scanning could alleviate this somewhat, but depends on a build of the same project being succeeded before.

--- End quote ---
I've tried to experiment with the idea, thought that I can put on 'Project|Compiler commands|Execute before' small utility to hash the compiler options and touch the file $(ProjPath)/hash.inc only when different. Then {$I hash.inc} in every source file should have the same effect, i.e. tried to use .ppu's entry for include dependency in place of the proposed new entry.

Then I found there is no suitable IDE macro to substitute for the compiler options...

Ditching into IDE sources I found it in function TMainIDE.DoBuildProject():

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---       // execute compilation tool 'Before'      if not (pbfSkipTools in Flags) then begin        ToolBefore:=TProjectCompilationToolOptions(                                          Project1.CompilerOptions.ExecuteBefore);        if (AReason in ToolBefore.CompileReasons) then begin          Result:=Project1.CompilerOptions.ExecuteBefore.Execute(                 WorkingDir, lisProject2+lisExecutingCommandBefore,                 aCompileHint);     // ... (many lines after)         CompilerParams :=          Project1.CompilerOptions.MakeOptionsString([ccloAbsolutePaths])                 + ' ' + PrepareCmdLineOption(SrcFilename);        // write state file, to avoid building clean every time        Result:=Project1.SaveStateFile(CompilerFilename,CompilerParams,false);        if Result<>mrOk then begin          debugln(['Error: (lazarus) [TMainIDE.DoBuildProject] SaveStateFile before compile failed']);          exit;        end;         WarnSuspiciousCompilerOptions('Project checks','',CompilerParams);         StartTime:=Now;        Result:=TheCompiler.Compile(Project1, That convinced me that I have no chance of knowing them at the time of "Execute before".

In that point I wonder is there some helper docs how to write an IDE package, which eventually will be compiled with the IDE and will have access to Project1.CompilerOptions.MakeOptionsString()?

I have seen plenty such packages (e.g. EducationLaz, AnchorDockingDsgn) which seems to be an integral part of the IDE after installed. I don't want to mess with the original IDE sources but rather to make such package for the test.
 

 

cpicanco:
Hi y.ivanov, I am just curious, are you using the "Compile Many Modes" option (if not, have you tried it)?

Navigation

[0] Message Index

[*] Previous page

Go to full version