[Bf-blender-cvs] [3ff7b8f] soc-2014-viewport_context: SCons support for Ghost context refactor Tested on OSX Only tested the default options and did not implement code needed to link with EGL, but that can be done later

Jason Wilkins noreply at git.blender.org
Sat Jul 26 04:05:22 CEST 2014


Commit: 3ff7b8fd9c51dcf1c3e44470efe7661138a51835
Author: Jason Wilkins
Date:   Fri Jul 25 20:57:33 2014 -0500
Branches: soc-2014-viewport_context
https://developer.blender.org/rB3ff7b8fd9c51dcf1c3e44470efe7661138a51835

SCons support for Ghost context refactor
Tested on OSX
Only tested the default options and did not implement code needed to link with EGL, but that can be done later

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

M	SConstruct
M	build_files/scons/tools/btools.py
M	extern/SConscript
A	extern/glew-es/SConscript
M	extern/glew/SConscript
M	intern/SConscript
M	intern/cycles/SConscript
M	intern/ghost/SConscript
A	intern/glew-mx/SConscript
M	intern/locale/SConscript
M	intern/opencolorio/SConscript
M	source/blender/blenfont/SConscript
M	source/blender/blenkernel/SConscript
M	source/blender/editors/animation/SConscript
M	source/blender/editors/armature/SConscript
M	source/blender/editors/gpencil/SConscript
M	source/blender/editors/interface/SConscript
M	source/blender/editors/mask/SConscript
M	source/blender/editors/mesh/SConscript
M	source/blender/editors/physics/SConscript
M	source/blender/editors/render/SConscript
M	source/blender/editors/screen/SConscript
M	source/blender/editors/sculpt_paint/SConscript
M	source/blender/editors/space_action/SConscript
M	source/blender/editors/space_buttons/SConscript
M	source/blender/editors/space_clip/SConscript
M	source/blender/editors/space_console/SConscript
M	source/blender/editors/space_file/SConscript
M	source/blender/editors/space_graph/SConscript
M	source/blender/editors/space_image/SConscript
M	source/blender/editors/space_info/SConscript
M	source/blender/editors/space_logic/SConscript
M	source/blender/editors/space_nla/SConscript
M	source/blender/editors/space_node/SConscript
M	source/blender/editors/space_outliner/SConscript
M	source/blender/editors/space_script/SConscript
M	source/blender/editors/space_sequencer/SConscript
M	source/blender/editors/space_text/SConscript
M	source/blender/editors/space_time/SConscript
M	source/blender/editors/space_view3d/SConscript
M	source/blender/editors/transform/SConscript
M	source/blender/editors/util/SConscript
M	source/blender/editors/uvedit/SConscript
M	source/blender/gpu/SConscript
M	source/blender/makesrna/SConscript
M	source/blender/makesrna/intern/SConscript
M	source/blender/modifiers/SConscript
M	source/blender/nodes/SConscript
M	source/blender/python/SConscript
M	source/blender/windowmanager/SConscript
M	source/gameengine/BlenderRoutines/SConscript
M	source/gameengine/GamePlayer/common/SConscript
M	source/gameengine/GamePlayer/ghost/SConscript
M	source/gameengine/Ketsji/SConscript
M	source/gameengine/Physics/Bullet/SConscript
M	source/gameengine/Rasterizer/RAS_OpenGLRasterizer/SConscript
M	source/gameengine/Rasterizer/SConscript
M	source/gameengine/VideoTexture/SConscript

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

diff --git a/SConstruct b/SConstruct
index 331158e..ca6617f 100644
--- a/SConstruct
+++ b/SConstruct
@@ -511,6 +511,49 @@ env['CPPFLAGS'].append('-DWITH_OPENNL')
 if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
     env['CPPFLAGS'].append('-DHAVE_STDBOOL_H')
 
