How To Compile PiPL Resource In Visual Studio

GOAL

Today’s goal is to compile PiPL resource with custom build step in Visual Studio while Adobe plug-in development.

If you’d like to know about PiPL resource, see the appendix “What is PiPL resource?” in this article.

Environment

Windows10
Visual Studio 2015 Community
After Effects CC2019
After Effects 17.1.2 Win SDK

Method

1. Open solution file with Visual Studio

Make sure .r is added to the current solution file.

2. Open properties of PiPL resource file

Right-click the PiPL resource file .r and click “Properties”.

3. Set Item Type

Select “Custom Build Tool” in Item Type list.

4. Set Custom Build Tool

Change each items referring to solution files of sample projects.

The following is the detail of command line input.

cl /I "$(ProjectDir)..\..\..\Headers" /EP ".."\\"%(Filename).r" > "$(IntDir)"\\"%(Filename).rr"
"$(ProjectDir)..\..\..\Resources\PiPLTool" "$(IntDir)%(Filename).rr" "$(IntDir)%(Filename).rrc"
cl /D "MSWindows" /EP $(IntDir)%(Filename).rrc >               "$(ProjectDir)"\\"%(Filename)".rc

1. run cl command and generate .rr file from .r with including headers.

cl: Compiler Command
/I: Adds a directory to the list of directories searched for include files.
/EP: Preprocesses C and C++ source files and copies the preprocessed files to the standard output device.
>: Redirection of the file after > to stdin of the file before >.

cl /I "Path_To_Headers" /EP "Path_To_.r" > "PATH_TO_.rr"

2. convert .rr to .rrc with PiPLTool.exe

"Path_To_Resources\PiPLTool" "Path_To_.rr" "Path_To_.rrc"

3. run cl command and generate .rc file from .rrc

cl: Compiler Command
/D: Defines a preprocessing symbol for a source file. (#define “MSWindows”)
/EP: Preprocesses C and C++ source files and copies the preprocessed files to the standard output device.
>: Redirection of the file after > to stdin of the file before >.

cl /D "MSWindows" /EP "Path_To_.rrc" > "Path_To_.rc"

Appendix

What is PiPL resource?

What is a PiPL?

Plug-In Property Lists, or PiPLs, are resources which provide basic information about a plug-in’s behavior, without executing the plug-in.

from PiPL Resources in  After Effects SDK Guide

What information does the PiPL provide?

A PiPL specifies the entry point of a plug-in, the display name, as well as the plug-in’s match name.

from PiPL Resources in  After Effects SDK Guide

Why should resource file .r be compiled?

In the interest of cross-platform compatibility, use a single .r file for both macOS and Windows versions of your plug-in, like the samples do.

On Windows, PiPLs are compiled by processing a .r file through pipltool.exe, which converts the .r file into a binary .rc file.

from PiPL Resources in  After Effects SDK Guide