Build Environment: fix alembic, openvdb, ffmpeg, osl build on Linux.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 27 Aug 2018 11:36:42 +0000 (13:36 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 27 Aug 2018 12:15:03 +0000 (14:15 +0200)
build_files/build_environment/cmake/alembic.cmake
build_files/build_environment/cmake/blosc.cmake
build_files/build_environment/cmake/ffmpeg.cmake
build_files/build_environment/cmake/osl.cmake
build_files/build_environment/patches/ffmpeg.diff [new file with mode: 0644]

index 4c0caecf335120ff9048419b3591b89ff2e1b1cf..615413554cf59c77569f761bbd3ac208998beed8 100644 (file)
@@ -38,13 +38,13 @@ set(ALEMBIC_EXTRA_ARGS
        -DBoost_DEBUG=ON
        -DBOOST_ROOT=${LIBDIR}/boost
        -DBoost_NO_SYSTEM_PATHS=ON
-       -DILMBASE_ROOT=${LIBDIR}/openexr
-       -DALEMBIC_ILMBASE_INCLUDE_DIRECTORY=${LIBDIR}/openexr/include/OpenEXR
-       -DALEMBIC_ILMBASE_HALF_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}Half${ILMBASE_VERSION_POSTFIX}${LIBEXT}
-       -DALEMBIC_ILMBASE_IMATH_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}Imath${ILMBASE_VERSION_POSTFIX}${LIBEXT}
-       -DALEMBIC_ILMBASE_ILMTHREAD_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmThread${ILMBASE_VERSION_POSTFIX}${LIBEXT}
-       -DALEMBIC_ILMBASE_IEX_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}Iex${ILMBASE_VERSION_POSTFIX}${LIBEXT}
-       -DALEMBIC_ILMBASE_IEXMATH_LIB=${LIBDIR}/openexr/lib/${LIBPREFIX}IexMath${ILMBASE_VERSION_POSTFIX}${LIBEXT}
+       -DILMBASE_ROOT=${LIBDIR}/ilmbase
+       -DALEMBIC_ILMBASE_INCLUDE_DIRECTORY=${LIBDIR}/ilmbase/include/OpenEXR
+       -DALEMBIC_ILMBASE_HALF_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Half${ILMBASE_VERSION_POSTFIX}${LIBEXT}
+       -DALEMBIC_ILMBASE_IMATH_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Imath${ILMBASE_VERSION_POSTFIX}${LIBEXT}
+       -DALEMBIC_ILMBASE_ILMTHREAD_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}IlmThread${ILMBASE_VERSION_POSTFIX}${LIBEXT}
+       -DALEMBIC_ILMBASE_IEX_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Iex${ILMBASE_VERSION_POSTFIX}${LIBEXT}
+       -DALEMBIC_ILMBASE_IEXMATH_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}IexMath${ILMBASE_VERSION_POSTFIX}${LIBEXT}
        -DUSE_PYILMBASE=0
        -DUSE_PYALEMBIC=0
        -DUSE_ARNOLD=0
index b0a0460aa94d9afee9a088857bf393502c497b93..18f258357c9569913c500460c91000be0ee3cb31 100644 (file)
@@ -26,6 +26,7 @@ set(BLOSC_EXTRA_ARGS
        -DPTHREAD_LIBS=${LIBDIR}/pthreads/lib/pthreadVC2.lib
        -DPTHREAD_INCLUDE_DIR=${LIBDIR}/pthreads/inc
        -DDEACTIVATE_SNAPPY=ON
+       -DCMAKE_POSITION_INDEPENDENT_CODE=ON
 )
 
 if(WIN32)
