scons: Updates for targets/egl-static.
authorChia-I Wu <olv@lunarg.com>
Sun, 9 Jan 2011 15:37:32 +0000 (23:37 +0800)
committerChia-I Wu <olv@lunarg.com>
Wed, 12 Jan 2011 09:40:01 +0000 (17:40 +0800)
Update SConscripts to re-enable or add support for EGL on windows and
x11 platforms respectively.  targets/egl-gdi is replaced by
targets/egl-static, where "-static" means pipe drivers and state
trackers are linked to statically by egl_gallium, and egl_gallium is a
built-in driver of libEGL.  There is no more egl_gallium.dll on Windows.

src/SConscript
src/egl/main/SConscript
src/egl/main/egldriver.c
src/egl/main/egldriver.h
src/gallium/SConscript
src/gallium/state_trackers/egl/SConscript
src/gallium/targets/egl-static/SConscript [new file with mode: 0644]
src/mapi/vgapi/SConscript

index c42d9bff2d7fcd36f90be02985f7f5987c7a6ca2..116c9b36e4e5674e34e736036ee37c739dffca10 100644 (file)
@@ -1,16 +1,16 @@
 Import('*')
 
 Import('*')
 
-SConscript('mapi/vgapi/SConscript')
-
 if env['platform'] == 'windows':
 if env['platform'] == 'windows':
-    SConscript('egl/main/SConscript')
     SConscript('talloc/SConscript')
 
 SConscript('glsl/SConscript')
 SConscript('mapi/glapi/SConscript')
 SConscript('mesa/SConscript')
 
     SConscript('talloc/SConscript')
 
 SConscript('glsl/SConscript')
 SConscript('mapi/glapi/SConscript')
 SConscript('mesa/SConscript')
 
+SConscript('mapi/vgapi/SConscript')
+
 if env['platform'] != 'embedded':
 if env['platform'] != 'embedded':
+    SConscript('egl/main/SConscript')
     SConscript('glut/glx/SConscript')
 
 SConscript('gallium/SConscript')
     SConscript('glut/glx/SConscript')
 
 SConscript('gallium/SConscript')
index f001b81600fdcdcde9db8dabf1b58f0642a06a64..8c57ceaf20fb946456fa36d00b9c7404a587399b 100644 (file)
@@ -7,13 +7,23 @@ Import('*')
 env = env.Clone()
 
 env.Append(CPPDEFINES = [
 env = env.Clone()
 
 env.Append(CPPDEFINES = [
-    '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
+    '_EGL_BUILT_IN_DRIVER_GALLIUM',
     '_EGL_DRIVER_SEARCH_DIR=\\"\\"',
     '_EGL_DRIVER_SEARCH_DIR=\\"\\"',
-    '_EGL_OS_WINDOWS',
-    '_EGL_GET_CORE_ADDRESSES',
-    'KHRONOS_DLL_EXPORTS',
 ])
 
 ])
 
+if env['platform'] == 'windows':
+    env.Append(CPPDEFINES = [
+        '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_WINDOWS',
+        '_EGL_OS_WINDOWS',
+        '_EGL_GET_CORE_ADDRESSES',
+        'KHRONOS_DLL_EXPORTS',
+    ])
+else:
+    env.Append(CPPDEFINES = [
+        '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11',
+        '_EGL_OS_UNIX',
+    ])
+
 env.Append(CPPPATH = [
     '#/include',
 ])
 env.Append(CPPPATH = [
     '#/include',
 ])
@@ -38,15 +48,9 @@ egl_sources = [
     'eglsync.c',
 ]
 
     'eglsync.c',
 ]
 
-egl = env.SharedLibrary(
-    target = 'libEGL',
-    source = egl_sources + ['egl.def'],
+egl = env.ConvenienceLibrary(
+    target = 'egl',
+    source = egl_sources,
 )
 
 )
 
-installed_egl = env.InstallSharedLibrary(egl, version=(1, 4, 0))
-
-env.Alias('egl', installed_egl)
-
-egl = [env.FindIxes(egl, 'LIBPREFIX', 'LIBSUFFIX')]
-
 Export('egl')
 Export('egl')
index 46876d00565e50beba74ab39bb2eb2aa7d5a306a..b7c3de3e38e2c7ffe14c0fc5df90fa9357d48857 100644 (file)
@@ -37,6 +37,9 @@ const struct {
    const char *name;
    _EGLMain_t main;
 } _eglBuiltInDrivers[] = {
    const char *name;
    _EGLMain_t main;
 } _eglBuiltInDrivers[] = {
+#ifdef _EGL_BUILT_IN_DRIVER_GALLIUM
+   { "egl_gallium", _eglBuiltInDriverGALLIUM },
+#endif
 #ifdef _EGL_BUILT_IN_DRIVER_DRI2
    { "egl_dri2", _eglBuiltInDriverDRI2 },
 #endif
 #ifdef _EGL_BUILT_IN_DRIVER_DRI2
    { "egl_dri2", _eglBuiltInDriverDRI2 },
 #endif
index 651788cb7ae1f8dbfec6c95d768cf7615ec296f9..d61775791939ea4c07210776074e4908ab112b84 100644 (file)
@@ -64,6 +64,10 @@ struct _egl_driver
 };
 
 
 };
 
 
