Build a plugin for all maya versions


#1

Autodesk did quite a sloppy job concerning plugin support between versions, which forces you to build a specific plugin for each maya version.

  1. I am wondering if I can download somewhere just the build environments (include and lib) for all maya versions?

  2. Is there a tool that can easily build a visual studio solution for example against each maya version automatically?


#2

Solved for visual studio:

  1. Just download trial installs of all the versions. No need to install them. Using winrar open each install, open the main .cab file, and copy the .lib .exp to maya20xx/lib, and the .h to maya20xx/include/maya.

  2. Use my cute script to build all the versions in one click. Edit my script and change the necessary paths.

http://svn.code.sf.net/p/mymayaplugins/code-0/trunk/standalone-scripts/

For example I used it to build:

http://forums.cgsociety.org/showthread.php?f=89&t=1041117


#3

Thanks, very useful, i will try it.


#4

cmake can be used to create visual studio projects as well as build environments for linux and mac.


#5

Yes, and it’s quite good, but how do you tell it in one click to build a plugin for all maya versions for your specific platform? I mean you need to run cmake again even if you just want to switch from x64 to win32. That’s for visual studio at least. Linux people have their own tricks and can easily play with the makefile and env. OSX I never touched before.


#6

Correct, cmake won’t compile it for you. You could build wrapper scripts around it. If you want a built in one stop shop, you could try using scons.


#7

Hmm, I never heard of it, but at first glance it looks interesting and widely used:

http://en.wikipedia.org/wiki/SCons
http://www.avango.org/wiki/VisualStudio

It looks better than a makefile although not sophisticated as:

http://forums.cgsociety.org/showthread.php?f=89&t=1010489&highlight=smart

But it seems that I would need to convert all my projects to their script format:

http://stackoverflow.com/questions/1773613/visual-studio-solution-to-scons

, and I’m reluctant to do that. There are various features that are easily customizable inside the VS ide for the .vcxproj, and I’m not sure about scons integration. I prefer a solution like the patch I made that gets as an input a .sln and uses msbuild to build it for all the versions without messing with the inner parameters. So maybe I should have named this thread better as a utility to build visual studio .sln for all maya versions.

Actually the script is quite naive, but the main crux is that I patch the environment

Microsoft.Cpp.Win32.user.props
Microsoft.Cpp.x64.user.props

(don’t forget to backup them) in order to change the include / lib path of the current maya version build. Second I look for a .mll that was created in a subdirectory that contains Release, name it properly and copy it to the plug-in dir.

I would have liked a cleaner solution for:

  1. Pass parameters to msbuild for the added include / lib that would precede the current settings.
  2. Get the name of the output file of the build.

I know that msbuild has a parameter for the lib, which doesn’t quite work, and beyond that, since it deals with .sln, I’m not sure what you can do.


#8

If you use windows, and VisualStudio, why don’t you use the “Build->BatchBuild” list to create the plugins all at once?


#9

I wasn’t aware of the batch build, although I guess I could have instead created a batch with msbuild for each platform. But this means that instead of maintaining 2 configurations (win32, x64) I will need to maintain 6 (for each maya version). So if a switch needs to be changed… Although I could hope that it’s the same switch for all the configurations, and choose all conf / all platforms. Interesting, a method that I might have lived with. Instead of working with the system, I find the brute force to shape it…


#10

mv makefile makefile.linux.mk

You can do everything for every platform from a single makefile (which may make heavy use of cmake to regen the build files for each platform). It’s generally better to start with something that at least gives you dependency checking. Ad-hoc build generators without that can develop quirks imho.

If you use windows, and VisualStudio, why don’t you use the “Build->BatchBuild” list to create the plugins all at once?

Because it doesn’t take account of the fact you need to link to differing versions of the CRT depending on which maya version it is (compiling a 64bit 2012 plugin with VC++ 2005 isn’t a good idea, and neither is compiling a maya 6.0 plugin using VC11 beta). The plug-ins will generally build, but using an incorrect version has (in my experience) been the cause of some ungodly crashes.

Managing complex builds of this sort is a massive PITA. You can configure it manually, but you will lose your sanity. Auto-generating build files is the way to go.

Linux people have their own tricks and can easily play with the makefile and env

Make is available on windows.


#11

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.