index b0c76175508089d48d9249f761ce917185803dee..5c8347cd40e11d02f0fb9930fce93f3dc8a9df4d 100644 (file)
 
 set(FFMPEG_CFLAGS "-I${mingw_LIBDIR}/lame/include -I${mingw_LIBDIR}/openjpeg/include/ -I${mingw_LIBDIR}/ogg/include -I${mingw_LIBDIR}/vorbis/include -I${mingw_LIBDIR}/theora/include -I${mingw_LIBDIR}/vpx/include -I${mingw_LIBDIR}/x264/include -I${mingw_LIBDIR}/xvidcore/include -I${mingw_LIBDIR}/zlib/include")
 set(FFMPEG_LDFLAGS "-L${mingw_LIBDIR}/lame/lib -L${mingw_LIBDIR}/openjpeg/lib -L${mingw_LIBDIR}/ogg/lib -L${mingw_LIBDIR}/vorbis/lib -L${mingw_LIBDIR}/theora/lib -L${mingw_LIBDIR}/vpx/lib -L${mingw_LIBDIR}/x264/lib -L${mingw_LIBDIR}/xvidcore/lib -L${mingw_LIBDIR}/zlib/lib")
-if(UNIX AND NOT APPLE)
-       # OpenJpeg is compiled with pthread support on Linux, which is all fine and is what we
-       # want for maximum runtime performance, but due to static nature of that library we
-       # need to force FFpeg to link against pthread, otherwise test program used by autoconf
-       # will fail.
-       set(FFMPEG_LDFLAGS "${FFMPEG_LDFLAGS} -lpthread")
-endif()
 set(FFMPEG_EXTRA_FLAGS --pkg-config-flags=--static --extra-cflags=${FFMPEG_CFLAGS} --extra-ldflags=${FFMPEG_LDFLAGS})
 set(FFMPEG_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/openjpeg/lib/pkgconfig:${mingw_LIBDIR}/x264/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR})
 
@@ -64,6 +57,11 @@ ExternalProject_Add(external_ffmpeg
        URL ${FFMPEG_URI}
        DOWNLOAD_DIR ${DOWNLOAD_DIR}
        URL_HASH MD5=${FFMPEG_HASH}
+       # OpenJpeg is compiled with pthread support on Linux, which is all fine and is what we
+       # want for maximum runtime performance, but due to static nature of that library we
+       # need to force ffmpeg to link against pthread, otherwise test program used by autoconf
+       # will fail. This patch does that in a way that is compatible with multiple distributions.
+       PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/ffmpeg/src/external_ffmpeg < ${PATCH_DIR}/ffmpeg.diff
        PREFIX ${BUILD_DIR}/ffmpeg
        CONFIGURE_COMMAND ${CONFIGURE_ENV_NO_PERL} &&
                cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ &&
index b44ed63c72ede40929b5377fcb0b93adc0eed79e..469f0eee69da8c205a4f0a56902b96dc39144133 100644 (file)
@@ -73,10 +73,16 @@ set(OSL_EXTRA_ARGS
        -DUSE_LLVM_BITCODE=OFF
        -DUSE_PARTIO=OFF
        ${OSL_SIMD_FLAGS}
-       -DPUGIXML_HOME=${LIBDIR}/pugixml
        -DPARTIO_LIBRARIES=
 )
 
+if(WIN32)
+set(OSL_EXTRA_ARGS
+       ${OSL_EXTRA_FLAGS}
+       -DPUGIXML_HOME=${LIBDIR}/pugixml
+)
+endif()
+
 ExternalProject_Add(external_osl
        URL ${OSL_URI}
        DOWNLOAD_DIR ${DOWNLOAD_DIR}
diff --git a/build_files/build_environment/patches/ffmpeg.diff b/build_files/build_environment/patches/ffmpeg.diff
new file mode 100644 (file)
index 0000000..960728a
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/configure        2018-08-27 13:46:41.071106150 +0200
++++ b/configure        2018-08-27 13:46:28.162765762 +0200
+@@ -6013,7 +6013,7 @@
+                                require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
+ enabled libopenh264       && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
+ enabled libopenjpeg       && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
+-                               { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
++                               { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version "-DOPJ_STATIC $pthreads_extralibs $libm_extralibs" && add_cppflags "-DOPJ_STATIC $pthreads_extralibs $libm_extralibs"; } }
+ enabled libopenmpt        && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
+ enabled libopus           && {
+     enabled libopus_decoder && {