2014-01-09 4 views
0

В Delphi (от XE2 до XE5), как можно программно добавить целевую платформу в проект?Как добавить целевую платформу к проекту Delphi через API OpenTools

«Программно», я имею в виду через API OpenTools, в отличие от преобразования файла .dproj. Это делается внутри мастера/эксперта IDE.

Я просмотрел блок ToolsAPI, и, похоже, вы можете получить активную платформу и список поддерживаемых платформ, но нет ничего очевидного для добавления новой целевой платформы.

+0

Зачем кому-то отвечать на этот вопрос? Это просто орехи! –

ответ

1

Кажется, что это возможно. Устройство, которое вы должны посмотреть, это PlatformAPI. Интерфейс, который имеет то, что вам нужно:

{ Provides information on platform-specific information held by a project } 
    IOTAProjectPlatforms160 = interface(IInterface) 
    ['{E1C62726-BD51-4D4E-A2F2-9A8A59F272AE}'] 
    { Add an available platform to the project } 
    procedure AddPlatform(const PlatformName: string); 
    { Return the currently active platform key } 
    function CurrentPlatform: string; 
    { Return enabled state of the requested platform } 
    function GetEnabled(const PlatformName: string): Boolean; 
    { Return an array of strings representing the enabled platforms for a project } 
    function GetEnabledPlatforms: TArray<string>; 
    { Return the profile name associated with the specified platform } 
    function GetProfile(const PlatformName: string): string; 
    { Does the project support platform specified by PlatformName? } 
    function GetSupported(const PlatformName: string): Boolean; 
    { Return an array of strings representing the valid platforms for a project } 
    function GetSupportedPlatforms: TArray<string>; 
    { Set a platform as disabled for this project (cannot be made active) } 
    procedure SetEnabled(const PlatformName: string; Value: Boolean); 
    { Set the profile name for the specified platform. Pass an empty string to 
     clear the profile } 
    procedure SetProfile(const PlatformName, ProfileName: string); 
    { Indicate the specified platform is supported or not } 
    procedure SetSupported(const PlatformName: string; Value: Boolean); 
    { Return whether or not the profile associated with PlatformName is the default profile 
     for that platform } 
    function UsingDefaultProfile(const PlatformName: string): Boolean; 

    property EnabledPlatforms: TArray<string> read GetEnabledPlatforms; 
    property Enabled[const PlatformName: string]: Boolean read GetEnabled write SetEnabled; 
    property Profile[const PlatformName: string]: string read GetProfile write SetProfile; 
    property Supported[const PlatformName: string]: Boolean read GetSupported write SetSupported; 
    property SupportedPlatforms: TArray<string> read GetSupportedPlatforms; 
    end; 

метод AddPlatform кажется, ваш парень.

Обратите внимание, что я не пытался вызвать метод. На самом деле все, что я сделал, это поиск слова платформы в исходной папке API-интерфейсов.

+0

Спасибо. Вы только что внесли свой вклад в проект [DUnitX (FOSS)] (http://www.finalbuilder.com/Resources/Blogs/PostId/697/introducing-dunitx.aspx). –

+0

Это хорошо. Это проект, который мне будет интересен для содействия усилиям в области развития. –

Смежные вопросы