Support building OpenSubdiv libraries under Debian (Ubuntu) with our build_deps.sh script.

Use --skip-osd to skip building opensubdiv libs,
use --force-osd to force a rebuild of the libs.

I added all needed user information (where to find the include dir, which -D options to set) to the print_info method that is called at the end too, so it should be pretty intuitive to use.

Reviewers: sergey, mont29

Reviewed By: mont29

Subscribers: mont29

Differential Revision: https://developer.blender.org/D1452
This commit is contained in:
Thomas Beck 2015-08-08 14:12:02 +02:00
parent fef31aadc4
commit dbdc55ab6a
1 changed files with 156 additions and 1 deletions

View File

@ -138,6 +138,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--force-osl
Force the rebuild of OpenShadingLanguage.
--force-osd
Force the rebuild of OpenSubdiv.
--force-opencollada
Force the rebuild of OpenCOLLADA.
@ -174,6 +177,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
--skip-osl
Unconditionally skip OpenShadingLanguage installation/building.
--skip-osd
Unconditionally skip OpenSubdiv installation/building.
--skip-opencollada
Unconditionally skip OpenCOLLADA installation/building.
@ -233,6 +239,12 @@ OSL_VERSION_MIN=$OSL_VERSION
OSL_FORCE_REBUILD=false
OSL_SKIP=false
# OpenSubdiv needs to be compiled for now
OSD_VERSION="3.0.2"
OSD_VERSION_MIN=$OSD_VERSION
OSD_FORCE_REBUILD=false
OSD_SKIP=false
# Version??
OPENCOLLADA_VERSION="1.3"
OPENCOLLADA_FORCE_REBUILD=false
@ -375,6 +387,11 @@ while true; do
OSL_VERSION_MIN=$OSL_VERSION
shift; shift; continue
;;
--ver-osd)
OSD_VERSION="$2"
OSD_VERSION_MIN=$OSD_VERSION
shift; shift; continue
;;
--force-all)
PYTHON_FORCE_REBUILD=true
NUMPY_FORCE_REBUILD=true
@ -384,6 +401,7 @@ while true; do
OIIO_FORCE_REBUILD=true
LLVM_FORCE_REBUILD=true
OSL_FORCE_REBUILD=true
OSD_FORCE_REBUILD=true
OPENCOLLADA_FORCE_REBUILD=true
FFMPEG_FORCE_REBUILD=true
shift; continue
@ -417,6 +435,9 @@ while true; do
--force-osl)
OSL_FORCE_REBUILD=true; shift; continue
;;
--force-osd)
OSD_FORCE_REBUILD=true; shift; continue
;;
--force-opencollada)
OPENCOLLADA_FORCE_REBUILD=true; shift; continue
;;
@ -447,6 +468,9 @@ while true; do
--skip-osl)
OSL_SKIP=true; shift; continue
;;
--skip-osd)
OSD_SKIP=true; shift; continue
;;
--skip-opencollada)
OPENCOLLADA_SKIP=true; shift; continue
;;
@ -509,6 +533,14 @@ OSL_SOURCE_REPO=( "https://github.com/Nazg-Gul/OpenShadingLanguage.git" )
OSL_SOURCE_REPO_UID="22ee5ea298fd215430dfbd160b5aefd507f06db0"
OSL_SOURCE_REPO_BRANCH="blender-fixes"
OSD_USE_REPO=true
# Script foo to make the version string compliant with the archive name:
# ${Varname//SearchForThisChar/ReplaceWithThisChar}
OSD_SOURCE=( "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v${OSD_VERSION//./_}.tar.gz" )
OSD_SOURCE_REPO=( "https://github.com/PixarAnimationStudios/OpenSubdiv.git" )
OSD_SOURCE_REPO_UID="404659fffa659da075d1c9416e4fc939139a84ee"
OSD_SOURCE_REPO_BRANCH="dev"
OPENCOLLADA_SOURCE=( "https://github.com/KhronosGroup/OpenCOLLADA.git" )
OPENCOLLADA_REPO_UID="3335ac164e68b2512a40914b14c74db260e6ff7d"
FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
@ -1522,6 +1554,99 @@ compile_OSL() {
run_ldconfig "osl"
}
#### Build OSD ####
_init_osd() {
_src=$SRC/OpenSubdiv-$OSD_VERSION
_git=true
_inst=$INST/osd-$OSD_VERSION
_inst_shortcut=$INST/osd
}
clean_OSD() {
_init_osd
_clean
}
compile_OSD() {
# To be changed each time we make edits that would modify the compiled result!
osd_magic=0
_init_osd
# Clean install if needed!
magic_compile_check osd-$OSD_VERSION $osd_magic
if [ $? -eq 1 -o $OSD_FORCE_REBUILD == true ]; then
clean_OSD
fi
if [ ! -d $_inst ]; then
INFO "Building OpenSubdiv-$OSD_VERSION"
prepare_opt
if [ ! -d $_src ]; then
mkdir -p $SRC
if [ $OSD_USE_REPO == true ]; then
git clone ${OSD_SOURCE_REPO[0]} $_src
else
download OSD_SOURCE[@] "$_src.tar.gz"
INFO "Unpacking OpenSubdiv-$OSD_VERSION"
tar -C $SRC --transform "s,(.*/?)OpenSubdiv-[^/]*(.*),\1OpenSubdiv-$OSD_VERSION\2,x" \
-xf $_src.tar.gz
fi
fi
cd $_src
if [ $OSD_USE_REPO == true ]; then
git remote set-url origin ${OSD_SOURCE_REPO[0]}
# XXX For now, always update from latest repo...
git pull --no-edit -X theirs origin $OSD_SOURCE_REPO_BRANCH
# Stick to same rev as windows' libs...
git checkout $OSD_SOURCE_REPO_UID
git reset --hard
fi
# Always refresh the whole build!
if [ -d build ]; then
rm -rf build
fi
mkdir build
cd build
cmake_d="-D CMAKE_BUILD_TYPE=Release"
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
# ptex is only needed when nicholas bishop is ready
cmake_d="$cmake_d -D NO_PTEX=1"
cmake_d="$cmake_d -D NO_CLEW=1"
# maya plugin, docs, tutorials, regression tests and examples are not needed
cmake_d="$cmake_d -D NO_MAYA=1 -D NO_DOC=1 -D NO_TUTORIALS=1 -D NO_REGRESSION=1 -DNO_EXAMPLES=1"
cmake $cmake_d ..
make -j$THREADS && make install
make clean
if [ -d $_inst ]; then
_create_inst_shortcut
else
ERROR "OpenSubdiv-$OSD_VERSION failed to compile, exiting"
exit 1
fi
magic_compile_set osd-$OSD_VERSION $osd_magic
cd $CWD
INFO "Done compiling OpenSubdiv-$OSD_VERSION!"
else
INFO "Own OpenSubdiv-$OSD_VERSION is up to date, nothing to do!"
INFO "If you want to force rebuild of this lib, use the --force-osd option."
fi
run_ldconfig "osd"
}
#### Build OpenCOLLADA ####
_init_opencollada() {
_src=$SRC/OpenCOLLADA-$OPENCOLLADA_VERSION
@ -1816,7 +1941,8 @@ install_DEB() {
libfreetype6-dev libx11-dev libxi-dev wget libsqlite3-dev libbz2-dev \
libncurses5-dev libssl-dev liblzma-dev libreadline-dev $OPENJPEG_DEV \
libopenal-dev libglew-dev libglewmx-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev"
libsdl1.2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libxrandr-dev \
libxinerama-dev"
OPENJPEG_USE=true
VORBIS_USE=true
@ -2089,6 +2215,20 @@ install_DEB() {
fi
fi
PRINT ""
if $OSD_SKIP; then
WARNING "Skipping OpenSubdiv installation, as requested..."
else
if $have_llvm; then
install_packages_DEB flex bison libtbb-dev
# No package currently!
PRINT ""
compile_OSD
else
WARNING "No LLVM available, cannot build OSD!"
fi
fi
if $WITH_OPENCOLLADA; then
PRINT ""
if $OPENCOLLADA_SKIP; then
@ -3011,6 +3151,14 @@ print_info() {
_buildargs="$_buildargs $_1 $_2"
fi
if [ -d $INST/osd ]; then
_1="-D WITH_OPENSUBDIV=ON"
_2="-D OPENSUBDIV_ROOT_DIR=$INST/osd"
PRINT " $_1"
PRINT " $_2"
_buildargs="$_buildargs $_1 $_2"
fi
if $WITH_OPENCOLLADA; then
_1="-D WITH_OPENCOLLADA=ON"
PRINT " $_1"
@ -3077,6 +3225,13 @@ print_info() {
PRINT "BF_OSL = '$INST/osl'"
fi
if [ "$OSD_SKIP" = false ]; then
PRINT "WITH_BF_OPENSUBDIV = True"
if [ -d $INST/osd ]; then
PRINT "BF_OPENSUBDIV = '$INST/osd'"
fi
fi
if [ "$BOOST_SKIP" = false ]; then
PRINT "WITH_BF_BOOST = True"
if [ -d $INST/boost ]; then