I tested this on MacOS HighSierra so I cant guarantee it works with other versions too (yes I did set a root password ☝)
First of all the maya developer kit is now download only and doesn't ship with maya anymore.
Head over to the Autodesk website and download it. From the archive extract the three folders /devkit, /include and /mkspec into the maya folder.
Your folder structure should then look like this:
- /Applications/Autodesk/maya2018/devkit
- /Applications/Autodesk/maya2018/mkspecs
- /Applications/Autodesk/maya2018/include
- /Applications/Autodesk/maya2018/Maya.app
In your projects CMakeLists.txt now make sure to set the project to Maya 2018 by defining this
If you compile now you might get the following warning from CMake:
-- Configuring done
CMake Warning (dev):
Policy CMP0042 is not set: MACOSX_RPATH is enabled by default. Run "cmake
--help-policy CMP0042" for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
MACOSX_RPATH is not specified for the following targets:
Its just a warning but in order to disable it you might want to also set this in CMakeSettings.txt
Now when you compile you will get spammed with a huge amount of error messages and foremost the issue here is that cmake doesnt tell maya for which platform you want to compile.
The way you would do it in C++ is usually with a preprocessor directive like so:
#define OSMac_
In CMake you can do this with add_definitions() and the -D argument. It looks slightly confusing but the full command you have to add to your CMakeLists.txt is this:
In my case the full projects CMakeList.txt now looks like the following:
This is it, you should now be able to compile. Hope this was useful for you.
You're my hero for writing all this down!
ReplyDeleteQuestions:
Is Sublime Text as good an option as Xcode for developing Maya plug-ins?
Sublime text doesn't seem to be able to find the "maya/..." includes on build. How can I inform it of where to find these headers?
Thanks again!