Delphi 2007(或 2009)构建事件与构建配置相关吗?

Sam*_*amH 5 delphi delphi-2007

是否可以仅为 Delphi 2007 中的特定构建配置添加构建事件?

我使用 2007 年,但也对您在 2009 年可以做什么感兴趣。

干杯萨姆

小智 5

是的!

因为您可以在每个构建配置中拥有单独的定义。您可以检查项目定义以进行条件构建处理。

我用类似的东西:

echo $(DEFINES) | find "RELEASE"> nul
if not errorlevel 1 goto
release

echo $(DEFINES) | find "DEBUG" > nul
if not errorlevel 1 goto debug

goto end

:release
echo Processing RELEASE Build:
...
goto end

:debug
echo Processing DEBUG Build:
..
goto end

:end
Run Code Online (Sandbox Code Playgroud)


Too*_*the 3

不。

您可以为 Delphi 2009 中的每个构建配置设置(资源)编译器设置。但这不适用于其他设置。

你可以伪造它,但这需要一些时间:

  1. 在预构建中,删除conf*.dcu 文件。
  2. 为调试配置定义 DEBUG。
  3. 将以下内容添加到项目文件中:

代码:

uses
  ..
{$IFDEF DEBUG}
  confDebug,
{$ELSE}
  confRelease,
{$ENDIF}
  ..
Run Code Online (Sandbox Code Playgroud)
  1. 现在让构建后步骤检查confDebug.dcu 或confRelease.dcu 是否存在,以查找使用了哪个构建配置。

虽然有点麻烦,但是你可以做你想做的事。