[Mesa-dev] [PATCH] scons: add target osmesa using gallium state tracker.

olivier.pena.80 at gmail.com olivier.pena.80 at gmail.com
Wed Apr 22 08:36:28 PDT 2015


From: Olivier Pena <opena at isagri.fr>

---
 src/gallium/SConscript                        |  5 ++++
 src/gallium/state_trackers/osmesa/Makefile.am |  2 ++
 src/gallium/state_trackers/osmesa/SConscript  | 26 ++++++++++++++++
 src/gallium/targets/osmesa/Makefile.am        |  6 +++-
 src/gallium/targets/osmesa/SConscript         | 43 +++++++++++++++++++++++++++
 src/gallium/targets/osmesa/osmesa.def         | 16 ++++++++++
 src/gallium/targets/osmesa/osmesa.mingw.def   | 13 ++++++++
 7 files changed, 110 insertions(+), 1 deletion(-)
 create mode 100644 src/gallium/state_trackers/osmesa/SConscript
 create mode 100644 src/gallium/targets/osmesa/SConscript
 create mode 100644 src/gallium/targets/osmesa/osmesa.def
 create mode 100644 src/gallium/targets/osmesa/osmesa.mingw.def

diff --git a/src/gallium/SConscript b/src/gallium/SConscript
index 680ad92..eeb1c78 100644
--- a/src/gallium/SConscript
+++ b/src/gallium/SConscript
@@ -60,6 +60,11 @@ SConscript([
 ])
 
 if not env['embedded']:
+    SConscript([
+        'state_trackers/osmesa/SConscript',
+        'targets/osmesa/SConscript',
+    ])
+
     if env['x11']:
         SConscript([
             'state_trackers/glx/xlib/SConscript',
diff --git a/src/gallium/state_trackers/osmesa/Makefile.am b/src/gallium/state_trackers/osmesa/Makefile.am
index 4ba6c20..22e65c8 100644
--- a/src/gallium/state_trackers/osmesa/Makefile.am
+++ b/src/gallium/state_trackers/osmesa/Makefile.am
@@ -39,3 +39,5 @@ AM_CPPFLAGS = \
 noinst_LTLIBRARIES = libosmesa.la
 
 libosmesa_la_SOURCES = $(C_SOURCES)
+
+EXTRA_DIST = SConscript
diff --git a/src/gallium/state_trackers/osmesa/SConscript b/src/gallium/state_trackers/osmesa/SConscript
new file mode 100644
index 0000000..f5519f1
--- /dev/null
+++ b/src/gallium/state_trackers/osmesa/SConscript
@@ -0,0 +1,26 @@
+import os
+
+Import('*')
+
+env = env.Clone()
+
+env.Append(CPPPATH = [
+    '#src/mapi',
+    '#src/mesa',
+    '.',
+])
+
+if env['platform'] == 'windows':
+    env.AppendUnique(CPPDEFINES = [
+        'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
+        'WIN32_LEAN_AND_MEAN', # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx
+    ])
+    if not env['gles']:
+        # prevent _glapi_* from being declared __declspec(dllimport)
+        env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
+
+st_osmesa = env.ConvenienceLibrary(
+    target ='st_osmesa',
+    source = env.ParseSourceList('Makefile.sources', 'C_SOURCES'),
+)
+Export('st_osmesa')
diff --git a/src/gallium/targets/osmesa/Makefile.am b/src/gallium/targets/osmesa/Makefile.am
index f53823a..2c09736 100644
--- a/src/gallium/targets/osmesa/Makefile.am
+++ b/src/gallium/targets/osmesa/Makefile.am
@@ -76,7 +76,11 @@ lib at OSMESA_LIB@_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllv
 endif
 
 EXTRA_lib at OSMESA_LIB@_la_DEPENDENCIES = osmesa.sym
-EXTRA_DIST = osmesa.sym
+EXTRA_DIST = \
+	osmesa.sym \
+	osmesa.def \
+	osmesa.mingw.def \
+	SConscript
 
 include $(top_srcdir)/install-gallium-links.mk
 
diff --git a/src/gallium/targets/osmesa/SConscript b/src/gallium/targets/osmesa/SConscript
new file mode 100644
index 0000000..4a9115b
--- /dev/null
+++ b/src/gallium/targets/osmesa/SConscript
@@ -0,0 +1,43 @@
+Import('*')
+
+env = env.Clone()
+
+env.Prepend(CPPPATH = [
+    '#src/mapi',
+    '#src/mesa',
+    #Dir('../../../mapi'), # src/mapi build path for python-generated GL API files/headers
+])
+
+env.Prepend(LIBS = [
+    st_osmesa,
+    ws_null,
+    glapi,
+    mesa,
+    gallium,
+    trace,
+    glsl,
+    mesautil,
+    softpipe
+])
+
+env.Append(CPPDEFINES = ['GALLIUM_TRACE', 'GALLIUM_SOFTPIPE'])
+
+sources = ['target.c']
+
+if env['llvm']:
+    env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
+    env.Prepend(LIBS = [llvmpipe])
+
+if env['platform'] == 'windows':
+    if env['gcc'] and env['machine'] != 'x86_64':
+        sources += ['osmesa.mingw.def']
+    else:
+        sources += ['osmesa.def']
+
+gallium_osmesa = env.SharedLibrary(
+    target ='osmesa',
+    source = sources,
+    LIBS = env['LIBS'],
+)
+
+env.Alias('osmesa', gallium_osmesa)
diff --git a/src/gallium/targets/osmesa/osmesa.def b/src/gallium/targets/osmesa/osmesa.def
new file mode 100644
index 0000000..e2a31ab
--- /dev/null
+++ b/src/gallium/targets/osmesa/osmesa.def
@@ -0,0 +1,16 @@
+;DESCRIPTION 'Mesa OSMesa lib for Win32'
+VERSION 4.1
+
+EXPORTS
+	OSMesaCreateContext
+	OSMesaCreateContextExt
+	OSMesaDestroyContext
+	OSMesaMakeCurrent
+	OSMesaGetCurrentContext
+	OSMesaPixelStore
+	OSMesaGetIntegerv
+	OSMesaGetDepthBuffer
+	OSMesaGetColorBuffer
+	OSMesaGetProcAddress
+	OSMesaColorClamp
+	OSMesaPostprocess
diff --git a/src/gallium/targets/osmesa/osmesa.mingw.def b/src/gallium/targets/osmesa/osmesa.mingw.def
new file mode 100644
index 0000000..874ac54
--- /dev/null
+++ b/src/gallium/targets/osmesa/osmesa.mingw.def
@@ -0,0 +1,13 @@
+EXPORTS
+	OSMesaCreateContext = OSMesaCreateContext at 8
+	OSMesaCreateContextExt = OSMesaCreateContextExt at 20
+	OSMesaDestroyContext = OSMesaDestroyContext at 4
+	OSMesaMakeCurrent = OSMesaMakeCurrent at 20
+	OSMesaGetCurrentContext = OSMesaGetCurrentContext at 0
+	OSMesaPixelStore = OSMesaPixelStore at 8
+	OSMesaGetIntegerv = OSMesaGetIntegerv at 8
+	OSMesaGetDepthBuffer = OSMesaGetDepthBuffer at 20
+	OSMesaGetColorBuffer = OSMesaGetColorBuffer at 20
+	OSMesaGetProcAddress = OSMesaGetProcAddress at 4
+	OSMesaColorClamp = OSMesaColorClamp at 4
+	OSMesaPostprocess = OSMesaPostprocess at 12
-- 
1.9.4.msysgit.2



More information about the mesa-dev mailing list