Compiling plugins in Visual Studio for multiple maya versions and platforms

434 views
Skip to first unread message

Rudi Hammad

unread,
Oct 10, 2021, 6:47:45 AM10/10/21
to Python Programming for Autodesk Maya
hello,

the title of the thread sums it up really.
I wonder if there is an easy way to compile the plugins for multiple maya's and platforms(windows and mac mainly) at once with visual studio.
I couldn't find much info googling, or maybe a missed it.

thanks,

R

Marcus Ottosson

unread,
Oct 13, 2021, 5:15:13 PM10/13/21
to python_in...@googlegroups.com
Yes, that's not an issue. The version of Maya you build for is determined by the SDK you use, e.g. the Maya 2020 SDK for Maya 2020 plug-ins. The only thing to bear in mind is that the compiler version needs to match the Maya compiler version, so VS 2015 or 2019 for Maya 2018-2022. You can't build for Mac with VS.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/90c9a052-2d02-425e-812b-9129f1c71bafn%40googlegroups.com.

Reza Aarabi

unread,
Oct 13, 2021, 5:26:55 PM10/13/21
to python_in...@googlegroups.com
as Marcus said
You can not compile the plugin for mac from windows
but you can create a build system with CMake that be compatible with all Operating Systems
then you should go to the target OS and run the cmake file, and build the related plugin
windows: mll
linux: so
mac: bundle (not sure)

