mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
125 lines
4.4 KiB
Bash
Executable File
125 lines
4.4 KiB
Bash
Executable File
#! /bin/bash
|
|
|
|
# This is just a helper script to generatePythonCode to cover
|
|
# the three or four cases we use all the time
|
|
# usage: genPyCode [opts] [linux|win-debug|win-release|win-publish|install|release] [other libs]
|
|
|
|
# -g adds libgateway
|
|
# -t adds libtoontown
|
|
# -p adds libpirates
|
|
# -v adds libvrpn
|
|
# -e adds libpandaegg
|
|
# -n doesn't perform a squeeze
|
|
|
|
base_dir=$(pwd)
|
|
extra_genPyCode_libs=""
|
|
squeezeFlag=""
|
|
optimizeFlag=""
|
|
ppython=ppython
|
|
ppythonOptimizeFlag=""
|
|
|
|
while getopts ogtpven flag; do
|
|
case $flag in
|
|
o) extra_genPyCode_libs="$extra_genPyCode_libs libotp" ;;
|
|
g) extra_genPyCode_libs="$extra_genPyCode_libs libgateway" ;;
|
|
t) extra_genPyCode_libs="$extra_genPyCode_libs libtoontown" ;;
|
|
p) extra_genPyCode_libs="$extra_genPyCode_libs libpirates" ;;
|
|
v) extra_genPyCode_libs="$extra_genPyCode_libs libvrpn" ;;
|
|
e) extra_genPyCode_libs="$extra_genPyCode_libs libpandaegg" ;;
|
|
n) doSqueeze="-n" ;;
|
|
esac
|
|
done
|
|
|
|
shift `expr $OPTIND - 1`
|
|
|
|
buildType="$1"
|
|
shift
|
|
extra_genPyCode_libs="$extra_genPyCode_libs $*"
|
|
|
|
if [ "$INSTALL_DIR" != "" ]; then
|
|
install_dir="$INSTALL_DIR"
|
|
elif [ "$PANDA_INSTALL" != "" ]; then
|
|
install_dir="$PANDA_INSTALL"
|
|
elif [ "$DIRECT" != "" ]; then
|
|
install_dir="$DIRECT"
|
|
else
|
|
install_dir=./install
|
|
fi
|
|
|
|
if [ "$DIRECT" == "" ]; then
|
|
if [ "$PLAYER" != "" -a -d "$PLAYER/direct" ]; then
|
|
DIRECT="$PLAYER/direct"
|
|
elif [ -d direct ]; then
|
|
DIRECT=direct
|
|
else
|
|
echo "Define PLAYER to point to the panda & direct source root."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
pyDir=$DIRECT/lib/pandac
|
|
extDir=$DIRECT/src/extensions
|
|
pSqueezer=$DIRECT/src/showbase/pandaSqueezer.py
|
|
|
|
if [ "$buildType" = "linux" ]; then
|
|
cd $DIRECT/bin
|
|
ppython -d generatePythonCode -v -d $pyDir $doSqueeze -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
|
|
pSqueezer=$DIRECT/src/showbase/pandaSqueezer.py
|
|
|
|
elif [ "$buildType" = "win-debug" ]; then
|
|
cd $DIRECT/bin
|
|
pyDir="$(cygpath -w $pyDir)"
|
|
extDir="$(cygpath -w $extDir)"
|
|
pSqueezer="$(cygpath -w $pSqueezer)"
|
|
ppython -d generatePythonCode -v -d $pyDir $doSqueeze -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
|
|
elif [ "$buildType" = "win-release" ]; then
|
|
cd $DIRECT/bin
|
|
pyDir="$(cygpath -w $pyDir)"
|
|
extDir="$(cygpath -w $extDir)"
|
|
pSqueezer="$(cygpath -w $pSqueezer)"
|
|
ppython generatePythonCode -v -d $pyDir $doSqueeze -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
|
|
elif [ "$buildType" = "win-publish" ]; then
|
|
# no assertions, no comments, no docstrings
|
|
cd $DIRECT/bin
|
|
pyDir="$(cygpath -w $pyDir)"
|
|
extDir="$(cygpath -w $extDir)"
|
|
pSqueezer="$(cygpath -w $pSqueezer)"
|
|
ppython -OO generatePythonCode -O -v -d $pyDir $doSqueeze -e $extDir -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
|
|
optimizeFlag="-O"
|
|
ppythonOptimizeFlag="-OO"
|
|
|
|
elif [ "$buildType" = "install" ]; then
|
|
# Use relative paths; as installed on a machine without ctattach etc.
|
|
pyDir=$install_dir/lib/pandac
|
|
ppython=$install_dir/bin/ppython
|
|
pSqueezer=$DIRECT/src/showbase/pandaSqueezer.py
|
|
$ppython -d $install_dir/bin/generatePythonCode -O -v -d $pyDir $doSqueeze -e $DIRECT/src/extensions -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
|
|
elif [ "$buildType" = "release" ]; then
|
|
# Use relative paths; as installed on a machine without ctattach etc.
|
|
pyDir=$install_dir/lib/pandac
|
|
ppython=$install_dir/bin/ppython
|
|
pSqueezer=$DIRECT/src/showbase/pandaSqueezer.py
|
|
$ppython $install_dir/bin/generatePythonCode -v -d $pyDir $doSqueeze -e $DIRECT/src/extensions -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
|
|
else
|
|
echo "Invalid parameter: $buildType"
|
|
exit 1
|
|
fi
|
|
|
|
# The squeeze step is now performed as part of generatePythonCode.
|
|
|
|
#if [ "$fSqueeze" = "squeezeMe" ]; then
|
|
# echo SQUEEZING PandaModules
|
|
# rm -f $pyDir/PandaModules.py* $pyDir/__init__.py || exit
|
|
# $ppython $ppythonOptimizeFlag $pSqueezer $optimizeFlag -d $pyDir || exit
|
|
# touch $pyDir/__init__.py || exit
|
|
#else
|
|
# # renaming PandaModulesUnsqueezed.py to PandaModules.py
|
|
# cd $pyDir || exit
|
|
# rm -f PandaModules.py* || exit
|
|
# echo # junk line needed to keep mv from failing
|
|
# mv PandaModulesUnsqueezed.py PandaModules.py || exit
|
|
#fi
|
|
|
|
echo DONE
|
|
|