What project options to use for open source Delphi packages?

别说谁变了你拦得住时间么 提交于 2019-12-05 04:11:22

Let's say you have this structure

  • MyComponent
    • Packages
      • DelphiXE7
        • Package2.dpr
    • source
    • bin
      • Delphi XE7

then set

  • Search Path

    ..\..\..\source

  • Unit output directory

    ..\..\..\bin\Delphi XE7\$(Platform)\$(Config)

After compilation for all supported platforms and both Release and Debug you will have this structure in the bin directory

  • MyComponent
    • Packages
      • DelphiXE7
        • Package2.dpr
    • source
    • bin
      • Delphi XE7
        • Android
          • Release
          • Debug
        • Win32
          • Release
          • Debug
        • Win64
          • Release
          • Debug

For installation you have to setup some path inside the IDE.

  • Environment

    MYCOMPONENT => [root path to the files]

  • Library

    Repeat that for all supported platforms

    • Library Path

      $(MYCOMPONENT)\bin\Delphi XE7\$(Platform)\Release

    • Search Path

      $(MYCOMPONENT)\source

    • Debug-DCU-Path

      $(MYCOMPONENT)\bin\Delphi XE7\$(Platform)\Debug

If there are some language related units there is also a place to add (see Library - translated)

This ensures, that you have full debug feature (with Use Debug-DCU option set) and on release you have no debug code in your application.


Just a sidenote on libraries you should not want to install because you only use them in some projects.

Simply use the Optionset combined with a environment variable.

Here my SuperObject.optionset ($(USRLIB) points to a directory, where I collect all common used source code. And $(USRLIB)\ext is the place for all of the external libraries).

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <DCC_UnitSearchPath>$(USRLIB)\ext\superobject;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
    </PropertyGroup>
    <ProjectExtensions>
        <Borland.Personality>Delphi.Personality.12</Borland.Personality>
        <Borland.ProjectType>OptionSet</Borland.ProjectType>
        <BorlandProject>
            <Delphi.Personality/>
        </BorlandProject>
        <ProjectFileVersion>12</ProjectFileVersion>
    </ProjectExtensions>
</Project>

To use the superobject library I simply add the optionset to the project (right mouse click on build configuration) and everything is fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!