+extern _EGLDriver *
+_eglBuiltInDriverGALLIUM(const char *args);
+
+
 extern _EGLDriver *
 _eglBuiltInDriverDRI2(const char *args);
 
 extern _EGLDriver *
 _eglBuiltInDriverDRI2(const char *args);
 
index 0efab834f66b4691a40efb6ab346d0e694dd48bd..2265f1de46c44a3242ce8e8e83499e9a0dd1d705 100644 (file)
@@ -55,6 +55,7 @@ SConscript('winsys/sw/null/SConscript')
 SConscript('state_trackers/python/SConscript')
 if env['platform'] != 'embedded':
     SConscript('state_trackers/vega/SConscript')
 SConscript('state_trackers/python/SConscript')
 if env['platform'] != 'embedded':
     SConscript('state_trackers/vega/SConscript')
+    SConscript('state_trackers/egl/SConscript')
 
     if env['x11']:
         SConscript('state_trackers/glx/xlib/SConscript')
 
     if env['x11']:
         SConscript('state_trackers/glx/xlib/SConscript')
@@ -66,10 +67,7 @@ if env['platform'] != 'embedded':
         SConscript('state_trackers/xorg/SConscript')
 
 if env['platform'] == 'windows':
         SConscript('state_trackers/xorg/SConscript')
 
 if env['platform'] == 'windows':
-    SConscript([
-        'state_trackers/egl/SConscript',
-        'state_trackers/wgl/SConscript',
-    ])
+    SConscript('state_trackers/wgl/SConscript')
 
 #
 # Winsys
 
 #
 # Winsys
@@ -85,6 +83,11 @@ SConscript([
     'targets/graw-null/SConscript',
 ])
 
     'targets/graw-null/SConscript',
 ])
 
