#!/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 gpp=`../utils/getg++.sh ${maya}` if [ "${gpp}" = "" ]; then echo "Could not find correct version of g++ for Maya ${maya}." >&2 echo "" exit 2 fi 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//./_} arnoldPath=${SHAVE_ARNOLD_SDKS}/arnold/${arnoldBuild}/linux mtoaPath=${SHAVE_ARNOLD_SDKS}/mtoa/${mtoaBuild}/maya${maya}/linux CPPFLAGS="-fvisibility=hidden -Wno-reorder -Wall -Wsign-compare -O3 -funroll-loops -fPIC \ -DENABLE_COLOR_MANAGEMENT -DNDEBUG -DENABLE_XGEN -DENABLE_VP2 -DENABLE_BIFROST -DENABLE_LOOKDEVKIT -DENABLE_RENDERSETUP \ -D_LINUX -Dnullptr=0 \ -I${arnoldPath}/include" if [ `echo "${maya} >= 2018" | bc` == 1 ]; then CPPFLAGS+=" -std=c++0x" fi PLUGIN_CPPFLAGS="${CPPFLAGS} -D_BOOL -DREQUIRE_IOSTREAM \ -Iplugin \ -I../mayaPlug \ -I${mtoaPath}/include \ -I/usr/autodesk/maya${maya}/include" LDFLAGS="-fvisibility=hidden -z origin -shared \ -L${arnoldPath}/bin \ -lGL -lpthread \ -lai" PLUGIN_LDFLAGS="${LDFLAGS} \ -L${mtoaPath}/lib \ -L../mayaPlug \ -L/usr/autodesk/maya${maya}/lib \ -lFoundation -lOpenMaya -lOpenMayaRender -lOpenMayaUI -lOpenMayaAnim -lOpenMayaFX \ -lmtoa_api -lShaveAPI" OUTDIR=Release/${maya}/${mtoaBuild} mkdir -p ${OUTDIR} ${gpp} ${PLUGIN_CPPFLAGS} -o ${OUTDIR}/plugin.o -c plugin/plugin.cpp ${gpp} ${PLUGIN_CPPFLAGS} -o ${OUTDIR}/ShaveAndHaircut.o -c plugin/ShaveAndHaircut.cpp ${gpp} ${PLUGIN_LDFLAGS} -o ${OUTDIR}/shave.so ${OUTDIR}/plugin.o ${OUTDIR}/ShaveAndHaircut.o ${gpp} ${CPPFLAGS} -o ${OUTDIR}/ShaveHair.o -c shaders/ShaveHair.cpp # We may have several versions of the shader for a given version of # MtoA, so we have to differentiate them. # ${gpp} ${LDFLAGS} -o ${OUTDIR}/shave_shaders-${safeArnoldBuild}.so ${OUTDIR}/ShaveHair.o done