简体   繁体   English

用于开源Delphi软件包的项目选项有哪些?

[英]What project options to use for open source Delphi packages?

I've written some Delphi code I would like to share on GitHub. 我写了一些我想在GitHub上分享的Delphi代码。 All code is contained in runtime and designtime packages as required. 所有代码都包含在运行时和设计时包中。 There are many "Project Options" to set for each project. 每个项目都有许多“项目选项”。 (Output directories, search paths, compilation options, etc.) I've managed to find some default options that work well for my situation but reading other Q&As here it's clear there are multiple ways of working . (输出目录,搜索路径,编译选项等),我已经成功找到了最适合我的情况下工作良好,但阅读其他Q&由于这里明明有多个一些默认选项方面 工作

What project options should be used to allow the open source packages to easily be incorporated into individual projects? 应该使用哪些项目选项来将开源软件包轻松地整合到单个项目中?

德尔福项目选项

I've recently started using NodeJS. 我最近开始使用NodeJS。 The NPM package manager makes it super easy to use third-party packages in a project. NPM包管理器使得在项目中使用第三方包非常容易。 Packages are installed with one simple command on the command line. 在命令行上使用一个简单命令安装软件包。 Packages will automatically install any required dependencies. 包将自动安装任何所需的依赖项。

PS: Feel free to edit this question if you would like to add extra things to consider. PS:如果您想添加额外的东西,请随意编辑此问题。

Let's say you have this structure 假设你有这种结构

  • MyComponent 为MyComponent
    • Packages
      • DelphiXE7 DelphiXE7
        • Package2.dpr Package2.dpr
    • source 资源
    • bin 箱子
      • Delphi XE7 德尔福XE7

then set 然后设定

  • Search Path 搜索路径

    ..\\..\\..\\source ..\\..\\..\\资源

  • Unit output directory 单位输出目录

    ..\\..\\..\\bin\\Delphi XE7\\$(Platform)\\$(Config) .. \\ .. \\ .. \\ bin \\ Delphi XE7 \\ $(平台)\\ $(配置)

After compilation for all supported platforms and both Release and Debug you will have this structure in the bin directory 在为所有支持的平台以及ReleaseDebug进行编译之后,您将在bin目录中拥有此结构

  • MyComponent 为MyComponent
    • Packages
      • DelphiXE7 DelphiXE7
        • Package2.dpr Package2.dpr
    • source 资源
    • bin 箱子
      • Delphi XE7 德尔福XE7
        • Android Android的
          • Release 发布
          • Debug 调试
        • Win32 Win32的
          • Release 发布
          • Debug 调试
        • Win64 Win64平台
          • Release 发布
          • Debug 调试

For installation you have to setup some path inside the IDE. 对于安装,您必须在IDE中设置一些路径。

  • Environment 环境

    MYCOMPONENT => [root path to the files] MYCOMPONENT => [文件的根路径]

  • Library 图书馆

    Repeat that for all supported platforms 对所有支持的平台重复此操作

    • Library Path 图书馆路径

      $(MYCOMPONENT)\\bin\\Delphi XE7\\$(Platform)\\Release $(MYCOMPONENT)\\ bin \\ Delphi XE7 \\ $(平台)\\发布

    • Search Path 搜索路径

      $(MYCOMPONENT)\\source $(MyComponent的)\\源

    • Debug-DCU-Path 调试,DCU-路径

      $(MYCOMPONENT)\\bin\\Delphi XE7\\$(Platform)\\Debug $(MYCOMPONENT)\\ bin \\ Delphi XE7 \\ $(平台)\\ 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. 这可以确保您具有完整的调试功能( 使用 Set Debug-DCU选项),并且在发布时您的应用程序中没有调试代码。


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. 只需将Optionset与环境变量结合使用即可。

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). 这里我的SuperObject.optionset$(USRLIB)指向一个目录,我收集所有常用的源代码。 $(USRLIB)\\ext是所有外部库的地方)。

<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. 要使用superobject库,我只需将选项集添加到项目中(右键单击构建配置),一切都很好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法在Delphi中打开Project的“选项”页面 - Cannot open “Options” page for Project in Delphi 为项目组织多个Delphi库软件包的最佳方法是什么? - What is the best way to organize multiple Delphi library packages for the project? 如何在同一项目中为不同版本的Delphi使用不同的软件包 - How to use different packages in the same project for different versions of Delphi 是否有任何实现基本IDE结构的Delphi开源项目? - Is there any Delphi Open Source project that Implement a basic IDE structure? Delphi和单元测试:在项目中包含经过测试的源,还是只使用它? - Delphi & unit testing: Include tested source in project, or just use it? 以管理员身份在delphi中打开项目 - open project in delphi as administrator Delpi 包:我是否应该在“工具 - 选项 - 语言 - Delphi - 库 - 库路径”中包含源目录并每次重新编译 *.dcu? - Delpi packages: should I include source directory in "Tools - Options - Language - Delphi - Library - Library path" and recompile *.dcu each time? Delphi:如果我在我的项目中使用包,为什么“使用调试 DCU”变得无效? - Delphi: Why does “use debug DCUs” become ineffective if I'm using packages in my project? 如何在Delphi XE中打开和编译Delphi 5项目? - How to open and compile a Delphi 5 project in Delphi XE? 在项目基础上加载Delphi设计时包 - Loading Delphi designtime packages on a project base
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM