Commit: 8d084e8c8f48dd2f07d4a3fbd4a941a7bcc0dcfb
Author: Jason Wilkins
Date:   Tue Oct 7 15:46:19 2014 -0500
Branches: master
https://developer.blender.org/rB8d084e8c8f48dd2f07d4a3fbd4a941a7bcc0dcfb

Ghost Context Refactor
https://developer.blender.org/D643
Separates graphics context creation from window code in Ghost so that they can 
vary separately.

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

M       CMakeLists.txt
M       SConstruct
A       build_files/cmake/Modules/FindOpenGLES.cmake
M       build_files/cmake/macros.cmake
M       build_files/scons/tools/btools.py
M       extern/CMakeLists.txt
M       extern/SConscript
A       extern/glew-es/CMakeLists.txt
A       extern/glew-es/SConscript
A       extern/glew-es/include/GL/eglew.h
A       extern/glew-es/include/GL/glesew.h
A       extern/glew-es/include/GL/glew.h
A       extern/glew-es/include/GL/glxew.h
A       extern/glew-es/include/GL/wglew.h
A       extern/glew-es/src/glew.c
M       extern/glew/CMakeLists.txt
M       extern/glew/SConscript
M       extern/glew/include/GL/glew.h
M       extern/glew/include/GL/glxew.h
M       extern/glew/include/GL/wglew.h
M       extern/glew/src/glew.c
M       intern/CMakeLists.txt
M       intern/SConscript
M       intern/cycles/SConscript
M       intern/cycles/app/CMakeLists.txt
M       intern/cycles/blender/CMakeLists.txt
M       intern/cycles/cmake/external_libs.cmake
M       intern/cycles/device/CMakeLists.txt
M       intern/cycles/render/CMakeLists.txt
M       intern/cycles/util/CMakeLists.txt
M       intern/cycles/util/util_opengl.h
M       intern/cycles/util/util_view.cpp
M       intern/ghost/CMakeLists.txt
M       intern/ghost/GHOST_C-api.h
M       intern/ghost/GHOST_IWindow.h
M       intern/ghost/SConscript
M       intern/ghost/intern/GHOST_C-api.cpp
A       intern/ghost/intern/GHOST_Context.cpp
A       intern/ghost/intern/GHOST_Context.h
A       intern/ghost/intern/GHOST_ContextCGL.h
A       intern/ghost/intern/GHOST_ContextCGL.mm
A       intern/ghost/intern/GHOST_ContextEGL.cpp
A       intern/ghost/intern/GHOST_ContextEGL.h
A       intern/ghost/intern/GHOST_ContextGLX.cpp
A       intern/ghost/intern/GHOST_ContextGLX.h
A       intern/ghost/intern/GHOST_ContextNone.cpp
A       intern/ghost/intern/GHOST_ContextNone.h
A       intern/ghost/intern/GHOST_ContextSDL.cpp
A       intern/ghost/intern/GHOST_ContextSDL.h
A       intern/ghost/intern/GHOST_ContextWGL.cpp
A       intern/ghost/intern/GHOST_ContextWGL.h
M       intern/ghost/intern/GHOST_ISystem.cpp
M       intern/ghost/intern/GHOST_SystemCocoa.mm
M       intern/ghost/intern/GHOST_SystemWin32.cpp
M       intern/ghost/intern/GHOST_SystemX11.cpp
M       intern/ghost/intern/GHOST_SystemX11.h
M       intern/ghost/intern/GHOST_Window.cpp
M       intern/ghost/intern/GHOST_Window.h
M       intern/ghost/intern/GHOST_WindowCocoa.h
M       intern/ghost/intern/GHOST_WindowCocoa.mm
M       intern/ghost/intern/GHOST_WindowSDL.cpp
M       intern/ghost/intern/GHOST_WindowSDL.h
M       intern/ghost/intern/GHOST_WindowWin32.cpp
M       intern/ghost/intern/GHOST_WindowWin32.h
M       intern/ghost/intern/GHOST_WindowX11.cpp
M       intern/ghost/intern/GHOST_WindowX11.h
M       intern/ghost/test/CMakeLists.txt
A       intern/glew-mx/CMakeLists.txt
A       intern/glew-mx/SConscript
A       intern/glew-mx/glew-mx.h
A       intern/glew-mx/intern/gl-deprecated.h
A       intern/glew-mx/intern/glew-mx.c
A       intern/glew-mx/intern/symbol-binding.h
M       intern/locale/CMakeLists.txt
M       intern/locale/SConscript
M       intern/locale/boost_locale_wrapper.cpp
M       intern/locale/boost_locale_wrapper.h
A       intern/locale/osx_user_locale.mm
M       intern/opencolorio/CMakeLists.txt
M       intern/opencolorio/SConscript
M       intern/opencolorio/ocio_impl.cc
M       intern/opencolorio/ocio_impl_glsl.cc
M       source/blender/blenfont/CMakeLists.txt
M       source/blender/blenfont/SConscript
M       source/blender/blenkernel/CMakeLists.txt
M       source/blender/blenkernel/SConscript
M       source/blender/blenkernel/intern/DerivedMesh.c
M       source/blender/blenkernel/intern/cdderivedmesh.c
M       source/blender/blenkernel/intern/editderivedmesh.c
M       source/blender/blenkernel/intern/pbvh.c
M       source/blender/blenkernel/intern/smoke.c
M       source/blender/blenkernel/intern/subsurf_ccg.c
M       source/blender/editors/animation/CMakeLists.txt
M       source/blender/editors/animation/SConscript
M       source/blender/editors/armature/CMakeLists.txt
M       source/blender/editors/armature/SConscript
M       source/blender/editors/gpencil/CMakeLists.txt
M       source/blender/editors/gpencil/SConscript
M       source/blender/editors/include/BIF_gl.h
M       source/blender/editors/interface/CMakeLists.txt
M       source/blender/editors/interface/SConscript
M       source/blender/editors/mask/CMakeLists.txt
M       source/blender/editors/mask/SConscript
M       source/blender/editors/mesh/CMakeLists.txt
M       source/blender/editors/mesh/SConscript
M       source/blender/editors/object/CMakeLists.txt
M       source/blender/editors/physics/CMakeLists.txt
M       source/blender/editors/physics/SConscript
M       source/blender/editors/render/CMakeLists.txt
M       source/blender/editors/render/SConscript
M       source/blender/editors/render/render_opengl.c
M       source/blender/editors/screen/CMakeLists.txt
M       source/blender/editors/screen/SConscript
M       source/blender/editors/sculpt_paint/CMakeLists.txt
M       source/blender/editors/sculpt_paint/SConscript
M       source/blender/editors/space_action/CMakeLists.txt
M       source/blender/editors/space_action/SConscript
M       source/blender/editors/space_buttons/CMakeLists.txt
M       source/blender/editors/space_buttons/SConscript
M       source/blender/editors/space_clip/CMakeLists.txt
M       source/blender/editors/space_clip/SConscript
M       source/blender/editors/space_console/CMakeLists.txt
M       source/blender/editors/space_console/SConscript
M       source/blender/editors/space_file/CMakeLists.txt
M       source/blender/editors/space_file/SConscript
M       source/blender/editors/space_graph/CMakeLists.txt
M       source/blender/editors/space_graph/SConscript
M       source/blender/editors/space_image/CMakeLists.txt
M       source/blender/editors/space_image/SConscript
M       source/blender/editors/space_info/CMakeLists.txt
M       source/blender/editors/space_info/SConscript
M       source/blender/editors/space_logic/CMakeLists.txt
M       source/blender/editors/space_logic/SConscript
M       source/blender/editors/space_nla/CMakeLists.txt
M       source/blender/editors/space_nla/SConscript
M       source/blender/editors/space_node/CMakeLists.txt
M       source/blender/editors/space_node/SConscript
M       source/blender/editors/space_outliner/CMakeLists.txt
M       source/blender/editors/space_outliner/SConscript
M       source/blender/editors/space_script/CMakeLists.txt
M       source/blender/editors/space_script/SConscript
M       source/blender/editors/space_sequencer/CMakeLists.txt
M       source/blender/editors/space_sequencer/SConscript
M       source/blender/editors/space_text/CMakeLists.txt
M       source/blender/editors/space_text/SConscript
M       source/blender/editors/space_time/CMakeLists.txt
M       source/blender/editors/space_time/SConscript
M       source/blender/editors/space_view3d/CMakeLists.txt
M       source/blender/editors/space_view3d/SConscript
M       source/blender/editors/transform/CMakeLists.txt
M       source/blender/editors/transform/SConscript
M       source/blender/editors/util/CMakeLists.txt
M       source/blender/editors/util/SConscript
M       source/blender/editors/uvedit/CMakeLists.txt
M       source/blender/editors/uvedit/SConscript
M       source/blender/gpu/CMakeLists.txt
M       source/blender/gpu/GPU_extensions.h
A       source/blender/gpu/GPU_glew.h
A       source/blender/gpu/GPU_init_exit.h
M       source/blender/gpu/GPU_material.h
M       source/blender/gpu/SConscript
M       source/blender/gpu/intern/gpu_buffers.c
M       source/blender/gpu/intern/gpu_codegen.c
M       source/blender/gpu/intern/gpu_codegen.h
M       source/blender/gpu/intern/gpu_draw.c
M       source/blender/gpu/intern/gpu_extensions.c
A       source/blender/gpu/intern/gpu_extensions_private.h
A       source/blender/gpu/intern/gpu_init_exit.c
M       source/blender/gpu/intern/gpu_material.c
M       source/blender/gpu/intern/gpu_select.c
M       source/blender/gpu/intern/gpu_simple_shader.c
M       source/blender/makesrna/SConscript
M       source/blender/makesrna/intern/CMakeLists.txt
M       source/blender/makesrna/intern/SConscript
M       source/blender/modifiers/CMakeLists.txt
M       source/blender/modifiers/SConscript
M       source/blender/nodes/CMakeLists.txt
M       source/blender/nodes/SConscript
M       source/blender/python/SConscript
M       source/blender/python/generic/CMakeLists.txt
M       source/blender/python/generic/bgl.c
M       source/blender/python/intern/CMakeLists.txt
M       source/blender/windowmanager/CMakeLists.txt
M       source/blender/windowmanager/SConscript
M       source/blender/windowmanager/intern/wm_draw.c
M       source/blender/windowmanager/intern/wm_init_exit.c
M       source/blender/windowmanager/intern/wm_window.c
M       source/blender/windowmanager/wm_window.h
M       source/blenderplayer/CMakeLists.txt
M       source/creator/CMakeLists.txt
M       source/creator/creator.c
M       source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
M       source/gameengine/BlenderRoutines/CMakeLists.txt
M       source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
M       source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
M       source/gameengine/BlenderRoutines/SConscript
M       source/gameengine/GamePlayer/common/CMakeLists.txt
M       source/gameengine/GamePlayer/common/GPC_Canvas.h
M       source/gameengine/GamePlayer/common/SConscript
M       source/gameengine/GamePlayer/ghost/CMakeLists.txt
M       source/gameengine/GamePlayer/ghost/GPG_Application.cpp
M       source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp
M       source/gameengine/GamePlayer/ghost/GPG_Canvas.h
M       source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
M       source/gameengine/GamePlayer/ghost/SConscript
M       source/gameengine/Ketsji/BL_Shader.cpp
M       source/gameengine/Ketsji/BL_Texture.cpp
M       source/gameengine/Ketsji/CMakeLists.txt
M       source/gameengine/Ketsji/KX_BlenderMaterial.cpp
M       source/gameengine/Ketsji/KX_Camera.cpp
M       source/gameengine/Ketsji/KX_Dome.cpp
M       source/gameengine/Ketsji/KX_Dome.h
M       source/gameengine/Ketsji/KX_PythonInit.cpp
M       source/gameengine/Ketsji/SConscript
M       source/gameengine/Physics/Bullet/CMakeLists.txt
M       source/gameengine/Physics/Bullet/SConscript
M       source/gameengine/Rasterizer/CMakeLists.txt
M       source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
M       source/gameengine/Rasterizer/RAS_ICanvas.h
M       source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
M       
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
M       source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
M       source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp
M       
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
M       source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
M       source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
M       source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
M       source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h
M       source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
M       source/gameengine/Rasterizer/SConscript
M       source/gameengine/VideoTexture/CMakeLists.txt
M       source/gameengine/VideoTexture/ImageBase.cpp
M       source/gameengine/VideoTexture/ImageRender.cpp
M       source/gameengine/VideoTexture/ImageViewport.cpp
M       source/gameengine/VideoTexture/SConscript
M       source/gameengine/VideoTexture/Texture.cpp

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3222feb..1fb406f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -169,14 +169,22 @@ mark_as_advanced(WITH_AUDASPACE)
 option(WITH_OPENMP        "Enable OpenMP (has to be supported by the 
compiler)" ON)
 
 if(UNIX AND NOT APPLE)
