The CMake tool is used to both to generate projects for your plug-ins and applications, and to build the plug-ins and applications from the projects it generated.
Projects are generated by calling a CMake Generator. A CMakeLists.txt
file in the plug-in or application directory provides information about the libraries, files, and source needed to generate the project.
Projects are generated using
cmake -H. -B<build_directory> -G <generator>
The Maya devkit supports three generators:
Visual Studio 16 2019 Win64
for 64bit Windows
cmake -H. -Bbuild -G "Visual Studio 16 2019 Win64"
Unix Makefiles
for macOS and Linux
cmake -H. -Bbuild -G "Unix Makefiles"
Xcode
for macOS
cmake -H. -Bbuild -G Xcode
The -B
flag is used to specify the project file target directory.
For example, to generate an XCode project in the project
directory, use
cmake -H. -Bproject -G Xcode
After your project is generated, you can open the project in an IDE and build it from there, or you can use CMake with the --build
option to build the plug-in or application
cmake --build <build_directory>
For example, if you generated the project to the project
directory, use
cmake --build project/
Your built application or plug-in will be located in the top level of your build directory if you generated your project using Unix Makefiles
. If you used the Xcode
or Visual Studio 16 2019 Win64
generator, your plug-in or application will be located under the build directory's Debug
subdirectory.
Plug-ins built on different platforms will have different extensions. Plug-ins built on Windows will have the mll
extension. Plug-ins built on Linux will have the so
extension. Plug-ins built on macOS will have the bundle
extension.
Standalone applications are run directly from the command line or from Windows Explorer.
If you set MAYA_PLUG_IN_PATH
path in Maya.env
as described in Setting Up Your Build Environment, you can copy your plug-in to the MAYA_PLUG_IN_PATH
and it will be loaded automatically into Maya. You can also choose to not place your plug-in in MAYA_PLUG_IN_PATH
and instead load it manually.
Do not rebuild a plug-in that is already loaded into Maya. Unload the plug-in before you rebuild it.