Mac OS X Makefile for Maya API Plugins?


#21

That is awesome!!:bounce:

Many Maya OSX users will be grateful. I think the pose deformer web page says that it is only compatable with Maya 6+? But I could be wrong.

Assuming Mr Comet will not mind…can you post the OSX files?

Good job!


#22

Any update?


#23

It would be extremly fantastic if you share the compiled version of the plugin :slight_smile:

Greetings,
jay


#24

I sent the compiled version to the developer. That’s is totally up to him.

Regards,


#25

Hmm I don’t think I ever got it…email me again…I’ll make sure it works and try to get it up online for people…thanks! I probably should just recompile this myself…I’ve just been busy… finishing up Ant Bully and now moving to S.F. for a new job…heh.


#26

I just sent you the Lib files and the Xcode project files. They should build no problem, just put the your source files in the folder were you put the xcode files.

-tc


#27

Any news on this?

Ahh… Ant Bully! Looking forward to see that flick :slight_smile:


#28

this template works for me:


all : maya_plug

MODULE = my_module_name

INSTALL_ROOT = $(HOME)/mytools
INSTALL_PLUGIN_DIR=$(INSTALL_ROOT)/maya/7.0/plugins/
INSTALL_MEL_DIR=$(INSTALL_ROOT)/maya/7.0/mel
INSTALL_ICON_DIR=$(INSTALL_ROOT)/maya/icons

BUILD_DIR=./build
DEPDIR = ./deps
escape=$(shell echo $(patsubst %.cc,%,$<) | sed -e 's/\//\\\//g')
df = $(DEPDIR)/$(*)
INST=/usr/bin/install

EXR_VERSION=1.2.1
BOOST_VERSION=1.32.0


ifeq ($(shell uname -s),Darwin)

EXT=lib
MAYA_LOCATION=/Applications/Alias/maya7.0/Maya.app/Contents
MAYA_DEVKIT=$(MAYA_LOCATION)/../../devkit
FRAMEWORK=/System/Library/Frameworks
IMATH_BASE=/Library/openexr-$(EXR_VERSION)
INCL_PATH=-I. -I.. -F$(BUILD_DIR) \
	-I$(MAYA_DEVKIT)/include \
	-I/usr/X11R6/include \
	-I${IMATH_BASE}/include/OpenEXR \
	-I/Library/boost/$(BOOST_VERSION) \
	-include $(MAYA_DEVKIT)/include/maya/OpenMayaMac.h
LD_PATH=-L$(BUILD_DIR) -L$(MAYA_LOCATION)/MacOS -F$(BUILD_DIR)
ARCH=ppc
OPT_FLAGS=-O3
CFLAGS=-x c++ -arch $(ARCH) -pipe -Wno-trigraphs \
	-fasm-blocks -fpascal-strings $(OPT_FLAGS) \
	-mtune=G4 -Wno-four-char-constants \
	-Wno-long-double -fPIC \
	-DMAC_PLUGIN -D_BOOL -DREQUIRE_IOSTREAM -DAW_NEW_IOSTREAMS \
	-Wmost -fmessage-length=0 -ffix-and-continue 
LD_FLAGS=-arch $(ARCH) -Wl,-single_module -dynamiclib \
	-compatibility_version 1 -current_version 1 \
	-multiply_defined suppress \
	-install_name /usr/local/lib/$(TARGET_PLUGIN)
MAYA_LIBS=-lOpenMaya -lOpenMayaUI -lOpenMayaAnim -lOpenMayaRender \
	-lFoundation -framework AGL -framework OpenGL \
	-Wl,-executable_path,$(MAYA_LOCATION)/MacOS
IMATH_LIBS=-L${IMATH_BASE}/lib -lImath -lIex
LIBS=-lm

CXX=g++
CC=gcc

else
$(error macosx only)
endif

TARGET_PLUGIN=$(MODULE).$(EXT)
	
SRCS=	some_source_code.cc	
OBJS=$(patsubst %.cc,$(BUILD_DIR)/%.o,$(SRCS))

maya_plug : $(BUILD_DIR)/$(TARGET_PLUGIN) 

$(BUILD_DIR)/$(TARGET_PLUGIN) : $(OBJS)
	@mkdir -p  $(shell dirname $@)
	$(CXX) $(LD_PATH) -o $@ $^ $(LD_FLAGS) $(IMATH_LIBS) $(MAYA_LIBS) $(LIBS)

