[Bf-blender-cvs] [956bd92] master: Buildbot: Initial work to move linux build environment to CMake

Sergey Sharybin noreply at git.blender.org
Wed Dec 2 14:13:05 CET 2015


Commit: 956bd92a6036ce3e47047dfdbee68f447c23b61d
Author: Sergey Sharybin
Date:   Wed Dec 2 18:09:06 2015 +0500
Branches: master
https://developer.blender.org/rB956bd92a6036ce3e47047dfdbee68f447c23b61d

Buildbot: Initial work to move linux build environment to CMake

This is so called "seems to work in dry tests" commit which is aimed to switch
linux release environment to CMake.

Some notes:

- There's no special handle of libstdc++, but it wasn't really static for quite
  some time in SCons configuration and nobody really complained.

- It was quite tricky to get OpenMP linked statically with just using some
  configuration so we went ahead and added a special option to CMake now which is
  only exist on Linux and advertised as shouldn't be used.

- Packing is happening manually in slave_pack.py. This is because we have to add
  some really special files to the archive (mesa libraries for example) which we
  can't really handle from CMake/CPack in a nice generic way.

  Don't think it's bad approach, at least crappynness is localized and it's not
  _that_ crappy anyway.

- Windows buildbot should keep working, but needs doublechecing. It's just a
  build folder changed, but you never know what it might imply.

- Some further tweaks are likely needed to ensure all builders are working.

Thanks Campbell for assistance in this patch!

===================================================================

M	CMakeLists.txt
A	build_files/buildbot/config/blender_linux.cmake
A	build_files/buildbot/config/blender_player_linux.cmake
M	build_files/buildbot/slave_compile.py
M	build_files/buildbot/slave_pack.py
M	build_files/buildbot/slave_test.py
M	build_files/cmake/macros.cmake
M	source/blenderplayer/CMakeLists.txt

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10c2f65..039a745 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -267,6 +267,10 @@ if(NOT WITH_AUDASPACE)
 endif()
 
 option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ON)
+if(UNIX AND NOT APPLE)
+	option(WITH_OPENMP_STATIC "Link OpenMP statically (only used by the release environment)" OFF)
+	mark_as_advanced(WITH_OPENMP_STATIC)
+endif()
 
 if(WITH_X11)
 	option(WITH_X11_XINPUT    "Enable X11 Xinput (tablet support and unicode input)"  ON)
@@ -865,13 +869,9 @@ endif()
 if(UNIX AND NOT APPLE)
 	macro(find_package_wrapper)
 		if(WITH_STATIC_LIBS)
-			set(_cmake_find_library_suffixes_back ${CMAKE_FIND_LIBRARY_SUFFIXES})
-			set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
-		endif()
-		find_package(${ARGV})
-		if(WITH_STATIC_LIBS)
-			set(CMAKE_FIND_LIBRARY_SUFFIXES ${_cmake_find_library_suffixes_back})
-			unset(_cmake_find_library_suffixes_back)
+			find_package_static(${ARGV})
+		else()
+			find_package(${ARGV})
 		endif()
 	endmacro()
 
@@ -2458,8 +2458,18 @@ endif()
 if(WITH_OPENMP)
 	find_package(OpenMP)
 	if(OPENMP_FOUND)
-		set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
-		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+		if(NOT WITH_OPENMP_STATIC)
+			set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
+			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+		else()
+			# Typically avoid adding flags as defines but we can't
+			# ass OpenMP flags to the linker for static builds, meaning
+			# we can't add any OpenMP related flags to CFLAGS variables
+			# since they're passed to the linker as well.
+			add_definitions("${OpenMP_C_FLAGS}")
+
+			find_library_static(OpenMP_LIBRARIES gomp)
+		endif()
 	else()
 		set(WITH_OPENMP OFF)
 	endif()
diff --git a/build_files/buildbot/config/blender_linux.cmake b/build_files/buildbot/config/blender_linux.cmake
new file mode 100644
index 0000000..e888966
--- /dev/null
+++ b/build_files/buildbot/config/blender_linux.cmake
@@ -0,0 +1,94 @@
+# ######## Global feature set settings ########
+
+include("${CMAKE_CURRENT_LIST_DIR}/../../cmake/config/blender_full.cmake")
+
+# ######## Linux-specific build options ########
+# Options which are specific to Linux-only platforms
+set(WITH_DOC_MANPAGE         OFF CACHE BOOL "" FORCE)
+
+# ######## Official release-specific build options ########
+# Options which are specific to Linux release builds only
+set(WITH_JACK_DYNLOAD        ON  CACHE BOOL "" FORCE)
+set(WITH_SDL_DYNLOAD         ON  CACHE BOOL "" FORCE)
+set(WITH_SYSTEM_GLEW         OFF CACHE BOOL "" FORCE)
+
+set(WITH_OPENMP_STATIC       ON  CACHE BOOL "" FORCE)
+
+set(WITH_PYTHON_INSTALL_NUMPY    ON CACHE BOOL "" FORCE)
+set(WITH_PYTHON_INSTALL_REQUESTS ON CACHE BOOL "" FORCE)
+
+# ######## Release environment specific settings ########
+# All the hardcoded libraru paths and such
+
+# LLVM libraries
+set(LLVM_VERSION             "3.4"  CACHE STRING "" FORCE)
+set(LLVM_ROOT_DIR            "/opt/lib/llvm-${LLVM_VERSION}"  CACHE STRING "" FORCE)
+set(LLVM_STATIC              ON  CACHE BOOL "" FORCE)
+
+# BOOST libraries
+set(BOOST_ROOT               "/opt/lib/boost" CACHE STRING "" FORCE)
+set(Boost_USE_STATIC_LIBS    ON CACHE BOOL "" FORCE)
+
+# FFmpeg libraries
+set(FFMPEG                   "/opt/lib/ffmpeg" CACHE STRING "" FORCE)
+set(FFMPEG_LIBRARIES
+    avdevice avformat avcodec avutil avfilter swscale swresample
+    /usr/lib/libxvidcore.a
+    /usr/lib/libx264.a
+    /usr/lib/libmp3lame.a
+    /usr/lib/libvpx.a
+    /usr/lib/libvorbis.a
+    /usr/lib/libogg.a
+    /usr/lib/libvorbisenc.a
+    /usr/lib/libtheora.a
+    /usr/lib/libschroedinger-1.0.a
+    /usr/lib/liborc-0.4.a
+    CACHE STRING "" FORCE
+)
+
+# SndFile libraries
+set(SNDFILE_LIBRARY          "/usr/lib/libsndfile.a;/usr/lib/libFLAC.a" CACHE STRING "" FORCE)
+
+# OpenAL libraries
+set(OPENAL_ROOT_DIR           "/opt/lib/openal" CACHE STRING "" FORCE)
+set(OPENAL_INCLUDE_DIR        "${OPENAL_ROOT_DIR}/include" CACHE STRING "" FORCE)
+set(OPENAL_LIBRARY
+    ${OPENAL_ROOT_DIR}/lib/libopenal.a
+    ${OPENAL_ROOT_DIR}/lib/libcommon.a
+    CACHE STRING "" FORCE
+)
+
+# OpenCollada libraries
+set(OPENCOLLADA_UTF_LIBRARY   "" CACHE STRING "" FORCE)
+
+# OpenColorIO libraries
+set(OPENCOLORIO_ROOT_DIR      "/opt/lib/ocio" CACHE STRING "" FORCE)
+set(OPENCOLORIO_OPENCOLORIO_LIBRARY "${OPENCOLORIO_ROOT_DIR}/lib/libOpenColorIO.a" CACHE STRING "" FORCE)
+set(OPENCOLORIO_TINYXML_LIBRARY "${OPENCOLORIO_ROOT_DIR}/lib/libtinyxml.a"         CACHE STRING "" FORCE)
+set(OPENCOLORIO_YAML-CPP_LIBRARY "${OPENCOLORIO_ROOT_DIR}/lib/libyaml-cpp.a"       CACHE STRING "" FORCE)
+
+# OpenSubdiv libraries
+set(OPENSUBDIV_ROOT_DIR "/opt/lib/opensubdiv" CACHE STRING "" FORCE)
+set(OPENSUBDIV_OSDCPU_LIBRARY "${OPENSUBDIV_ROOT_DIR}/lib/libosdCPU.a" CACHE STRING "" FORCE)
+set(OPENSUBDIV_OSDGPU_LIBRARY "${OPENSUBDIV_ROOT_DIR}/lib/libosdGPU.a" CACHE STRING "" FORCE)
+
+# OpenEXR libraries
+set(OPENEXR_ROOT_DIR          "/opt/lib/openexr"                    CACHE STRING "" FORCE)
+set(OPENEXR_HALF_LIBRARY      "/opt/lib/openexr/lib/libHalf.a"      CACHE STRING "" FORCE)
+set(OPENEXR_IEX_LIBRARY       "/opt/lib/openexr/lib/libIex.a"       CACHE STRING "" FORCE)
+set(OPENEXR_ILMIMF_LIBRARY    "/opt/lib/openexr/lib/libIlmImf.a"    CACHE STRING "" FORCE)
+set(OPENEXR_ILMTHREAD_LIBRARY "/opt/lib/openexr/lib/libIlmThread.a" CACHE STRING "" FORCE)
+set(OPENEXR_IMATH_LIBRARY     "/opt/lib/openexr/lib/libImath.a"     CACHE STRING "" FORCE)
+
+# JeMalloc library
+set(JEMALLOC_LIBRARY    "/opt/lib/jemalloc/lib/libjemalloc.a" CACHE STRING "" FORCE)
+
+# Foce some system libraries to be static
+set(FFTW3_LIBRARY       "/usr/lib/libfftw3.a" CACHE STRING "" FORCE)
+set(JPEG_LIBRARY        "/usr/lib/libjpeg.a"  CACHE STRING "" FORCE)
+set(PNG_LIBRARY         "/usr/lib/libpng.a"   CACHE STRING "" FORCE)
+set(TIFF_LIBRARY        "/usr/lib/libtiff.a"  CACHE STRING "" FORCE)
+set(ZLIB_LIBRARY        "/usr/lib/libz.a"     CACHE STRING "" FORCE)
+
+# Additional linking libraries
+set(CMAKE_EXE_LINKER_FLAGS   "-lrt"  CACHE STRING "" FORCE)
diff --git a/build_files/buildbot/config/blender_player_linux.cmake b/build_files/buildbot/config/blender_player_linux.cmake
new file mode 100644
index 0000000..2fb3119
--- /dev/null
+++ b/build_files/buildbot/config/blender_player_linux.cmake
@@ -0,0 +1,12 @@
+# This is applied as an ovveride on top of blender_linux.config
+# Disables all the areas which are not needed for the player.
+set(WITH_COMPOSITOR          OFF CACHE BOOL "" FORCE)
+set(WITH_CYCLES              OFF CACHE BOOL "" FORCE)
+set(WITH_FREESTYLE           OFF CACHE BOOL "" FORCE)
+set(WITH_GHOST_XDND          OFF CACHE BOOL "" FORCE)
+set(WITH_OPENCOLLADA         OFF CACHE BOOL "" FORCE)
+set(WITH_OPENSUBDIV          OFF CACHE BOOL "" FORCE)
+set(WITH_LIBMV               OFF CACHE BOOL "" FORCE)
+
+set(WITH_BLENDER             OFF CACHE BOOL "" FORCE)
+set(WITH_PLAYER              ON  CACHE BOOL "" FORCE)
diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py
index ee89bc9..d055822 100644
--- a/build_files/buildbot/slave_compile.py
+++ b/build_files/buildbot/slave_compile.py
@@ -31,43 +31,121 @@ if len(sys.argv) < 2:
 builder = sys.argv[1]
 
 # we run from build/ directory