-       option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode 
input)"   ON)
-       option(WITH_X11_XF86VMODE "Enable X11 video mode switching"     ON)
-       option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by 
the operating system" ON)
+       set(WITH_X11 ON)
+endif()
 
-       option(WITH_GHOST_XDND   "Enable drag'n'drop support on X11 using XDND 
protocol" ON)
+if(WITH_X11)
+       option(WITH_X11_XINPUT    "Enable X11 Xinput (tablet support and 
unicode input)"  ON)
+       option(WITH_X11_XF86VMODE "Enable X11 video mode switching"             
          ON)
+       option(WITH_GHOST_XDND    "Enable drag'n'drop support on X11 using XDND 
protocol" ON)
+endif()
+
+if(UNIX AND NOT APPLE)
+       option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by 
the operating system" ON)
+       option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the 
operating system"           ON)
 else()
        # not an option for other OS's
        set(WITH_SYSTEM_GLEW OFF)
+       set(WITH_SYSTEM_GLES OFF)
 endif()
 
 
@@ -320,6 +328,42 @@ endif()
 # Unit testsing
 option(WITH_GTESTS "Enable GTest unit testing" OFF)
 
+# OpenGL
+
+option(WITH_GLEW_MX             "Support multiple GLEW contexts 
(experimental)"                                                                 
    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_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)
+endif()
+
+if(WITH_GLEW_ES AND WITH_SYSTEM_GLEW)
+       message(WARNING Ignoring WITH_SYSTEM_GLEW and using WITH_GLEW_ES)
+       set(WITH_SYSTEM_GLEW OFF)
+endif()
+
+# Apple
+
 if(APPLE)
        if(${CMAKE_VERSION} VERSION_LESS 3.0) # else breaks setting CMP0043 
policy
                cmake_minimum_required(VERSION 2.8.8)
@@ -518,9 +562,10 @@ if(WITH_INSTALL_PORTABLE)
 endif()
 
 if(WITH_GHOST_SDL OR WITH_HEADLESS)
-       set(WITH_GHOST_XDND OFF)
+       set(WITH_X11           OFF)
+       set(WITH_X11_XINPUT    OFF)
        set(WITH_X11_XF86VMODE OFF)
-       set(WITH_X11_XINPUT OFF)
+       set(WITH_GHOST_XDND    OFF)
 endif()
 
 TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
@@ -602,6 +647,35 @@ set(PLATFORM_LINKFLAGS_DEBUG "")
 #-----------------------------------------------------------------------------
 #Platform specifics
 
+if(WITH_X11)
+       find_package(X11 REQUIRED)
+
+       find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h 
${X11_INC_SEARCH_PATH})
+       mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
+
+       list(APPEND PLATFORM_LINKLIBS ${X11_X11_LIB})
+
+       if(WITH_X11_XINPUT)
+               if(X11_Xinput_LIB)
+                       list(APPEND PLATFORM_LINKLIBS ${X11_Xinput_LIB})
+               else()
+                       set(WITH_X11_XINPUT OFF)
+               endif()
+       endif()
+
+       if(WITH_X11_XF86VMODE)
+               # XXX, why dont cmake make this available?
+               find_library(X11_Xxf86vmode_LIB Xxf86vm   
${X11_LIB_SEARCH_PATH})
+               mark_as_advanced(X11_Xxf86vmode_LIB)
+               if(X11_Xxf86vmode_LIB)
+                       list(APPEND PLATFORM_LINKLIBS ${X11_Xxf86vmode_LIB})
+               else()
+                       set(WITH_X11_XF86VMODE OFF)
+               endif()
+       endif()
+
+endif()
+
 if(UNIX AND NOT APPLE)
        macro(find_package_wrapper)
                string(TOUPPER ${ARGV0} _NAME_UPPER)
@@ -910,33 +984,6 @@ if(UNIX AND NOT APPLE)
        # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using 
--as-needed
        list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm -lpthread)
 
