Maya compile environment

From wikinotes

Documentation

description url
official maya compiling env docs Maya Docs > Maya Developer Help > Setting up your Build Environment
http://help.autodesk.com/view/MAYAUL/2018/ENU/?guid=__files_Setting_up_your_build_env_Windows_env_32bit_and_64bit_htm
Wikipedia visualstudio version info https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B
personal visualstudio notes visualstudio build tools
unofficial docs (maya versions/build envs) https://around-the-corner.typepad.com/adn/2018/02/compiler-versions-for-maya-2018.html
visualstudio commandline docs https://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx

Compiler Version Chart

maya version windows macos linux
2015 visualstudio 2012 (update 4) (11.0) MacOS-10.8.5(mountain-lion) Xcode-5.0.2 SDK-10.8 clang/libstdc++ RHEL-6.2 (gcc-4.1.2)
2016 visualstudio 2012 (update 4) (11.0) MacOS-10.9.5(mavericks) Xcode-6.1.1 SDK-10.9 clang/libstdc++ RHEL-6.5 devtoolset-2.1 (gcc-4.4.7)
2017 visualstudio 2012 (update 4) (11.0) MacOS-10.9.5(mavericks) Xcode-6.1.1 SDK-10.9 clang/libc++ RHEL-6.5 devtoolset-2.1 (gcc-4.8.2)
2018 visualstudio 2015 (update 3) (14.0) MacOS-10.11.6(el-capitain) Xcode-7.3.1 SDK-10.11 clang/libc++ RHEL-6.5 devtoolset-2.1 (gcc-4.8.2)
2019 visualstudio 2015 (update 3) (14.0) Xcode-7.3.1 CMake RHEL-devtoolset-6.1 (gcc-6.3.1) CMake
2020 visualstudio 15 (2017), cmake Xcode-10.2.1, cmake RHEL-devtoolset-6.1, (gcc-6.3.1), cmake

DevKits

maya devkit downloads (scroll down) https://www.autodesk.com/developer-network/platform-technologies/maya

Most versions of maya only require you install the devkit for C/C++ development. I've only encountered one release where the python headers were not included in the main installation.

Building Software

Linux

NOTE:

It is difficult to create an linux environment that supports a wide range of maya versions. It won't work for graphical maya environments, but if you're only compiling/importing try dockermaya


Install devkit, and build plugins

# extract devkit to your homedir 
# (your user likely won't be able to write to /usr/autodesk)
mkdir ~/.maya/2018/devkit
tar -xvf devkit.tar -C ~/.maya/2018/devkit

# prepare env to build for maya
export MAYA_LOCATION=/usr/autodesk/maya2018
export DEVKIT_LOCATION=~/.maya/2018/devkit
cd ~/.maya/devkits/maya2018/plug-ins

# build the plugins
make clean
make

Building Software

# set environments
export MAYA_LOCATION=/usr/autodesk/maya2018
export DEVKIT_LOCATION=~/.maya/devkits/maya2018
export XBMLANGPATH=~/.maya/devkits/maya2018/plug-ins/icons/%B

make  # or your build command

Windows

Run the vcvarsall.bat that belongs to your maya version's required VisualStudio version, include Autodesk's provided libraries, and compile.

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat amd86_64

set INCLUDE=%INCLUDE%;C:\Program Files\Autodesk\Maya2018\include\python2.7
set LIB=%LIB%;C:\Program Files\Autodesk\Maya2018\lib

C:\Program Files\Autodesk\Maya2018\bin\mayapy setup.py install  # or nmake, etc

MacOS

Install/Build the devkit

# download appropriate devkit: https://www.autodesk.com/developer-network/platform-technologies/maya
mkdir -p ~/.maya/2018/devkit
# extract devkit here


# build devkit
export MAYA_LOCATION=/Applications/Autodesk/maya2018/Maya.app/Contents
export DEVKIT_LOCATION=~/.maya/2018/devkit
export DEVELOPER_DIR=/Applications/Xcode7.3.1.app

/Applications/Autodesk/maya2018/Maya.app/Contents/bin/mayapy setup.py install