-blender_dir = '../blender.git'
+blender_dir = os.path.join('..', 'blender.git')
 
 if 'cmake' in builder:
     # cmake
 
-    # set build options
+    # Some fine-tuning configuration
+    blender_dir = os.path.join('..', blender_dir)
+    build_dir = os.path.abspath(os.path.join('..', 'build', builder))
+    install_dir = os.path.abspath(os.path.join('..', 'install', builder))
+    targets = ['blender']
+
+    chroot_name = None  # If not None command will be delegated to that chroot
+    build_cubins = True  # Whether to build Cycles CUDA kernels
+    remove_cache = False  # Remove CMake cache to be sure config is totally up-to-date
+    remove_install_dir = False  # Remove installation folder before building
+
+    # Config file to be used (relative to blender's sources root)
+    cmake_config_file = "build_files/cmake/config/blender_full.cmake"
+    cmake_player_config_file = None
+    cmake_cuda_config_file = None
+
+    # Set build options.
     cmake_options = ['-DCMAKE_BUILD_TYPE:STRING=Release']
 
-    if builder.endswith('mac_x86_64_cmake'):
-        cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64')
-    elif builder.endswith('mac_i386_cmake'):
-        cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=i386')
-    elif builder.endswith('mac_ppc_cmake'):
-        cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=ppc')
-
-    if 'win64' in builder:
-        cmake_options.append(['-G', '"Visual Studio 12 2013 Win64"'])
-    elif 'win32' in builder:
-        cmake_options.append(['-G', '"Visual Studio 12 2013"'])
-
-    cmake_options.append("-C../blender.git/build_files/cmake/config/blender_full.cmake")
-    if 'win32' not in builder:
-        cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=1")
-    else:
-        cmake_options.append("-DWITH_CYCLES_CUDA_BINARIES=0")
-    # configure and make
-    retcode = subprocess.call(['cmake', blender_dir] + cmake_options)
-    if retcode != 0:
-        sys.exit(retcode)
+    if builder.startswith('mac'):
+        # Set up OSX architecture
+        if builder.endswith('x86_64_cmake'):
+            cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=x86_64')
+        elif builder.endswith('i386_cmake'):
+            cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=i386')
+        elif builder.endswith('ppc_cmake'):
+            cmake_options.append('-DCMAKE_OSX_ARCHITECTURES:STRING=ppc')
+
+    elif builder.startswith('win'):
+        if builder.startwith('win64'):
+            cmake_options.append(['-G', '"Visual Studio 12 2013 Win64"'])
+        elif builder.startswith('win32'):
+            cmake_options.append(['-G', '"Visual Studio 12 2013"'])
+            build_cubins = False
+
+    elif builder.startswith('linux'):
+        remove_cache = True
+        remove_install_dir = True
+        cmake_config_file = "build_files/buildbot/config/blender_linux.cmake"
+     

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list