Building examples on macOS

Important: You need to set up your environment as described in Setting up your build environment before building the examples.

Plug-in examples are located in $DEVKIT_LOCATION/devkit/plug-ins/ and standalone application examples are located in $DEVKIT_LOCATION/devkit/applications/. Each individual example is in its own dedicated directory. Change to the example's directory to build it.

For example, the circleNode plug-in example, is located in the circleNode directory. To build it, change directory to circleNode:

cd $DEVKIT_LOCATION/devkit/plug-ins/circleNode

Note: To build the cgFx plug-in, unarchive Cg.framework.tar in $DEVKIT_LOCATION/lib before building the project.

Before building an example, you need to run cmake once to generate either an Xcode project or a UNIX makefile.

To generate a makefile, open a terminal window and run:

cmake -H. -Bbuild -G "Unix Makefiles"

To generate an Xcode project, open a terminal window and run:

cmake -H. -Bbuild -G Xcode

Note: If you are using macOS on a machine with an Apple Silicon chip, you will also need to set the architecture:

cmake -H. -Bbuild -G Xcode -DCMAKE_OSX_ARCHITECTURES=x86_64

The cmake command should exit with no errors and create a build directory.

Run cmake again to build the example:

cmake --build build

The executable or plug-in will be located under the build directory if it was built using a UNIX makefile. It will be under the build/Debug directory if it was built using an Xcode project.

If you generated an Xcode project, you can also build the project from within Xcode.

Plug-ins have the suffix bundle. For example, the circleNode plug-in will be called circleNode/build/circleNode.bundle.

Unlike applications that can be run from the command line, plug-ins must be loaded into Maya

Important: Do not rebuild a plug-in that is already loaded into Maya. Unload the plug-in before you rebuild it.