but you have to have Maya(version> SDK  to build and compile your plugin against it in your target OS





--


---------------------
--= Reza Aarabi =--

Reza Aarabi

unread,
Oct 13, 2021, 5:28:39 PM10/13/21
to python_in...@googlegroups.com
btw, in windows you don't have to use Visual Studio, you can use Visual Studio build file that is `cl.exe`
in linux you should use `gcc`
and in mac you can use `clang`

cl, gcc and clang are C++ Compilers



Reza Aarabi

unread,
Oct 13, 2021, 5:31:49 PM10/13/21
to python_in...@googlegroups.com
Marcus I tested it
no need to use same compiler version as maya built against it

for example I've compiled plugin for maya 2017, 2018, 2019, 2020 and 2022 with Visual Studio 2019
and it worked well

(same for gcc)

the only point is that you have to have C++ redist 2019 installed on your machine if you used visual studio 2019 for compilation
or related C++ redist <version> for your VS that used for building


Rudi Hammad

unread,
Oct 14, 2021, 5:38:17 AM10/14/21
to Python Programming for Autodesk Maya
hello,

Not sure if I am understanding correctly. I only know how to setup VS for one maya version. What I do is a set the directories in the properties the the corresponding maya verstion path.
So what I would do to compile for each is manually change every time the path, which I am sure is not how to do it.
I would like to get this right first and then I'll check the replies about other platforms.

R

Rudi Hammad

unread,
Oct 14, 2021, 12:31:40 PM10/14/21
to Python Programming for Autodesk Maya
found this on youtube by chad vernom! https://www.youtube.com/watch?v=2mUOt_F2ywo&t=0s

Chad Vernon

unread,
Oct 14, 2021, 4:44:45 PM10/14/21
to Python Programming for Autodesk Maya
I've used Jenkins CI in the past to build plugins for multiple versions of Maya on all 3 platforms. You have to have access to all three platforms on the same network. I used CMake to set up the build environment for each platform/maya version.

Also while you can often use a different Visual Studio version than what Maya was compiled with, you may sometimes see irregularities, like difficulties running through a debugger.

Reza Aarabi

unread,
Oct 14, 2021, 5:01:30 PM10/14/21
to python_in...@googlegroups.com

Rudi Hammad

unread,
Jan 1, 2022, 1:10:35 PM1/1/22
to Python Programming for Autodesk Maya
So I followed Chad Vernom's cmake tutorials on youtube. First I wrote a everything as he did, and when it came do the build from the command promp I got an error related to maya path or something, so I thought
F###k that, I'll just copy his repo from github, since I barely understand CMake syntax and I might have done plenty of errors.
Anyway, after copying his repo and rebuilding I get the error

-----------------------------------------------------------------------------------------------------------------
Could not find a package configuration file provided by "Maya" with any of
  the following names:

    MayaConfig.cmake
    maya-config.cmake

  Add the installation prefix of "Maya" to CMAKE_PREFIX_PATH or set
  "Maya_DIR" to a directory containing one of the above files.  If "Maya"
  provides a separate development package or SDK, be sure it has been
  installed.
-----------------------------------------------------------------------------------------------------------------

Since I am not familiar at all with CMake I have no idea what to do with this. According to the error it says " If "Maya"  provides a separate development package or SDK, be sure it has been installed. "
So should I install maya's devkit separetly or somehing? I so, how to "install it"? Should I copy paste all folder of "dekitBase" in maya? Do I even need the SDK?

Anyway, I am completly lost here.

Thanks,
R

Justin Israel

unread,
Jan 1, 2022, 2:59:55 PM1/1/22
to python_in...@googlegroups.com
On Sun, Jan 2, 2022 at 7:10 AM Rudi Hammad <rudih...@gmail.com> wrote:
So I followed Chad Vernom's cmake tutorials on youtube. First I wrote a everything as he did, and when it came do the build from the command promp I got an error related to maya path or something, so I thought
F###k that, I'll just copy his repo from github, since I barely understand CMake syntax and I might have done plenty of errors.
Anyway, after copying his repo and rebuilding I get the error

-----------------------------------------------------------------------------------------------------------------
Could not find a package configuration file provided by "Maya" with any of
  the following names:

    MayaConfig.cmake
    maya-config.cmake

  Add the installation prefix of "Maya" to CMAKE_PREFIX_PATH or set
  "Maya_DIR" to a directory containing one of the above files.  If "Maya"
  provides a separate development package or SDK, be sure it has been
  installed.
-----------------------------------------------------------------------------------------------------------------

Since I am not familiar at all with CMake I have no idea what to do with this. According to the error it says " If "Maya"  provides a separate development package or SDK, be sure it has been installed. "
So should I install maya's devkit separetly or somehing? I so, how to "install it"? Should I copy paste all folder of "dekitBase" in maya? Do I even need the SDK?

Hey Rudi, Since I don't have a WIndows Maya development environment, I can only try and guess at the solutions. But it might help you in the meantime, until another Windows user chimes in.

This error looks like it is failing to find the FineMaya.cmake extension module that was provided by Chad's repo. The idea here with cmake is that it is a build system generator, which supports extension modules to do reusable custom tasks, and in this case, to find Maya's development env. The README in Chad's project is suggesting a way to structure your own project and the contents of the CMakeLists files, and to ensure that you have the FindMaya.cmake file in the right spot. 

These lines in the root CMakeLists are setting the tools dir to be relative to the current source directory processed by cmake (./cgcmake/modules),
so it assumes you have this existing path:   ./cgcmake/modules/FindMaya.cmake
Can you confirm that you have this module file in the correct location in your own project?

It will load the FindMaya.cmake because of this:
https://github.com/chadmv/cgcmake/blob/master/README.md?plain=1#L48

Once you get past that part of cmake finding the module, then it will try to determine the location of your Maya installation:
https://github.com/chadmv/cgcmake/blob/master/modules/FindMaya.cmake#L54

And you can see what aspects of the Maya installation it expects to find (includes and devkit):
https://github.com/chadmv/cgcmake/blob/master/modules/FindMaya.cmake#L86

Hope that unblocks you.
 
Message has been deleted

Rudi Hammad

unread,
Jan 2, 2022, 10:56:00 AM1/2/22
to Python Programming for Autodesk Maya
hey,
yes I followed the same folders structure. I also added the devkit/include. But when I run the cmd commands, it creates the folders inside the created folder build.2018, but stops with the error mentioned before, and build.2018\src\CMakeFiles is empty.

It seems that maya devkit isn't included anymore in maya. I downloaded it, and you get a the main "devkitBase" folder, and in it you have "cmake"(with qt-5.6.1_vc14-cmake.tar inside), "devkit", "include", "lib", "mkspecs". And then inside each, you have other folders, etc.. so there isn't a "devkit/include". They are separate folders: "devkit" and "include".

hmmm...I guess there is no alternative way to complile plugins for mac from windows?
I have to ship some plugins for animators that use windows and mac, so I need to figure out that. I'll keep trying.

Marcus Ottosson

unread,
Jan 2, 2022, 11:31:34 AM1/2/22
to python_in...@googlegroups.com
> hmmm...I guess there is no alternative way to complile plugins for mac from windows?

Your only option is to build on MacOS, either on a real Mac, a "Hackintosh" or a virtual machine. There is no way to compile a Maya plug-in for Mac using anything but MacOS. The same goes for all platforms. They must be built on the OS they are meant to be used on.
Message has been deleted

Rudi Hammad

unread,
Jan 2, 2022, 7:31:17 PM1/2/22
to Python Programming for Autodesk Maya
bummer, that's a pain. I'd better make CMake work then.

Rudi Hammad

unread,
May 4, 2023, 1:43:57 PM5/4/23
to Python Programming for Autodesk Maya

Hello,
since I have time now  I wanted to revive this topic because I have to make it work for future project.
I am trying to track the error, so I added this the code below before the error happening with  find_package(Maya REQUIRED)
message ("---------------------------------------")
message (${CMAKE_MODULE_PATH})
message ("---------------------------------------")
So  I wanted to make sure CMAKE_MODULE_PATH is right. As you can see in the image the path is correct and it contains FinMaya.cmake. And still, it says I am not providing it. I am really stuck because all looks okey doesn't it?
Capture.JPG

Justin Israel

unread,
May 4, 2023, 3:50:59 PM5/4/23
to python_in...@googlegroups.com


On Fri, 5 May 2023, 5:44 am Rudi Hammad, <rudih...@gmail.com> wrote:

Hello,
since I have time now  I wanted to revive this topic because I have to make it work for future project.
I am trying to track the error, so I added this the code below before the error happening with  find_package(Maya REQUIRED)
message ("---------------------------------------")
message (${CMAKE_MODULE_PATH})
message ("---------------------------------------")
So  I wanted to make sure CMAKE_MODULE_PATH is right. As you can see in the image the path is correct and it contains FinMaya.cmake. And still, it says I am not providing it. I am really stuck because all looks okey doesn't it?

Could you try this, to debug the module search path? 


Rudi Hammad

unread,
May 5, 2023, 1:04:55 AM5/5/23
to Python Programming for Autodesk Maya
Not sure If I am using  find_program  right. The signature says find_program (<VAR> name1 [path1 path2 ...]) . This what I added
set(CMAKE_FIND_DEBUG_MODE TRUE)
find_program(cache "FindMaya.cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_FIND_DEBUG_MODE FALSE)

The console prints out a bunch of paths. The ones at the end are:
C:/Users/rudi hammad/Desktop/testCMake/testingCMake/cgcmake/modules/FindMaya.cmake.com
C:/Users/rudi hammad/Desktop/testCMake/testingCMake/cgcmake/modules/FindMaya.cmake.exe
C:/Users/rudi hammad/Desktop/testCMake/testingCMake/cgcmake/modules/FindMaya.cmake

Chad Vernon

unread,
May 5, 2023, 1:10:42 AM5/5/23
to python_in...@googlegroups.com
Maybe it has something to do with the space in your user name? Might need to put quotes around your path when you set the CMAKE_MODULE_PATH

You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/CnsXI9qxsww/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/ebfeea9a-4c04-4b21-ae68-787549e01ba9n%40googlegroups.com.

Justin Israel

unread,
May 5, 2023, 2:02:25 AM5/5/23
to python_in...@googlegroups.com


On Fri, 5 May 2023, 5:05 pm Rudi Hammad, <rudih...@gmail.com> wrote:
Not sure If I am using  find_program  right.

I thought you were previously trying to test the behavior of find_package. Did that not seem like the right thing to discover FindMaya.cmake? What was the outcome of the debug output? 

Rudi Hammad

unread,
May 5, 2023, 2:36:18 AM5/5/23
to Python Programming for Autodesk Maya
hey Chad,
Just tried what you suggesteed. In CmakeLists.txt (the one in the root) I changed
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cgcmake/modules)
to
set(CMAKE_MODULE_PATH "C:/Users/rudi hammad/Desktop/testCMake/testingCMake/cgcmake/modules")

Same result.
The thing that confuses me is that the path out put to the folder containing FindMaya is correct, but the message says otherwise. I am sure I must be doing something stupid, but I can't see it.

Rudi Hammad

unread,
May 5, 2023, 2:46:17 AM5/5/23
to Python Programming for Autodesk Maya
This is is my src/CMakeLists.txt
here is the entire output
https://pastebin.com/WEmMFGr0

Justin Israel

unread,
May 5, 2023, 3:08:09 AM5/5/23
to python_in...@googlegroups.com


On Fri, 5 May 2023, 6:46 pm Rudi Hammad, <rudih...@gmail.com> wrote:
This is is my src/CMakeLists.txt
here is the entire output
https://pastebin.com/WEmMFGr0


I'm still wondering why you switched from find_package to find_program. My cmake skills are not strong but I thought the latter was for finding the full path to an executable? 

Rudi Hammad

unread,
May 5, 2023, 6:50:02 AM5/5/23
to Python Programming for Autodesk Maya
I switched because apparently I can't read properly...my bad. Now I am using this:
set(CMAKE_FIND_DEBUG_MODE TRUE)
find_package("Maya")
set(CMAKE_FIND_DEBUG_MODE FALSE)


( I was checking again Chad videos again and if I understood properly, when CMake runs find_package("Maya")  what it does is looking for the word "Find" + the input in between () , so Maya + .cmake.
That a bit weird, why not just ind_package("FindMaya")? )


I also tried this find_path() (I  think I am using it right):
set(CMAKE_FIND_DEBUG_MODE TRUE)
find_path(cache "FindMaya.cmake" ${CMAKE_MODULE_PATH})
set(CMAKE_FIND_DEBUG_MODE FALSE)

Justin Israel

unread,
May 5, 2023, 7:02:44 AM5/5/23
to python_in...@googlegroups.com
I just noticed something from your first email. Your screenshot shows that your directory is named "cgmake" but you are setting your module path as if it were called "cgcmake" (like Chad's original repo). Is that the cause of this whole problem? If so, then you should fix the dir name (or the module path you are setting) and go back to using
find_package(Maya REQUIRED) 
It should discover FindMaya.cmake if your module path matches what really exists on disk. 

Rudi Hammad

unread,
May 5, 2023, 7:43:34 AM5/5/23
to Python Programming for Autodesk Maya
jesus.... yep, that was it....I definitely need new glasses.  Thanks.
The plugin compiled alright.

So now I guess I will have to install a virtual machine on windows to emulate mac and run this same code to compile for that platform.
Reply all
Reply to author
Forward
0 new messages