$(BUILD_DIR)/%.o : %.cc
	@echo \# $@
	@mkdir -p $(shell dirname $(df))
	@mkdir -p $(shell dirname $@)
	@$(CC) -MM $(CFLAGS) $(INCL_PATH) $< |\
		sed -e 's/ *\\$$//g' -e 's/^ *//' |\
		tr ' ' '
' | grep -v : |\
		sed -e 's/\(.*\)/$$(BUILD_DIR)\/$(escape).o: \1/' \
		> $(df).d
	@cp $(df).d $(df).P
	@sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
		-e '/^$$/ d' -e 's/$$/ :/' < $(df).d >> $(df).P
	@rm -f $(df).d
	$(CXX) $(CFLAGS) $(INCL_PATH) -c -o $@ $<
	
-include $(SRCS:%.cc=$(DEPDIR)/%.P)


install : maya_plug
	mkdir -p $(INSTALL_PLUGIN_DIR)
	mkdir -p $(INSTALL_MEL_DIR)
	mkdir -p $(INSTALL_ICON_DIR)
	$(INST) $(BUILD_DIR)/$(TARGET_PLUGIN) $(INSTALL_PLUGIN_DIR)/
	$(INST) myscript.mel $(INSTALL_MEL_DIR)/
	$(INST) icons/myicon.xpm $(INSTALL_ICON_DIR)
	
clean :
	-rm -rf $(BUILD_DIR)/$(TARGET_PLUGIN) $(BUILD_DIR) $(DEPDIR)


#29

Craig,

thank you for posting the template!

I tried to build the plugin with make, but since I’m very new to makefiles (used XCode so far) I stuck with some problems.

When I replace “some_source_code.cc” with a source file like “plugin.cpp” I get the message “plugin.cpp:1: *** missing separator. Stop.” when running make. Google told me that this could be a wrong space or a wrong tab in the makefile but I cannot locate the bug.

Could you give me a hint?

Thanks,
j.


#30

it’s written to work with source files that have the extension .cc, not .cpp. (was just a personal preference). just do a search and replace.
also, you might have to remove the Imath and boost stuff from there, if you don’t use that.

http://www.gnu.org/software/make/


#31

.cpp works now. Removed IMath and Boost, seems to be ok, too.
But building fails with the message “cc1plus: error: //: No such file or directory”.

After asking Google I found this site: http://www.joewein.de/sw/swcc1plus.htm
But… I’m stuck here. Do I have to reinstall XCode?

It would be great if you can help me out. I’d really love to see poseDeformer running on Mac.

Greetings,
j.


#32

can you post back the makefile with the changes you’ve made.

i’m not sure if that error is saying that cc1plus is not found, or that cc1plus couldn’t find a file that was passed to it. also, i seem to remember having problems linking maya plugs on mac osx after upgrading quicktime. i’m not actually on a mac right now, so i’ll have to take a look at it later.


#33

Thank you, I appreciate your support!


all : maya_plug

MODULE = my_module_name

INSTALL_ROOT = $(HOME)/mytools
INSTALL_PLUGIN_DIR=$(INSTALL_ROOT)/maya/7.0/plugins/
INSTALL_MEL_DIR=$(INSTALL_ROOT)/maya/7.0/mel
INSTALL_ICON_DIR=$(INSTALL_ROOT)/maya/icons

BUILD_DIR=./build
DEPDIR = ./deps
escape=$(shell echo $(patsubst %.cpp,%,$<)  | sed -e 's/\//\\\//g')
df = $(DEPDIR)/$(*)
INST=/usr/bin/install

EXR_VERSION=1.2.1
// BOOST_VERSION=1.32.0


ifeq ($(shell uname -s),Darwin)

EXT=lib
MAYA_LOCATION=/Applications/Alias/maya7.0/Maya.app/Contents
MAYA_DEVKIT=$(MAYA_LOCATION)/../../devkit
FRAMEWORK=/System/Library/Frameworks
// IMATH_BASE=/Library/openexr-$(EXR_VERSION)
INCL_PATH=-I. -I.. -F$(BUILD_DIR) \
	-I$(MAYA_DEVKIT)/include \
	-I/usr/X11R6/include \
	// -I${IMATH_BASE}/include/OpenEXR \
	// -I/Library/boost/$(BOOST_VERSION) \
	-include $(MAYA_DEVKIT)/include/maya/OpenMayaMac.h
