osmesa with gallium on windows platform
Olivier PENA <[email protected]>
| Newsgroups | gmane.comp.video.mesa3d.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, I successfully build osmesa with the new gallium state tracker on windows by adding a new target (gallium-osmesa) in the scons build system. Both llvmpipe and softpipe works. Since scons is totally stranger to me and I don't know a lot about mesa internals, it would be nice if someone could review and correct the attached patch. It would be great if we could build gallium osmesa with scons directly from upstream. Thanks >>>>-------------------------------------------------------------<<<< Ce message a été traité contre les virus par quatre outils différents (Kaspersky, McAfee, Symantec et ThreatSeeker). This message has been scanned for viruses (by Kaspersky, McAfee, Symantec and ThreatSeeker). >>>>-------------------------------------------------------------<<<< _______________________________________________ mesa-users mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-users
gallium-osmesa.patch
(application/octet-stream, 3.7 KB)
diff -ruN -x '*.pyc' mesa-10.2.6.old/src/gallium/SConscript mesa-10.2.6/src/gallium/SConscript
--- mesa-10.2.6.old/src/gallium/SConscript 2014-08-19 20:57:56 +0000
+++ mesa-10.2.6/src/gallium/SConscript 2014-09-16 11:05:42 +0000
@@ -47,7 +47,8 @@
if env['platform'] == 'windows':
SConscript('state_trackers/wgl/SConscript')
-
+
+ SConscript('state_trackers/osmesa/SConscript')
#
# Winsys
#
@@ -98,6 +99,10 @@
'targets/graw-null/SConscript',
])
+SConscript([
+ 'targets/osmesa/SConscript',
+])
+
if not env['embedded']:
if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'sunos'):
SConscript([
diff -ruN -x '*.pyc' mesa-10.2.6.old/src/gallium/state_trackers/osmesa/SConscript mesa-10.2.6/src/gallium/state_trackers/osmesa/SConscript
--- mesa-10.2.6.old/src/gallium/state_trackers/osmesa/SConscript 1970-01-01 00:00:00 +0000
+++ mesa-10.2.6/src/gallium/state_trackers/osmesa/SConscript 2014-09-16 11:16:47 +0000
@@ -0,0 +1,25 @@
+import os
+
+Import('*')
+
+env = env.Clone()
+
+env.Append(CPPPATH = [
+ '#src/mapi',
+ '#src/mesa',
+ '.',
+])
+
+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 -ruN -x '*.pyc' mesa-10.2.6.old/src/gallium/state_trackers/osmesa/osmesa.def mesa-10.2.6/src/gallium/state_trackers/osmesa/osmesa.def
--- mesa-10.2.6.old/src/gallium/state_trackers/osmesa/osmesa.def 1970-01-01 00:00:00 +0000
+++ mesa-10.2.6/src/gallium/state_trackers/osmesa/osmesa.def 2014-09-16 11:58:04 +0000
@@ -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 -ruN -x '*.pyc' mesa-10.2.6.old/src/gallium/targets/osmesa/SConscript mesa-10.2.6/src/gallium/targets/osmesa/SConscript
--- mesa-10.2.6.old/src/gallium/targets/osmesa/SConscript 1970-01-01 00:00:00 +0000
+++ mesa-10.2.6/src/gallium/targets/osmesa/SConscript 2014-09-16 11:56:19 +0000
@@ -0,0 +1,41 @@
+Import('*')
+
+env = env.Clone()
+
+env.Prepend(CPPPATH = [
+ '#src/mapi',
+ '#src/mesa',
+ #Dir('../../../mapi'), # src/mapi build path for python-generated GL API files/headers
+])
+
+sources = [
+ 'target.c',
+]
+sources += ['#src/gallium/state_trackers/osmesa/osmesa.def']
+
+drivers = []
+
+if env['llvm']:
+ env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
+ env.Append(CPPDEFINES = 'GALLIUM_TRACE')
+ drivers += [llvmpipe]
+else:
+ env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
+ env.Append(CPPDEFINES = 'GALLIUM_TRACE')
+ drivers += [softpipe]
+
+if env['platform'] == 'windows':
+ env.AppendUnique(CPPDEFINES = [
+ 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
+ ])
+ if not env['gles']:
+ # prevent _glapi_* from being declared __declspec(dllimport)
+ env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
+
+gallium_osmesa = env.SharedLibrary(
+ target ='osmesa',
+ source = sources,
+ LIBS = drivers + st_osmesa + ws_null + glapi + mesa + gallium + trace + glsl + env['LIBS'],
+)
+
+env.Alias('gallium-osmesa', gallium_osmesa)