anyone know whats involved in compiling maya plugins for win using cygwin? if someone has a makefile that will really help.
mr grumpy
[ Editor ]
I don't think it's possible to use g++ to build a Maya plug-in for Windows, the ABI will be different, name mangling, vtables, etc.
I've been calling Microsoft's cl.exe/link.exe instead of g++; rip all the flags out of the VS project. You could have all the platform-specific variable definitions in another file and include it into the main Makefile. e.g. for Maya 2011-x64...
cxx := "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/amd64/cl.exe"
cc := $(cxx)
ld := "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/amd64/link.exe"
ar := "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/amd64/lib.exe"
vc_incl := "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include"
vc_libpath := "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\amd64"
vc_sdk_incl := "C:\Program Files\Microsoft SDKs\Windows\v7.0\include"
vc_sdk_libpath := "C:\Program Files\Microsoft SDKs\Windows\v7.0\lib\x64"
cflags := /c /O2 /nologo /W3 /Ob1 /Gy /DNOMINMAX
cflags += /MD
cxxflags := /GR /EHs /TP /EHsc $(cflags)
cxxflags += /DNDEBUG \
/DNT_PLUGIN /DREQUIRE_IOSTREAM /DAW_NEW_IOSTREAMS /DGLEW_STATIC \
/FD /D_CRT_SECURE_NO_WARNINGS /fp:precise /Gd
cxxflags += /DWIN_NT /DWIN32 /D_WIN32 /D_WINDOWS /D_WINDLL
cxxflags += /DBits64_ /D_WIN64
maya_version := 2011
maya_include := "C:\Program Files\Autodesk\Maya$(maya_version)\include"
maya_libpath := "C:\Program Files\Autodesk\Maya$(maya_version)\lib"
maya_version := $(maya_version)-x64
includes := /I. /I$(vc_incl) /I$(vc_sdk_incl) /I$(maya_include)
lib_path := /LIBPATH:$(vc_libpath) /LIBPATH:$(vc_sdk_libpath)
ldflags := /nologo /OPT:NOREF /INCREMENTAL:NO
gl_libs := opengl32.lib glu32.lib
maya_libs := /LIBPATH:$(maya_libpath) odbc32.lib odbccp32.lib \
OpenMaya.lib Foundation.lib OpenMayaUI.lib \
OpenMayaAnim.lib OpenMayaFX.lib OpenMayaRender.lib \
$(gl_libs) wsock32.lib tbb.lib
dso_flags = /DLL /export:initializePlugin /export:uninitializePlugin
pluglibext = mll
staticlibext = lib
objext = obj
ld_out = /OUT:$@
cc_out = /Fo$@
inst = /cygdrive/c/cygwin/bin/install
The rest is the same as on Linux/Mac.

out of curiosity, why would you wan’t to do that ?
I’ve been using Rake (Ruby Make) to build for mac and linux, and it means I don’t have to maintain project files from different IDEs. XCode, KDevelop etc. In the Rakefile I have an switch statement for platforms so I just want to add windows as a case and keep things DRY.
does Rake forces you somehow to use cygwin? I use cmake and build with gcc under linux, and msvc under win…
The reason I set up cygwin was to use bash. I’d rather not be using windows at all. I’m sure you can run Rake on Win without cygwin, but I was using some env vars that were set in bashrc – the same bashrc (symlinked) for mac and linux.