volodinroman / maya-cmake

Autodesk Maya cross-platform development environment with CMake

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CMake for Maya

CMake module for Autodesk Maya. Works on Windows, OSX and Linux.

Usage:

  • Download and install CMake from https://cmake.org and check if it works typing "cmake -h" in your terminal

  • Download Autodesk Maya SDK for your version of Maya and place the SDK content in MayaPlugins/SDK/maya20xx folder (the structure of MayaPlugins build environment is attached here)

  • Run a terminal and make ~/MayaPlugins/build folder as a current folder

  • For Windows users: type cmake -G "Visual Studio 15 2017 Win64" ../ using your version of Vusial Studio

  • If we want to build a plugin for some specific maya version, we use cmake G "Visual Studio 15 2017 Win64" -DMAYA_VERSION=2016 ../

  • For Linux users: type cmake -G "Unix makefiles" ../

  • For OSX users: type cmake -G "Xcode" ../ or cmake -G "Unix Makefiles" ../

  • After building the solution (sln) we can compile it with cmake --build . --config Release. It is important that the current dir is the build one, where the solution files are located.

  • If we want to copy compiled plug-in somewhere (maya plugins folder), we use cmake --build . --config Release --target Install. It will copy the built plug-in to a folder, specified with CMAKE_INSTALL_PREFIX (CMakeLists.txt)

Some notes:

  • In Linux source building procedure creates Makefile, which we can compile into .so file (the actual plug-in), using make -f Makefile.
  • Code editors (sublime, vscode etc.) have CMake syntax highlighters, that can be downloaded from app markets.
  • In the root folder of the project should be a CMakeLists.txt, which contains rules of building and compiling plugins.
  • We can create extra CMake modules for finding specific includes and libs (not only Maya SDK but some others). These modules should be named Find{NAME}.cmake, like FindMaya.cmake. This module should be included to CMakeLists.txt.
  • When we build solutions for VS or XCode, when we open them in the editors, we can see ZERO_CHECK and ALL_BUILD projects. ZERO_CHECK - reloads cmake files if we did some changes there. Like if we decided to change a path where compiled plugins will be located, we don't have to rebuild the solution from a terminal. To turn off this project, in CMakeLists.txt we should set(CMAKE_SUPPRESS_REGENERATION true). ALL_BUILD builds all projects in the currently opened solution.

About

Autodesk Maya cross-platform development environment with CMake

License:MIT License


Languages

Language:CMake 73.9%Language:C++ 26.1%