+if env['platform'] != 'embedded':
+    SConscript([
+        'targets/egl-static/SConscript'
+    ])
+
 if env['x11']:
     SConscript([
         'targets/graw-xlib/SConscript',
 if env['x11']:
     SConscript([
         'targets/graw-xlib/SConscript',
@@ -95,7 +98,6 @@ if env['platform'] == 'windows':
     SConscript([
         'targets/graw-gdi/SConscript',
         'targets/libgl-gdi/SConscript',
     SConscript([
         'targets/graw-gdi/SConscript',
         'targets/libgl-gdi/SConscript',
-        #'egl-gdi/SConscript',
     ])
 
 if env['dri']:
     ])
 
 if env['dri']:
index 50c76819954c31b66140e3ff98ebc0e3d7b5909b..9ade76ecbb20fa6e3f2288d32997a02163652fb9 100644 (file)
@@ -10,11 +10,8 @@ env.Append(CPPPATH = [
     '#/src/gallium/winsys/sw',
     '.',
 ])
     '#/src/gallium/winsys/sw',
     '.',
 ])
-env.Append(CPPDEFINES = [
-    'HAVE_GDI_BACKEND',
-])
 
 
-common_sources = [
+sources = [
     'common/egl_g3d.c',
     'common/egl_g3d_api.c',
     'common/egl_g3d_image.c',
     'common/egl_g3d.c',
     'common/egl_g3d_api.c',
     'common/egl_g3d_image.c',
@@ -23,12 +20,31 @@ common_sources = [
     'common/native_helper.c',
 ]
 
     'common/native_helper.c',
 ]
 
-gdi_sources = common_sources + [
-    'gdi/native_gdi.c',
-]
+if env['platform'] == 'windows':
+    env.Append(CPPDEFINES = ['HAVE_GDI_BACKEND'])
+    sources.append('gdi/native_gdi.c')
+else:
+    if env['x11']:
+        env.Append(CPPDEFINES = ['HAVE_X11_BACKEND'])
+        env.Prepend(CPPPATH = [
+            '#/src/glx',
+            '#/src/mapi',
+        ])
+        sources.append([
+            'x11/native_x11.c',
+            'x11/native_dri2.c',
+            'x11/native_ximage.c',
+            'x11/x11_screen.c',
+            'x11/glxinit.c'])
+        if env['dri']:
+            env.Append(CPPDEFINES = ['GLX_DIRECT_RENDERING'])
+            sources.append(['#/src/glx/dri2.c'])
+    if env['drm']:
+        env.Append(CPPDEFINES = ['HAVE_DRM_BACKEND'])
+        sources.append(['drm/native_drm.c', 'drm/modeset.c'])
 
 
-st_egl_gdi = env.ConvenienceLibrary(
-    target = 'st_egl_gdi',
-    source = gdi_sources,
+st_egl = env.ConvenienceLibrary(
+    target = 'st_egl',
+    source = sources,
 )
 )
-Export('st_egl_gdi')
+Export('st_egl')
diff --git a/src/gallium/targets/egl-static/SConscript b/src/gallium/targets/egl-static/SConscript
new file mode 100644 (file)
index 0000000..1fa4080
--- /dev/null
@@ -0,0 +1,122 @@
+#######################################################################
+# SConscript for egl-static target
+
+Import('*')
+
+env = env.Clone()
+
+env.Append(CPPPATH = [
+    '#/include',
+    '#/src/egl/main',
+    '#/src/gallium/auxiliary',
+    '#/src/gallium/drivers',
+    '#/src/gallium/include',
+    '#/src/gallium/winsys',
+    '#/src/gallium/state_trackers/egl',
+    '#/src/gallium/state_trackers/vega',
+    '#/src/mesa',
+])
+
+env.Append(CPPDEFINES = [
+    'GALLIUM_SOFTPIPE',
+    'GALLIUM_RBUG',
+    'GALLIUM_TRACE',
+    'GALLIUM_GALAHAD',
+    '_EGL_MAIN=_eglBuiltInDriverGALLIUM',
+])
+
+env.Prepend(LIBS = [
+    softpipe,
+    rbug,
+    trace,
+    galahad,
+    gallium,
+    egl,
+])
+
+if env['llvm']:
+    env.Append(CPPDEFINES = ['GALLIUM_LLVMPIPE'])
+    env.Prepend(LIBS = [llvmpipe])
+
+sources = [
+    'egl.c',
+    'egl_pipe.c',
+    'egl_st.c',
+]
+
+if env['platform'] == 'windows':
+    sources.append('#src/egl/main/egl.def')
+
+    env.Append(LIBS = [
+        'gdi32',
+        'user32',
+        'kernel32',
+        'ws2_32',
+    ])
+
+    env.Prepend(LIBS = [
+        st_egl,
+        ws_gdi,
+    ])
+
+    # OpenVG
+    env.Append(CPPDEFINES = ['FEATURE_VG=1'])
+    env.Prepend(LIBS = [vgapi, st_vega])
+else:
+    env.Prepend(LIBS = [
+        st_egl,
+        ws_xlib,
+    ])
+
+    # OpenGL
+    env.Append(CPPDEFINES = ['FEATURE_GL=1'])
+    env.Prepend(LIBS = ['GL', 'talloc', glsl, mesa])
+
+    # OpenVG
+    env.Append(CPPDEFINES = ['FEATURE_VG=1'])
+    env.Prepend(LIBS = ['OpenVG', st_vega])
+
+
+if env['dri']:
+    env.ParseConfig('pkg-config --cflags --libs xfixes')
+
+# pipe drivers
+if env['drm']:
+    env.ParseConfig('pkg-config --cflags --libs libdrm')
+
+    if env['drm_intel']:
+        env.ParseConfig('pkg-config --cflags --libs libdrm_intel')
+        env.Append(CPPDEFINES = ['_EGL_PIPE_I915', '_EGL_PIPE_I965'])
+        env.Prepend(LIBS = [
+            i915drm,
+            i915,
+            i965drm,
+            i965,
+        ])
+
+    if env['drm_radeon']:
+        env.ParseConfig('pkg-config --cflags --libs libdrm_radeon')
+        env.Append(CPPDEFINES = ['_EGL_PIPE_R300', '_EGL_PIPE_R600'])
+        env.Prepend(LIBS = [
+            radeonwinsys,
+            r300,
+            r600winsys,
+            r600,
+        ])
+
+    env.Append(CPPDEFINES = ['_EGL_PIPE_VMWGFX'])
+    env.Prepend(LIBS = [
+        svgadrm,
+        svga,
+    ])
+
+egl_gallium = env.SharedLibrary(
+    target ='libEGL',
+    source = sources,
+)
+
+env.Depends(egl_gallium, [vgapi])
+
+egl_gallium = env.InstallSharedLibrary(egl_gallium, version=(1, 4, 0))
+
+env.Alias('egl-gallium', egl_gallium)
index 42d86b69eefa40fdf5c4785ba2598f8048868b1f..8d671597859b704ab92aa748bef1b0d3a0a93701 100644 (file)
@@ -51,6 +51,9 @@ if env['platform'] != 'winddk':
 
        env.InstallSharedLibrary(openvg, version=(1, 0, 0))
 
 
        env.InstallSharedLibrary(openvg, version=(1, 0, 0))
 
-       vgapi = [env.FindIxes(openvg, 'LIBPREFIX', 'LIBSUFFIX')]
+       if env['platform'] == 'windows':
+           vgapi = env.FindIxes(openvg, 'LIBPREFIX', 'LIBSUFFIX')
+       else:
+           vgapi = env.FindIxes(openvg, 'SHLIBPREFIX', 'SHLIBSUFFIX')
 
        Export(['vgapi'])
 
        Export(['vgapi'])