-       if((NOT WITH_HEADLESS) AND (NOT WITH_GHOST_SDL))
-               find_package(X11 REQUIRED)
-               find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h 
${X11_INC_SEARCH_PATH})
-               mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
-
-               list(APPEND PLATFORM_LINKLIBS ${X11_X11_LIB})
-
-               if(WITH_X11_XINPUT)
-                       if(X11_Xinput_LIB)
-                               list(APPEND PLATFORM_LINKLIBS ${X11_Xinput_LIB})
-                       else()
-                               set(WITH_X11_XINPUT OFF)
-                       endif()
-               endif()
-
-               if(WITH_X11_XF86VMODE)
-                       # XXX, why dont cmake make this available?
-                       find_library(X11_Xxf86vmode_LIB Xxf86vm   
${X11_LIB_SEARCH_PATH})
-                       mark_as_advanced(X11_Xxf86vmode_LIB)
-                       if(X11_Xxf86vmode_LIB)
-                               list(APPEND PLATFORM_LINKLIBS 
${X11_Xxf86vmode_LIB})
-                       else()
-                               set(WITH_X11_XF86VMODE OFF)
-                       endif()
-               endif()
-       endif()
-
        if(CMAKE_SYSTEM_NAME MATCHES "Linux")
                if(NOT WITH_PYTHON_MODULE)
                        # binreloc is linux only