+# OpenGL
+
+if env['WITH_BF_GL_PROFILE_COMPAT']:
+    env['BF_GL_DEFINITIONS'].append('WITH_GL_PROFILE_COMPAT')
+
+if env['WITH_BF_GL_PROFILE_CORE']:
+    env['BF_GL_DEFINITIONS'].append('WITH_GL_PROFILE_CORE')
+
+if env['WITH_BF_GL_PROFILE_ES20']:
+    env['BF_GL_DEFINITIONS'].append('WITH_GL_PROFILE_ES20')
+
+if env['WITH_BF_GL_EGL']:
+    env['BF_GL_DEFINITIONS'].append('WITH_EGL')
+
+# GLEW
+
+if env['WITH_BF_GLEW_MX']:
+    env['BF_GL_DEFINITIONS'].append('GLEW_MX')
+
+if env['WITH_BF_GLEW_ES']:
+    env['BF_GLEW_INC'] = '#extern/glew-es/include'
+
+    env['BF_GL_DEFINITIONS'] += ['GLEW_STATIC', 'WITH_GLEW_ES']
+
+    if not env['WITH_BF_GL_PROFILE_ES20']:
+        # No ES functions are needed
+        env['BF_GL_DEFINITIONS'].append('GLEW_NO_ES')
+    elif not (env['WITH_BF_GL_PROFILE_CORE'] or env['WITH_BF_GL_PROFILE_COMPAT']):
+        # ES is enabled, but the other functions are all disabled
+        env['BF_GL_DEFINITIONS'].append('GLEW_ES_ONLY')
+
+    if env['WITH_BF_GL_PROFILE_ES20']:
+        if env['WITH_BF_GL_EGL']:
+            env['BF_GL_DEFINITIONS'].append('GLEW_USE_LIB_ES20')
+
+    if env['WITH_BF_GL_EGL']:
+        env['BF_GL_DEFINITIONS'].append('GLEW_INC_EGL')
+
+else:
+    env['BF_GLEW_INC'] = '#extern/glew/include'
+
+    env['BF_GL_DEFINITIONS'].append('GLEW_STATIC')
+
 # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
 B.root_build_dir = env['BF_BUILDDIR']
 B.doc_build_dir = os.path.join(env['BF_INSTALLDIR'], 'doc')
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index 214827b..6c0c945 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -136,6 +136,8 @@ def validate_arguments(args, bc):
             'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
             'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH', 'WITH_BF_STATICFFTW3', 'BF_FFTW3_LIB_STATIC',
             'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC',
+            'WITH_BF_EGL', 'WITH_BF_GLEW_ES', 'BF_GLEW_INC', 'WITH_BF_GL_PROFILE_CORE', 'WITH_BF_GL_PROFILE_COMPAT', 'WITH_BF_GL_PROFILE_ES20',
+
             'WITH_BF_COLLADA', 'BF_COLLADA', 'BF_COLLADA_INC', 'BF_COLLADA_LIB', 'BF_OPENCOLLADA', 'BF_OPENCOLLADA_INC', 'BF_OPENCOLLADA_LIB', 'BF_OPENCOLLADA_LIBPATH', 'BF_PCRE', 'BF_PCRE_LIB', 'BF_PCRE_LIBPATH', 'BF_EXPAT', 'BF_EXPAT_LIB', 'BF_EXPAT_LIBPATH',
             'WITH_BF_STATICOPENCOLLADA', 'BF_OPENCOLLADA_LIB_STATIC',
             'WITH_BF_PLAYER',