LD_PATH=-L$(BUILD_DIR) -L$(MAYA_LOCATION)/MacOS -F$(BUILD_DIR)
ARCH=ppc
OPT_FLAGS=-O3
CFLAGS=-x c++ -arch $(ARCH) -pipe -Wno-trigraphs \
	-fasm-blocks -fpascal-strings $(OPT_FLAGS) \
	-mtune=G4 -Wno-four-char-constants \
	-Wno-long-double -fPIC \
	-DMAC_PLUGIN -D_BOOL -DREQUIRE_IOSTREAM -DAW_NEW_IOSTREAMS \
	-Wmost -fmessage-length=0 -ffix-and-continue 
LD_FLAGS=-arch $(ARCH) -Wl,-single_module -dynamiclib \
	-compatibility_version 1 -current_version 1 \
	-multiply_defined suppress \
	-install_name /usr/local/lib/$(TARGET_PLUGIN)
MAYA_LIBS=-lOpenMaya -lOpenMayaUI -lOpenMayaAnim -lOpenMayaRender \
	-lFoundation -framework AGL -framework OpenGL \
	-Wl,-executable_path,$(MAYA_LOCATION)/MacOS
// IMATH_LIBS=-L${IMATH_BASE}/lib -lImath -lIex
LIBS=-lm

CXX=g++
CC=gcc

else
$(error macosx only)
endif

TARGET_PLUGIN=$(MODULE).$(EXT)
	
SRCS=	plugin.cpp	
OBJS=$(patsubst %.cpp,$(BUILD_DIR)/%.o,$(SRCS))

maya_plug : $(BUILD_DIR)/$(TARGET_PLUGIN) 

$(BUILD_DIR)/$(TARGET_PLUGIN) : $(OBJS)
	@mkdir -p  $(shell dirname $@)
	$(CXX) $(LD_PATH) -o $@ $^ $(LD_FLAGS) $(MAYA_LIBS) $(LIBS) //$(IMATH_LIBS)

$(BUILD_DIR)/%.o : %.cpp
	@echo \# $@
	@mkdir -p $(shell dirname $(df))
	@mkdir -p $(shell dirname $@)
	@$(CC) -MM $(CFLAGS) $(INCL_PATH) $< |\
		sed -e 's/ *\\$$//g' -e 's/^ *//' |\
		tr ' ' '
' | grep -v : |\
		sed -e 's/\(.*\)/$$(BUILD_DIR)\/$(escape).o: \1/' \
		> $(df).d
	@cp $(df).d $(df).P
	@sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
		-e '/^$$/ d' -e 's/$$/ :/' < $(df).d >> $(df).P
	@rm -f $(df).d
	$(CXX) $(CFLAGS) $(INCL_PATH) -c -o $@ $<
	
-include $(SRCS:%.cpp=$(DEPDIR)/%.P)


install : maya_plug
	mkdir -p $(INSTALL_PLUGIN_DIR)
	mkdir -p $(INSTALL_MEL_DIR)
	mkdir -p $(INSTALL_ICON_DIR)
	$(INST) $(BUILD_DIR)/$(TARGET_PLUGIN) $(INSTALL_PLUGIN_DIR)/
	$(INST) myscript.mel $(INSTALL_MEL_DIR)/
	$(INST) icons/myicon.xpm $(INSTALL_ICON_DIR)
	
clean :
	-rm -rf $(BUILD_DIR)/$(TARGET_PLUGIN) $(BUILD_DIR) $(DEPDIR)

Any ideas where the bug could be?


#34
  • use # instead of // for comments.
  • don’t put comments in the middle of the INCL_PATH line, because of the \ chars at the end.
  • make sure there are tabs not 4/8 spaces after you paste that text into the makefile.
  • get rid of the -arch $(ARCH) bits, and remove ARCH=pcc, (are you on an intel mac?)

i’m testing this on G4 machine with 10.3.9, works fine.


#35

Ok I finally got around to compiling this stuff for Mac OS X.

Go to my site:
http://www.comet-cartoons.com/melscript.php

the zip file will now contain bin files for Maya 7.0 Mac OS X for poseReader.lib and poseDeformer.lib. I haven’t actually tested this but it should work…

Enjoy,
comet


#36

Thank you very much Guys!

Greets,
j.


#37

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.