@@ -2078,10 +2125,123 @@ endif()
 
 #-----------------------------------------------------------------------------
 # Configure OpenGL.
+
 find_package(OpenGL)
 blender_include_dirs_sys("${OPENGL_INCLUDE_DIR}")
-# unset(OPENGL_LIBRARIES CACHE) # not compat with older cmake
-# unset(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake
+
+if(WITH_GLU)
+       list(APPEND BLENDER_GL_LIBRARIES "${OPENGL_glu_LIBRARY}")
+       list(APPEND GL_DEFINITIONS -DWITH_GLU)
+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_gl_LIBRARY}")
+
+elseif(WITH_GL_PROFILE_ES20)
+       if(WITH_SYSTEM_GLES)
+               if(NOT OPENGLES_LIBRARY)
+                       message(FATAL_ERROR "Unable to find OpenGL ES 
libraries.  Install them or disable WITH_SYSTEM_GLES.")
+               endif()
+
+               list(APPEND BLENDER_GL_LIBRARIES OPENGLES_LIBRARY)
+
+       else()
+               set(OPENGLES_LIBRARY "" CACHE FILEPATH "OpenGL ES 2.0 library 
file")
+               mark_as_advanced(OPENGLES_LIBRARY)
+
+               list(APPEND BLENDER_GL_LIBRARIES "${OPENGLES_LIBRARY}")
+
+               if (NOT OPENGLES_LIBRARY)
+                       message(FATAL_ERROR "To compile WITH_GL_EGL you need to 
set OPENGLES_LIBRARY to the file path of an OpenGL ES 2.0 library.")
+               endif()
+
+       endif()
+
+       if(WIN32)
+               # Setup paths to files needed to install and redistribute 
Windows Blender with OpenGL ES
+
+               set(OPENGLES_DLL "" CACHE FILEPATH "OpenGL ES 2.0 
redistributable DLL file")
+               mark_as_advanced(OPENGLES_DLL)
+
+               if(NOT OPENGLES_DLL)
+                       message(FATAL_ERROR "To compile WITH_GL_PROFILE_ES20 
you need to set OPENGLES_DLL to the file path of an OpenGL ES 2.0 runtime 
dynamic link library (DLL).")
+               endif()
+
+               if(WITH_GL_ANGLE)
+                       list(APPEND GL_DEFINITIONS -DWITH_ANGLE)
+
+                       set(D3DCOMPILER_DLL "" CACHE FILEPATH "Direct3D 
Compiler redistributable DLL file (needed by ANGLE)")
+
+                       get_filename_component(D3DCOMPILER_FILENAME 
"${D3DCOMPILER_DLL}" NAME)
+                       list(APPEND GL_DEFINITIONS 
"-DD3DCOMPILER=\"\\\"${D3DCOMPILER_FILENAME}\\\"\"")
+
+                       mark_as_advanced(D3DCOMPILER_DLL)
+
+                       if (D3DCOMPILER_DLL STREQUAL "")
+                               message(FATAL_ERROR "To compile WITH_GL_ANGLE 
you need to set D3DCOMPILER_DLL to the file path of a copy of the DirectX 
redistributable DLL file: D3DCompiler_46.dll")
+                       endif()
+
+               endif()
+
+       endif()
+
+endif()
+
+if(WITH_GL_EGL)
+       list(APPEND GL_DEFINITIONS -DWITH_GL_EGL)
+
+       if(WITH_SYSTEM_GLES)
+               if(NOT OPENGLES_EGL_LIBRARY)
+                       message(FATAL_ERROR "Unable to find OpenGL ES 
libraries.  Install them or disable WITH_SYSTEM_GLES.")
+               endif()
+
+               list(APPEND BLENDER_GL_LIBRARIES OPENGLES_EGL_LIBRARY)
+
+       else()
+               set(OPENGLES_EGL_LIBRARY "" CACHE FILEPATH "EGL library file")
+               mark_as_advanced(OPENGLES_EGL_LIBRARY)
+
+               list(APPEND BLENDER_GL_LIBRARIES "${OPENGLES_LIBRARY}" 
"${OPENGLES_EGL_LIBRARY}")
+
+               if (NOT OPENGLES_EGL_LIBRARY)
+                       message(FATAL_ERROR "To compile WITH_GL_EGL you need to 
set OPENGLES_EGL_LIBRARY to the file path of an EGL library.")
+               endif()
+
+       endif()
+
+       if(WIN32)
+               # Setup paths to files needed to install and redistribute 
Windows Blender with OpenGL ES
+
+               set(OPENGLES_EGL_DLL "" CACHE FILEPATH "EGL redistributable DLL 
file")
+               mark_as_advanced(OPENGLES_EGL_DLL)
+
+               if(NOT OPENGLES_EGL_DLL)
+                       message(FATAL_ERROR "To compile WITH_GL_EGL you need to 
set OPENGLES_EGL_DLL to the file path of an EGL runtime dynamic link library 
(DLL).")
+               endif()
+
+       endif()
+
+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)
+endif()
+
+if(WITH_GL_EGL)
+       list(APPEND GL_DEFINITIONS -DWITH_EGL)
+endif()
 
 #-----------------------------------------------------------------------------
 # Configure OpenMP.
@@ -2103,19 +2263,76 @@ endif()
 #-----------------------------------------------------------------------------
 # Configure GLEW
 
+if(WITH_GLEW_MX)
+       list(APPEND GL_DEFINITIONS -DWITH_GLEW_MX)
+endif()
+
 if(WITH_SYSTEM_GLEW)
        find_package(GLEW)
 
+       # Note: There is an assumption here that the system GLEW is not a 
static library.
+
        if(NOT GLEW_FOUND)
-               message(FATAL_ERROR "GLEW is required to build blender, install 
it or disable WITH_SYSTEM_GLEW")
+               message(FATAL_ERROR "GLEW is required to build Blender. Install 
it or disable WITH_SYSTEM_GLEW.")
        endif()
 
-       set(GLEW_INCLUDE_PATH "${GLEW_INCLUDE_DIRS}")
+       if(WITH_GLEW_MX)
+               set(BLENDER_GLEW_LIBRARIES ${GLEW_MX_LIBRARY})
+       else()
+               set(BLENDER_GLEW_LIBRARIES ${GLEW_LIBRARY})
+       endif()
 else()
-       # set(GLEW_LIBRARY "")  # unused
-       set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include")
+       if(WITH_GLEW_ES)
+               set(GLEW_INCLUDE_PATH 
"${CMAKE_SOURCE_DIR}/extern/glew-es/include")
+

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to