[英]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 假设你有这种结构
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 在为所有支持的平台以及Release和Debug进行编译之后,您将在bin目录中拥有此结构
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.