Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 14 Dec 2018 13:50:47 +0000 (14:50 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 14 Dec 2018 13:50:47 +0000 (14:50 +0100)
1  2 
CMakeLists.txt

diff --combined CMakeLists.txt
index c40eb5bb2a0ec51a09057efa2081549e00413298,02a35c1cd4c935b3f1fb191985f6b75e37ed5dbc..3218bf9ba4bbb5532a4eab97ee90b7b8b5014d3e
@@@ -47,6 -47,13 +47,13 @@@ endif(
  
  cmake_minimum_required(VERSION 3.5)
  
+ # Prever LEGACY OpenGL to eb compatible with all the existing releases and
+ # platforms which don't hare GLVND yet. Only do it if preference was not set
+ # externally.
+ if(NOT DEFINED OpenGL_GL_PREFERENCE)
+       set(OpenGL_GL_PREFERENCE "LEGACY")
+ endif()
  if(NOT EXECUTABLE_OUTPUT_PATH)
        set(FIRST_RUN TRUE)
  else()
@@@ -164,6 -171,7 +171,6 @@@ option_defaults_init
        _init_OPENCOLORIO
        _init_SDL
        _init_FFTW3
 -      _init_GAMEENGINE
        _init_OPENSUBDIV
  )
  
@@@ -184,6 -192,7 +191,6 @@@ elseif(WIN32
        set(_init_JACK                           OFF)
  elseif(APPLE)
        set(_init_JACK                           OFF)
 -      set(_init_OPENSUBDIV                     OFF)
  endif()
  
  
@@@ -231,6 -240,13 +238,6 @@@ option(WITH_FFTW3         "Enable FFTW
  option(WITH_BULLET        "Enable Bullet (Physics Engine)" ON)
  option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" )
  mark_as_advanced(WITH_SYSTEM_BULLET)
 -option(WITH_GAMEENGINE    "Enable Game Engine" ${_init_GAMEENGINE})
 -if(APPLE)
 -      set(WITH_GAMEENGINE_DECKLINK OFF)
 -else()
 -      option(WITH_GAMEENGINE_DECKLINK "Support BlackMagicDesign DeckLink cards in the Game Engine" ON)
 -endif()
 -option(WITH_PLAYER        "Build Player" OFF)
  option(WITH_OPENCOLORIO   "Enable OpenColorIO color management" ${_init_OPENCOLORIO})
  
  # Compositor
@@@ -311,6 -327,7 +318,6 @@@ option(WITH_IMAGE_TIFF          "Enabl
  option(WITH_IMAGE_DDS           "Enable DDS Image Support" ON)
  option(WITH_IMAGE_CINEON        "Enable CINEON and DPX Image Support" ON)
  option(WITH_IMAGE_HDR           "Enable HDR Image Support" ON)
 -option(WITH_IMAGE_FRAMESERVER   "Enable image FrameServer Support for rendering" ON)
  
  # Audio/Video format support
  option(WITH_CODEC_AVI           "Enable Blenders own AVI file support (raw/jpeg)" ON)
@@@ -373,16 -390,10 +380,16 @@@ if(UNIX AND NOT APPLE
  endif()
  
  option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
 -if(WITH_PYTHON_INSTALL)
 -      option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder"  ON)
 +if(WIN32 OR APPLE)
 +      # Windows and macOS have this bundled with Python libraries.
 +elseif(WITH_PYTHON_INSTALL OR (WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE))
        set(PYTHON_NUMPY_PATH            "" CACHE PATH "Path to python site-packages or dist-packages containing 'numpy' module")
        mark_as_advanced(PYTHON_NUMPY_PATH)
 +      set(PYTHON_NUMPY_INCLUDE_DIRS ${PYTHON_NUMPY_PATH}/numpy/core/include CACHE PATH "Path to the include directory of the numpy module")
 +      mark_as_advanced(PYTHON_NUMPY_INCLUDE_DIRS)
 +endif()
 +if(WITH_PYTHON_INSTALL)
 +      option(WITH_PYTHON_INSTALL_NUMPY "Copy system numpy into the blender install folder"  ON)
  
        if(UNIX AND NOT APPLE)
                option(WITH_PYTHON_INSTALL_REQUESTS "Copy system requests into the blender install folder" ON)
@@@ -465,18 -476,28 +472,18 @@@ endif(
  
  # OpenGL
  
 -option(WITH_GLEW_MX             "Support multiple GLEW contexts (experimental)"                                                                     OFF )
 +option(WITH_OPENGL              "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON)
  option(WITH_GLEW_ES             "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF)
  option(WITH_GL_EGL              "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)"       OFF)
 -option(WITH_GL_PROFILE_COMPAT   "Support using the OpenGL 'compatibility' profile. (deprecated)"                                                    ON )
 -option(WITH_GL_PROFILE_CORE     "Support using the OpenGL 3.2+ 'core' profile."                                                                     OFF)
  option(WITH_GL_PROFILE_ES20     "Support using OpenGL ES 2.0. (thru either EGL or the AGL/WGL/XGL 'es20' profile)"                                  OFF)
  
  mark_as_advanced(
 -      WITH_GLEW_MX
 +      WITH_OPENGL
        WITH_GLEW_ES
        WITH_GL_EGL
 -      WITH_GL_PROFILE_COMPAT
 -      WITH_GL_PROFILE_CORE
        WITH_GL_PROFILE_ES20
  )
  
 -if(WITH_GL_PROFILE_COMPAT)
 -      set(WITH_GLU ON)
 -else()
 -      set(WITH_GLU OFF)
 -endif()
 -
  if(WIN32)
        option(WITH_GL_ANGLE "Link with the ANGLE library, an OpenGL ES 2.0 implementation based on Direct3D, instead of the system OpenGL library." OFF)
        mark_as_advanced(WITH_GL_ANGLE)
@@@ -599,13 -620,17 +606,13 @@@ endif(
  #-----------------------------------------------------------------------------
  # Check for conflicting/unsupported configurations
  
 -if(NOT WITH_BLENDER AND NOT WITH_PLAYER AND NOT WITH_CYCLES_STANDALONE)
 +if(NOT WITH_BLENDER AND NOT WITH_CYCLES_STANDALONE)
        message(FATAL_ERROR
 -              "At least one of WITH_BLENDER or WITH_PLAYER or "
 -              "WITH_CYCLES_STANDALONE must be enabled, nothing to do!"
 +              "At least one of WITH_BLENDER or WITH_CYCLES_STANDALONE "
 +              "must be enabled, nothing to do!"
        )
  endif()
  
 -if(NOT WITH_GAMEENGINE AND WITH_PLAYER)
 -      message(FATAL_ERROR "WITH_PLAYER requires WITH_GAMEENGINE")
 -endif()
 -
  if(NOT WITH_AUDASPACE)
        if(WITH_OPENAL)
                message(WARNING "WITH_OPENAL requires WITH_AUDASPACE which is disabled")
                message(WARNING "WITH_JACK requires WITH_AUDASPACE which is disabled")
                set(WITH_JACK OFF)
        endif()
 -      if(WITH_GAMEENGINE)
 -              message(FATAL_ERROR "WITH_GAMEENGINE requires WITH_AUDASPACE")
 -      endif()
  endif()
  
  if(NOT WITH_SDL AND WITH_GHOST_SDL)
  endif()
  
  # python module, needs some different options
 -if(WITH_PYTHON_MODULE AND WITH_PLAYER)
 -      message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PLAYER to be OFF")
 -endif()
 -
  if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
        message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF")
  endif()
@@@ -649,10 -681,15 +656,10 @@@ if(NOT WITH_BOOST
        endmacro()
  
        set_and_warn(WITH_CYCLES         OFF)
 -      set_and_warn(WITH_AUDASPACE      OFF)
        set_and_warn(WITH_INTERNATIONAL  OFF)
        set_and_warn(WITH_OPENVDB        OFF)
        set_and_warn(WITH_OPENCOLORIO    OFF)
 -
 -      set_and_warn(WITH_OPENAL         OFF)  # depends on AUDASPACE
 -      set_and_warn(WITH_GAMEENGINE     OFF)  # depends on AUDASPACE
 -      set_and_warn(WITH_PLAYER         OFF)  # depends on GAMEENGINE
 -elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_AUDASPACE OR WITH_INTERNATIONAL OR
 +elseif(WITH_CYCLES OR WITH_OPENIMAGEIO OR WITH_INTERNATIONAL OR
         WITH_OPENVDB OR WITH_OPENCOLORIO)
        # Keep enabled
  else()
@@@ -715,9 -752,30 +722,9 @@@ if(WITH_BUILDINFO
  endif()
  
  if(WITH_AUDASPACE)
 -      if(WITH_SYSTEM_AUDASPACE)
 -              set(AUDASPACE_DEFINITIONS
 -                      -DWITH_AUDASPACE
 -                      -DWITH_SYSTEM_AUDASPACE
 -                      "-DAUD_DEVICE_H=<AUD_Device.h>"
 -                      "-DAUD_SPECIAL_H=<AUD_Special.h>"
 -                      "-DAUD_SOUND_H=<AUD_Sound.h>"
 -                      "-DAUD_HANDLE_H=<AUD_Handle.h>"
 -                      "-DAUD_SEQUENCE_H=<AUD_Sequence.h>"
 -                      "-DAUD_TYPES_H=<AUD_Types.h>"
 -                      "-DAUD_PYTHON_H=<python/PyAPI.h>"
 -              )
 -      else()
 -              set(AUDASPACE_C_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/intern/audaspace/intern")
 -              set(AUDASPACE_PY_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/intern/audaspace/intern")
 -              set(AUDASPACE_DEFINITIONS
 -                      -DWITH_AUDASPACE
 -                      "-DAUD_DEVICE_H=<AUD_C-API.h>"
 -                      "-DAUD_SPECIAL_H=<AUD_C-API.h>"
 -                      "-DAUD_SOUND_H=<AUD_C-API.h>"
 -                      "-DAUD_HANDLE_H=<AUD_C-API.h>"
 -                      "-DAUD_SEQUENCE_H=<AUD_C-API.h>"
 -                      "-DAUD_TYPES_H=<AUD_Space.h>"
 -              )
 +      if(NOT WITH_SYSTEM_AUDASPACE)
 +              set(AUDASPACE_C_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/audaspace/bindings/C" "${CMAKE_BINARY_DIR}/extern/audaspace")
 +              set(AUDASPACE_PY_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/extern/audaspace/bindings")
        endif()
  endif()
  
@@@ -981,15 -1039,19 +988,15 @@@ endif(
  find_package(OpenGL)
  blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
  
 -if(WITH_GLU)
 -      list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_glu_LIBRARY}")
 -      list(APPEND GL_DEFINITIONS -DWITH_GLU)
 +if(WITH_OPENGL)
 +      add_definitions(-DWITH_OPENGL)
  endif()
  
  if(WITH_SYSTEM_GLES)
        find_package_wrapper(OpenGLES)
  endif()
  
 -if(WITH_GL_PROFILE_COMPAT OR WITH_GL_PROFILE_CORE)
 -      list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_LIBRARIES}")
 -
 -elseif(WITH_GL_PROFILE_ES20)
 +if(WITH_GL_PROFILE_ES20)
        if(WITH_SYSTEM_GLES)
                if(NOT OPENGLES_LIBRARY)
                        message(FATAL_ERROR
  
        endif()
  
-       list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_gl_LIBRARY}")
 +else()
++      list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_LIBRARIES}")
 +
  endif()
  
  if(WITH_GL_EGL)
  
  endif()
  
 -if(WITH_GL_PROFILE_COMPAT)
 -      list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_COMPAT)
 -endif()
 -
 -if(WITH_GL_PROFILE_CORE)
 -      list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_CORE)
 -endif()
 -
  if(WITH_GL_PROFILE_ES20)
        list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_ES20)
 +else()
 +      list(APPEND GL_DEFINITIONS -DWITH_GL_PROFILE_CORE)
  endif()
  
  if(WITH_GL_EGL)
@@@ -1139,6 -1204,10 +1146,6 @@@ endif(
  #-----------------------------------------------------------------------------
  # Configure GLEW
  
 -if(WITH_GLEW_MX)
 -      list(APPEND GL_DEFINITIONS -DWITH_GLEW_MX)
 -endif()
 -
  if(WITH_SYSTEM_GLEW)
        find_package(GLEW)
  
                message(FATAL_ERROR "GLEW is required to build Blender. Install it or disable WITH_SYSTEM_GLEW.")
        endif()
  
 -      if(WITH_GLEW_MX)
 -              set(BLENDER_GLEW_LIBRARIES ${GLEW_MX_LIBRARY})
 -      else()
 -              set(BLENDER_GLEW_LIBRARIES ${GLEW_LIBRARY})
 -      endif()
 +      set(BLENDER_GLEW_LIBRARIES ${GLEW_LIBRARY})
  else()
        if(WITH_GLEW_ES)
                set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew-es/include")
                list(APPEND GL_DEFINITIONS -DGLEW_STATIC -DWITH_GLEW_ES)
  
                # These definitions remove APIs from glew.h, making GLEW smaller, and catching unguarded API usage
 -              if(NOT WITH_GL_PROFILE_ES20)
 +              if(WITH_GL_PROFILE_ES20)
 +                      list(APPEND GL_DEFINITIONS -DGLEW_ES_ONLY)
 +              else()
                        # No ES functions are needed
                        list(APPEND GL_DEFINITIONS -DGLEW_NO_ES)
 -              elseif(NOT (WITH_GL_PROFILE_CORE OR WITH_GL_PROFILE_COMPAT))
 -                      # ES is enabled, but the other functions are all disabled
 -                      list(APPEND GL_DEFINITIONS -DGLEW_ES_ONLY)
                endif()
  
                if(WITH_GL_PROFILE_ES20)
  
  endif()
  
 -if(NOT WITH_GLU)
 -      list(APPEND GL_DEFINITIONS -DGLEW_NO_GLU)
 -endif()
 +list(APPEND GL_DEFINITIONS -DGLEW_NO_GLU)
  
  #-----------------------------------------------------------------------------
  # Configure Bullet
@@@ -1438,7 -1514,6 +1445,7 @@@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSV
                # warning level:
                "/W3"
                "/w34062"  # switch statement contains 'default' but no 'case' labels
 +              "/w34189"  # local variable is initialized but not referenced
                # disable:
                "/wd4018"  # signed/unsigned mismatch
                "/wd4146"  # unary minus operator applied to unsigned type, result still unsigned
@@@ -1483,14 -1558,9 +1490,14 @@@ if(WITH_PYTHON
        endif()
  
        if(WIN32 OR APPLE)
 -              # pass, we have this in an archive to extract
 -      elseif(WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY)
 -              find_python_package(numpy)
 +              # Windows and macOS have this bundled with Python libraries.
 +      elseif((WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) OR (WITH_AUDASPACE AND NOT WITH_SYSTEM_AUDASPACE))
 +              if(("${PYTHON_NUMPY_PATH}" STREQUAL "") OR (${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
 +                      find_python_package(numpy)
 +                      unset(PYTHON_NUMPY_INCLUDE_DIRS CACHE)
 +                      set(PYTHON_NUMPY_INCLUDE_DIRS ${PYTHON_NUMPY_PATH}/numpy/core/include CACHE PATH "Path to the include directory of the numpy module")
 +                      mark_as_advanced(PYTHON_NUMPY_INCLUDE_DIRS)
 +              endif()
        endif()
  
        if(WIN32 OR APPLE)
        (CMAKE_C_COMPILER_ID MATCHES "Clang" AND (NOT MSVC)) OR
        (CMAKE_C_COMPILER_ID MATCHES "Intel")
  )
 -      # Use C99 + GNU extensions, works with GCC, Clang, ICC
 -      if(WITH_C11)
 -              set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
 -      else()
 -              set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
 -      endif()
 +      # Use C11 + GNU extensions, works with GCC, Clang, ICC
 +      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
  endif()
  
  # Include warnings first, so its possible to disable them with user defined flags
@@@ -1569,7 -1643,7 +1576,7 @@@ if(WITH_GTESTS
        include(GTestTesting)
  endif()
  
 -if(WITH_BLENDER OR WITH_PLAYER)
 +if(WITH_BLENDER)
        add_subdirectory(intern)
        add_subdirectory(extern)
  
@@@ -1594,6 -1668,13 +1601,6 @@@ if(WITH_BLENDER
  endif()
  
  
 -#-----------------------------------------------------------------------------
 -# Blender Player
 -if(WITH_PLAYER)
 -      add_subdirectory(source/blenderplayer)
 -endif()
 -
 -
  #-----------------------------------------------------------------------------
  # Testing
  add_subdirectory(tests)
@@@ -1608,6 -1689,9 +1615,6 @@@ include(build_files/cmake/packaging.cma
  if(WITH_BLENDER)
        openmp_delayload(blender)
  endif()
 -if(WITH_PLAYER)
 -      openmp_delayload(blenderplayer)
 -endif()
  
  #-----------------------------------------------------------------------------
  # Print Final Configuration
@@@ -1641,6 -1725,8 +1648,6 @@@ if(FIRST_RUN
        message(STATUS "C++ Compiler: \"${CMAKE_CXX_COMPILER_ID}\"")
  
        info_cfg_text("Build Options:")
 -      info_cfg_option(WITH_GAMEENGINE)
 -      info_cfg_option(WITH_PLAYER)
        info_cfg_option(WITH_BULLET)
        info_cfg_option(WITH_IK_SOLVER)
        info_cfg_option(WITH_IK_ITASC)
  
        info_cfg_text("OpenGL:")
        info_cfg_option(WITH_GLEW_ES)
 -      info_cfg_option(WITH_GLU)
        info_cfg_option(WITH_GL_EGL)
 -      info_cfg_option(WITH_GL_PROFILE_COMPAT)
 -      info_cfg_option(WITH_GL_PROFILE_CORE)
        info_cfg_option(WITH_GL_PROFILE_ES20)
        if(WIN32)
                info_cfg_option(WITH_GL_ANGLE)