@@ -185,6 +187,7 @@ def validate_arguments(args, bc):
     opts_list_split = [
             'BF_PYTHON_LINKFLAGS',
             'BF_OPENGL_LINKFLAGS',
+            'BF_GL_DEFINITIONS',
             'CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'CPPFLAGS',
             'REL_CFLAGS', 'REL_CCFLAGS', 'REL_CXXFLAGS',
             'BGE_CXXFLAGS',
@@ -461,6 +464,18 @@ def read_opts(env, cfg, args):
         ('BF_OPENGL_LIB_STATIC', 'OpenGL static libraries', ''),
         ('BF_OPENGL_LINKFLAGS', 'OpenGL link flags', ''),
 
+        (BoolVariable('WITH_BF_GLEW_MX', '', True)),
+        (BoolVariable('WITH_BF_GLEW_ES', '', False)),
+        (BoolVariable('WITH_BF_GL_EGL', '', False)),
+        (BoolVariable('WITH_BF_GL_PROFILE_COMPAT', '', True)),
+        (BoolVariable('WITH_BF_GL_PROFILE_CORE', '', False)),
+        (BoolVariable('WITH_BF_GL_PROFILE_ES20', '', False)),
+        (BoolVariable('WITH_BF_GL_ANGLE', '', False)),
+        ('BF_GL_DEFINITIONS', '', []),
+        ('BF_GLEW_INC', '', ''),
+    ) # end of opts.AddVariables()
+
+    localopts.AddVariables(
         (BoolVariable('WITH_BF_COLLADA', 'Build COLLADA import/export module if true', False)),
         (BoolVariable('WITH_BF_STATICOPENCOLLADA', 'Staticly link to OpenCollada', False)),
         ('BF_COLLADA', 'COLLADA base path', ''),
diff --git a/extern/SConscript b/extern/SConscript
index 041aa34..06daa09 100644
--- a/extern/SConscript
+++ b/extern/SConscript
@@ -2,7 +2,11 @@
 
 Import('env')
 
-SConscript(['glew/SConscript'])
+if env['WITH_BF_GLEW_ES']:
+    SConscript(['glew-es/SConscript'])
+else:
+    SConscript(['glew/SConscript'])
+
 SConscript(['colamd/SConscript'])
 SConscript(['rangetree/SConscript'])
 SConscript(['wcwidth/SConscript'])
diff --git a/extern/glew-es/SConscript b/extern/glew-es/SConscript
new file mode 100644
index 0000000..078bedb
--- /dev/null
+++ b/extern/glew-es/SConscript
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+import sys
+import os
+
+Import('env')
+
+sources = ['src/glew.c']
+
+defs = env['BF_GL_DEFINITIONS']
+incs = ['include']
+
+env.BlenderLib ( 'extern_glew_es', sources, incs, defs, libtype=['extern','player'], priority=[50,230] )
diff --git a/extern/glew/SConscript b/extern/glew/SConscript
index 84e2ba6..5f521a3 100644
--- a/extern/glew/SConscript
+++ b/extern/glew/SConscript
@@ -6,7 +6,7 @@ Import('env')
 
 sources = ['src/glew.c']
 
-defs = 'GLEW_STATIC'
-incs = 'include'
+defs = env['BF_GL_DEFINITIONS']
+incs = ['include']
 
-env.BlenderLib ( 'extern_glew', sources, Split(incs), Split(defs), libtype=['extern','player'], priority=[50,230])
+env.BlenderLib ( 'extern_glew', sources, incs, defs, libtype=['extern','player'], priority=[50,230] )
diff --git a/intern/SConscript b/intern/SConscript
index 2080388..91f507b 100644
--- a/intern/SConscript
+++ b/intern/SConscript
@@ -30,6 +30,7 @@ Import ('env')
 SConscript(['audaspace/SConscript',
             'string/SConscript',
             'ghost/SConscript',
+            'glew-mx/SConscript',
             'guardedalloc/SConscript',
             'moto/SConscript',
             'memutil/SConscript/',
diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript
index 00acde2..cbc9ef6 100644
--- a/intern/cycles/SConscript
+++ b/intern/cycles/SConscript
@@ -45,7 +45,7 @@ incs = []
 defs = []
 cxxflags = Split(env['CXXFLAGS'])
 
-defs.append('GLEW_STATIC')
+defs += env['BF_GL_DEFINITIONS']
 
 defs.append('CCL_NAMESPACE_BEGIN=namespace ccl {')
 defs.append('CCL_NAMESPACE_END=}')
@@ -62,7 +62,9 @@ if env['WITH_BF_CYCLES_OSL']:
 incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split())
 incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna #source/blender/blenlib'.split())
 incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split())
-incs.extend('#extern/glew/include #intern/mikktspace'.split())
+incs.append(env['BF_GLEW_INC'])
+incs.append('#/intern/glew-mx')
+incs.append('#intern/mikktspace')
 incs.append(cycles['BF_OIIO_INC'])
 incs.append(cycles['BF_BOOST_INC'])
 incs.append(cycles['BF_OPENEXR_INC'].split())
diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript
index 8075647..e855075 100644
--- a/intern/ghost/SConscript
+++ b/intern/ghost/SConscript
@@ -37,21 +37,31 @@ sources2 = env.Glob('intern/GHOST_NDOFManager3Dconnexion.c')
 if window_system == 'darwin':
     sources += env.Glob('intern/*.mm')
 
+if not env['WITH_BF_GL_EGL']:
+    sources.remove('intern' + os.sep + 'GHOST_ContextEGL.cpp')
+
+# seems cleaner to remove these now then add back the one that is needed
+sources.remove('intern' + os.sep + 'GHOST_ContextCGL.mm')
+sources.remove('intern' + os.sep + 'GHOST_ContextGLX.cpp')
+sources.remove('intern' + os.sep + 'GHOST_ContextWGL.cpp')
 
 pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_SystemPaths', 'GHOST_Window', 'GHOST_DropTarget', 'GHOST_NDOFManager']
-defs=['_USE_MATH_DEFINES', 'GLEW_STATIC']
+
+defs = env['BF_GL_DEFINITIONS']
+
+if env['WITH_BF_GL_EGL']:
+    defs.append('WITH_EGL')
 
 incs = [
     '.',
-    '#extern/glew/include',
+    env['BF_GLEW_INC'],
+    '../glew-mx',
     '#source/blender/imbuf',
     '#source/blender/makesdna',
     '../string',
     ]
 incs = ' '.join(incs)
 
-incs += ' ' + env['BF_OPENGL_INC']
-
 if env['WITH_GHOST_SDL']:
     for f in pf:
         try:
@@ -68,6 +78,9 @@ elif window_system in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'f
             sources.remove('intern' + os.sep + f + 'SDL.cpp')
         except ValueError:
             pass
+
+    defs += ['WITH_X11']
+
     ## removing because scons does not support system installation
     ## if this is used for blender.org builds it means our distrobution
     ## will find any locally installed blender and double up its script path.
@@ -88,6 +101,9 @@ elif window_system in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'f
     else:
         sources.remove('intern' + os.sep + 'GHOST_DropTargetX11.cpp')
 
+    if not env['WITH_BF_GL_EGL']:
+        sources.append('intern' + os.sep + 'GHOST_ContextGLX.cpp')
+
 elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc', 'win64-mingw'):
     for f in pf:
         try:
@@ -95,16 +111,24 @@ elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64
             sources.remove('intern' + os.sep + f + 'SDL.cpp')
         except ValueError:
             pass
+
+    if not env['WITH_BF_GL_EGL']:
+        sources.append('intern' + os.sep + 'GHOST_ContextWGL.cpp')
+
 elif window_system == 'darwin':
-	if env['WITH_BF_QUICKTIME']:
-		defs.append('WITH_QUICKTIME')
-	for f in pf:
-		try:
-			sources.remove('intern' + os.sep + f + 'Win32.cpp')
-			sources.remove('intern' + os.sep + f + 'X11.cpp')
-			sources.remove('intern' + os.sep + f + 'SDL.cpp')
-		except ValueError:
-			pass
+    if env['WITH_BF_QUICKTIME']:
+        defs.append('WITH_QUICKTIME')
+    for f in pf:
+        try:
+            sources.remove('intern' + os.sep + f + 'Win32.cpp')
+            sources.remove('intern' + os.sep + f + 'X11.cpp')
+            sources.remove('intern' + os.sep + f + 'SDL.cpp')
+        except ValueError:
+            pass
+
+    if not env['WITH_BF_GL_EGL']:
+        sources.append('intern' + os.sep + 'GHOST_ContextCGL.mm')
+
 else:
     print "Unknown window sy

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list