[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41758] trunk/blender: CMake/Scons: automatically use ffmpeg, boost and openimageio from the svn lib/

Brecht Van Lommel brechtvanlommel at pandora.be
Fri Nov 11 15:52:25 CET 2011


Revision: 41758
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41758
Author:   blendix
Date:     2011-11-11 14:52:24 +0000 (Fri, 11 Nov 2011)
Log Message:
-----------
CMake/Scons: automatically use ffmpeg, boost and openimageio from the svn lib/
directory if available, which should make building with ffmpeg and cycles easier.

If this folder is not available or another path is specified in user-config.py
or CMakeCache.txt, this should have no effect. Wiki build instructions now show
how to use these.
http://wiki.blender.org/index.php/Dev:2.5/Doc/Building_Blender/Linux

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/build_files/scons/config/linux-config.py

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2011-11-11 13:09:14 UTC (rev 41757)
+++ trunk/blender/CMakeLists.txt	2011-11-11 14:52:24 UTC (rev 41758)
@@ -361,6 +361,19 @@
 		set(CMAKE_LIBRARY_PATH "/usr/lib/x86_64-linux-gnu;${CMAKE_LIBRARY_PATH}")
 	endif()
 
+	# set lib directory if it exists
+	if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+		if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
+			set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/linux64)
+		else()
+			set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/linux)
+		endif()
+
+		if(NOT EXISTS ${LIBDIR})
+			unset(LIBDIR)
+		endif()
+	endif()
+
 	find_package(JPEG REQUIRED)
 	find_package(PNG REQUIRED)
 	find_package(ZLIB REQUIRED)
@@ -435,10 +448,17 @@
 	endif()
 
 	if(WITH_CODEC_FFMPEG)
-		set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
+		# use lib dir if available and nothing else specified
+		if(LIBDIR AND NOT FFMPEG)
+			set(FFMPEG ${LIBDIR}/ffmpeg CACHE PATH "FFMPEG Directory")
+			set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale dirac_encoder mp3lame ogg orc-0.4 schroedinger-1.0 theora theoraenc theoradec vorbis vorbisenc vpx x264 xvidcore faad asound CACHE STRING "FFMPEG Libraries")
+		else()
+			set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
+			set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
+		endif()
+
 		mark_as_advanced(FFMPEG)
 		set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
-		set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
 		mark_as_advanced(FFMPEG_LIBRARIES)
 		set(FFMPEG_LIBPATH ${FFMPEG}/lib)
 		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
@@ -504,6 +524,10 @@
 	endif()
 
 	if(WITH_BOOST)
+		# use lib dir if available and nothing else specified
+		if(LIBDIR AND NOT BOOST_ROOT)
+			set(BOOST_ROOT ${LIBDIR}/boost)
+		endif()
 		
 		# uses in build instructions to override include and library variables
 		if(NOT BOOST_CUSTOM)
@@ -519,6 +543,11 @@
 	endif()
 
 	if(WITH_OPENIMAGEIO)
+		# use lib dir if available and nothing else specified
+		if(LIBDIR AND NOT OPENIMAGEIO_ROOT_DIR)
+			set(OPENIMAGEIO_ROOT_DIR ${LIBDIR}/openimageio)
+		endif()
+
 		find_package(OpenImageIO)
 
 		set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})

Modified: trunk/blender/build_files/scons/config/linux-config.py
===================================================================
--- trunk/blender/build_files/scons/config/linux-config.py	2011-11-11 13:09:14 UTC (rev 41757)
+++ trunk/blender/build_files/scons/config/linux-config.py	2011-11-11 14:52:24 UTC (rev 41758)
@@ -1,5 +1,12 @@
-LCGDIR = '../lib/linux'
-LIBDIR = "${LCGDIR}"
+# find library directory
+import platform
+import os
+bitness = platform.architecture()[0]
+if bitness == '64bit':
+    LCGDIR = '../lib/linux64'
+else:
+    LCGDIR = '../lib/linux'
+LIBDIR = "#${LCGDIR}"
 
 BF_PYTHON_ABI_FLAGS = 'm'  # Most common for linux distros
 BF_PYTHON = '/usr'
@@ -113,7 +120,18 @@
 
 # enable ffmpeg  support
 WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
-BF_FFMPEG = '/usr'
+BF_FFMPEG = LIBDIR + '/ffmpeg'
+if os.path.exists(LCGDIR + '/ffmpeg'):
+    WITH_BF_STATICFFMPEG = True
+    BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
+        '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+        '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
+        '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
+        '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
+        '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ' + \
+        '${BF_FFMPEG_LIBPATH}/libfaad.a'
+else:
+    BF_FFMPEG = '/usr'
 BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include'
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
@@ -178,20 +196,26 @@
 BF_JEMALLOC_LIB = 'jemalloc'
 BF_JEMALLOC_LIB_STATIC = '${BF_JEMALLOC_LIBPATH}/libjemalloc.a'
 
-WITH_BF_CYCLES = False
-
-WITH_BF_OIIO = True
+WITH_BF_OIIO = True 
 BF_OIIO = LIBDIR + '/openimageio'
+if not os.path.exists(LCGDIR + '/openimageio'):
+    WITH_BF_OIIO = False
+    BF_OIIO = '/usr'
 BF_OIIO_INC = BF_OIIO + '/include'
 BF_OIIO_LIB = 'OpenImageIO'
 BF_OIIO_LIBPATH = BF_OIIO + '/lib'
 
 WITH_BF_BOOST = True
 BF_BOOST = LIBDIR + '/boost'
+if not os.path.exists(LCGDIR + '/boost'):
+    WITH_BF_BOOST = False
+    BF_BOOST = '/usr'
 BF_BOOST_INC = BF_BOOST + '/include'
 BF_BOOST_LIB = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt'
 BF_BOOST_LIBPATH = BF_BOOST + '/lib'
 
+WITH_BF_CYCLES = WITH_BF_OIIO and WITH_BF_BOOST
+
 WITH_BF_OPENMP = True
 
 #Ray trace optimization




More information about the Bf-blender-cvs mailing list