From 611a9b1bda3b24e7936f9a840f2a709fc394ba12 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 10 Oct 2016 19:17:43 +0200 Subject: install_deps.sh: first attempt to support cxx11. For now, we merely add an option that sets CXXFLAGS envvar with '--std=c++11' option. There is no check done to ensure compatibility with the system libraries, mainly because: - It is all but trivial to get this information in a generic and reliable way. - Currently even cutting edge distributions may still distribute some c++98 libraries. - With recent stdlibc++, both ABIs are supported together, which means that incompatibilities are rather unlikely. To summarize: if your system is recent and built with gcc-5.1 or more, you should not experience too much troubles with c++11. --- build_files/build_environment/install_deps.sh | 42 ++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'build_files') diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 51928b82d8c..1e017cdd9b8 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -25,7 +25,8 @@ ARGS=$( \ getopt \ -o s:i:t:h \ ---long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,with-all,with-opencollada,\ +--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,use-cxx11,\ +with-all,with-opencollada,\ ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,\ force-all,force-python,force-numpy,force-boost,\ force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\ @@ -103,6 +104,11 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: --no-confirm Disable any interaction with user (suitable for automated run). + --use-cxx11 + Build all libraries in cpp11 'mode' (will be mandatory soon in blender2.8 branch). + NOTE: If your compiler is gcc-6.0 or above, you probably *want* to enable this option (since it's default + standard starting from this version). + --with-all By default, a number of optional and not-so-often needed libraries are not installed. This option will try to install them, at the cost of potential conflicts (depending on @@ -281,6 +287,7 @@ SUDO="sudo" NO_BUILD=false NO_CONFIRM=false +USE_CXX11=false PYTHON_VERSION="3.5.1" PYTHON_VERSION_MIN="3.5" @@ -492,6 +499,9 @@ while true; do --no-confirm) NO_CONFIRM=true; shift; continue ;; + --use-cxx11) + USE_CXX11=true; shift; continue + ;; --with-all) WITH_ALL=true; shift; continue ;; @@ -766,7 +776,18 @@ OPENCOLLADA_REPO_BRANCH="master" FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" ) - +CXXFLAGS_BACK=$CXXFLAGS +if [ "$USE_CXX11" = true ]; then + WARNING "You are trying to use c++11, this *should* go smoothely with any very recent distribution +However, if you are experiencing linking errors (also when building Blender itself), please try the following: + * Re-run this script with `--build-all --force-all` options. + * Ensure your gcc version is at the very least 4.8, if possible you should really rather use gcc-5.1 or above. + +Please note that until the transition to C++11-built libraries if completed in your distribution, situation will +remain fuzzy and incompatibilities may happen..." + CXXFLAGS="$CXXFLAGS -std=c++11" + export CXXFLAGS +fi #### Show Dependencies #### @@ -953,7 +974,7 @@ prepare_opt() { # Check whether the current package needs to be recompiled, based on a dummy file containing a magic number in its name... magic_compile_check() { - if [ -f $INST/.$1-magiccheck-$2 ]; then + if [ -f $INST/.$1-magiccheck-$2-$USE_CXX11 ]; then return 0 else return 1 @@ -962,7 +983,7 @@ magic_compile_check() { magic_compile_set() { rm -f $INST/.$1-magiccheck-* - touch $INST/.$1-magiccheck-$2 + touch $INST/.$1-magiccheck-$2-$USE_CXX11 } # Note: should clean nicely in $INST, but not in $SRC, when we switch to a new version of a lib... @@ -1622,6 +1643,10 @@ compile_OIIO() { # fi cmake_d="$cmake_d -D USE_OCIO=OFF" + if [ "$USE_CXX11" = true ]; then + cmake_d="$cmake_d -D OIIO_BUILD_CPP11=ON" + fi + if file /bin/cp | grep -q '32-bit'; then cflags="-fPIC -m32 -march=i686" else @@ -4164,6 +4189,12 @@ print_info() { _buildargs="$_buildargs -U *OPENCOLORIO* -U *OPENEXR* -U *OPENIMAGEIO* -U *LLVM* -U *CYCLES*" _buildargs="$_buildargs -U *OPENSUBDIV* -U *OPENVDB* -U *COLLADA* -U *FFMPEG* -U *ALEMBIC*" + if [ "$USE_CXX11" = true ]; then + _1="-D WITH_CXX11=ON" + PRINT " $_1" + _buildargs="$_buildargs $_1" + fi + _1="-D WITH_CODEC_SNDFILE=ON" PRINT " $_1" _buildargs="$_buildargs $_1" @@ -4327,3 +4358,6 @@ PRINT "" # Switch back to user language. LANG=LANG_BACK export LANG + +CXXFLAGS=$CXXFLAGS_BACK +export CXXFLAGS -- cgit v1.2.3