Recent

Author Topic: Deducing application type  (Read 600 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Deducing application type
« on: October 03, 2022, 01:16:20 pm »
When the IDE starts creating a new project, the first thing it does is ask the application type (Application, Simple Program and so on). Is it subsequently possible to recover this information from the IDE or by inspection of the .lpi file (i.e. rather than looking at the units list etc., which might have been edited)?

The scenario is that I've used fairly consistent main files for several projects which have allowed me to build for a GUI, console-only program and so on, including the case where the GUI-capable binary decides to run as a console program (has a --help or --version parameter and so on). Plus a makefile for anybody who's got FPC but not Lazarus.

I've got one project where a year or so ago I copied a handful of files across, changed a few lines then let it languish. I'm trying to work out what exactly I did :-)

Currently Lazarus 2.2.0 on Debian x86_64.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: Deducing application type
« Reply #1 on: October 03, 2022, 05:21:33 pm »
When the IDE starts creating a new project, the first thing it does is ask the application type (Application, Simple Program and so on). Is it subsequently possible to recover this information from the IDE or by inspection of the .lpi file (i.e. rather than looking at the units list etc., which might have been edited)?
The IDE keeps the project type in its .lpi file. 

For instance,
Code: Text  [Select][+][-]
  1.         <CompilerOptions>
  2.           <Version Value="11"/>
  3.           <PathDelim Value="\"/>
  4.           <SearchPaths>
  5.             <IncludeFiles Value="$(ProjOutDir)"/>
  6.             <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
  7.           </SearchPaths>
  8.           <Parsing>
  9.             <Style Value="1"/>
  10.             <SyntaxOptions>
  11.               <UseAnsiStrings Value="False"/>
  12.             </SyntaxOptions>
  13.           </Parsing>
  14.           <CodeGeneration>
  15.             <SmartLinkUnit Value="True"/>
  16.             <TargetProcessor Value="ATHLON64"/>
  17.             <TargetCPU Value="x86_64"/>
  18.             <TargetOS Value="win64"/>
  19.             <SmallerCode Value="True"/>
  20.           </CodeGeneration>
  21.           <Linking>
  22.             <Debugging>
  23.               <DebugInfoType Value="dsDwarf2Set"/>
  24.             </Debugging>
  25.             <LinkSmart Value="True"/>
  26.             <Options>
  27.               <ExecutableType Value="Library"/>
  28.             </Options>
  29.           </Linking>
  30.         </CompilerOptions>
  31.  
Notice that line 27 identifies the project/"ExecutableType" as a "Library". 

Hopefully, that gives you something to work with.

HTH.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Deducing application type
« Reply #2 on: October 03, 2022, 05:54:48 pm »
It looks as though the only time that is used is when building a .so on Linux (presumably a .dll on Windows )-:

It might be possible to infer something based on whether an icon is defined, but I was hoping to avoid guessing.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018