#!/bin/sh # Shave and a Haircut # (c) 2019 Epic Games # US Patent 6720962 maya=$1 if [ "${maya}" = "" ]; then echo "Usage: $0 mayaVersion" >&2 echo "" exit 1 fi if [ "${SHAVE_ARNOLD_SDKS}" = "" ]; then echo "SHAVE_ARNOLD_SDKS not defined. Shave will be built without Arnold support." >&2 exit 3 fi export MAYA_LOCATION=/Applications/Autodesk/maya${maya} pushd .. source getosxvars.sh popd if [ -d Release/${maya} ]; then rm -rf Release/${maya} fi grep "^${maya}:" supportedMtoAVersions.txt | while read mayaVer minVer maxVer buildVer garbage; do mtoaMin=${minVer/\/*/} arnoldMin=${minVer/*\//} mtoaMax=${maxVer/\/*/} arnoldMax=${maxVer/*\//} mtoaBuild=${buildVer/\/*/} arnoldBuild=${buildVer/*\//} safeMtoABuild=${mtoaBuild//./_} safeArnoldBuild=${arnoldBuild//./_} # Special case: this version of MtoA is not available on MacOS. # if [ "${mtoaBuild}" = "1.3.0.0" ]; then continue fi arnoldPath=${SHAVE_ARNOLD_SDKS}/arnold/${arnoldBuild}/osx mtoaPath=${SHAVE_ARNOLD_SDKS}/mtoa/${mtoaBuild}/maya${maya}/osx ARNOLD_RANGE="-DMIN_ARNOLD_VERSION=${arnoldMin} -DMAX_ARNOLD_VERSION=${arnoldMax}" CPPFLAGS="-fvisibility=hidden -Wno-reorder -Wall -Wsign-compare -O3 \ -funroll-loops -arch x86_64 -fPIC \ -DENABLE_COLOR_MANAGEMENT -DNDEBUG -DENABLE_XGEN -DENABLE_VP2 \ -DENABLE_BIFROST -DENABLE_LOOKDEVKIT -DENABLE_RENDERSETUP -D_DARWIN \ -DOSMac_ \ -I${arnoldPath}/include" PLUGIN_CPPFLAGS="${CPPFLAGS} -D_BOOL -DREQUIRE_IOSTREAM \ -I../mayaPlug \ -I${mtoaPath}/include \ -I/Applications/Autodesk/maya${maya}/include" LDFLAGS="-fvisibility=hidden -arch x86_64 -framework Security -dynamiclib \ -L${arnoldPath}/bin \ -lai" PLUGIN_LDFLAGS="${LDFLAGS} \ -L${mtoaPath}/lib \ -L../mayaPlug \ -L/Applications/Autodesk/maya${maya}/Maya.app/Contents/MacOS \ -lpthread -lFoundation -lOpenMaya -lOpenMayaRender -lOpenMayaUI \ -lOpenMayaAnim -lOpenMayaFX \ -lShaveAPI -lmtoa_api" OUTDIR=Release/${maya}/${mtoaBuild} mkdir -p ${OUTDIR} g++ ${PLUGIN_CPPFLAGS} -o ${OUTDIR}/plugin.o -c plugin/plugin.cpp if [ $? -ne 0 ]; then exit 1 fi echo "g++ ${PLUGIN_CPPFLAGS} -o ${OUTDIR}/ShaveAndHaircut.o -c plugin/ShaveAndHaircut.cpp" g++ ${PLUGIN_CPPFLAGS} -o ${OUTDIR}/ShaveAndHaircut.o -c plugin/ShaveAndHaircut.cpp if [ $? -ne 0 ]; then exit 1 fi echo "g++ ${PLUGIN_LDFLAGS} -o ${OUTDIR}/shave.dylib ${OUTDIR}/plugin.o ${OUTDIR}/ShaveAndHaircut.o" g++ ${PLUGIN_LDFLAGS} -o ${OUTDIR}/shave.dylib ${OUTDIR}/plugin.o ${OUTDIR}/ShaveAndHaircut.o if [ $? -ne 0 ]; then exit 1 fi g++ ${CPPFLAGS} ${ARNOLD_RANGE} -o ${OUTDIR}/ShaveHair.o -c shaders/ShaveHair.cpp if [ $? -ne 0 ]; then exit 1 fi # We may have several versions of the shader for a given version of # MtoA, so we have to differentiate them. # g++ ${LDFLAGS} -o ${OUTDIR}/shave_shaders-${safeArnoldBuild}.dylib ${OUTDIR}/ShaveHair.o if [ $? -ne 0 ]; then exit 1 fi done