[Mesa-dev] [PATCH] scons: add target gallium-osmesa

Jose Fonseca jfonseca at vmware.com
Wed Apr 8 12:55:11 PDT 2015


Besides the issue Emil mentioned,  one minor request: lets call the 
target just "osmesa".  As we don't plan to have any other "osmesa" target.

Jose

On 08/04/15 18:18, Emil Velikov wrote:
> Hi Olivier
>
> Thanks for the patch !
>
> Adding Jose to the Cc list as I believe he'll have some input on the topic.
>
> On 3 April 2015 at 15:06,  <olivier.pena.80 at gmail.com> wrote:
>> From: Olivier Pena <opena at isagri.fr>
>>
>> ---
>>   src/gallium/SConscript                       |  5 ++++
>>   src/gallium/state_trackers/osmesa/SConscript | 25 +++++++++++++++++
>>   src/gallium/state_trackers/osmesa/osmesa.def | 16 +++++++++++
>>   src/gallium/targets/osmesa/SConscript        | 41 ++++++++++++++++++++++++++++
>>   4 files changed, 87 insertions(+)
>>   create mode 100644 src/gallium/state_trackers/osmesa/SConscript
>>   create mode 100644 src/gallium/state_trackers/osmesa/osmesa.def
>>   create mode 100644 src/gallium/targets/osmesa/SConscript
>>
> Can you add the three new files into the EXTRA_DIST variable in the
> relevant Makefile.am ? This way one we can build scons gallium-osmesa
> from a release tarball :-)
>
>> 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/SConscript b/src/gallium/state_trackers/osmesa/SConscript
>> new file mode 100644
>> index 0000000..fa7c968
>> --- /dev/null
>> +++ b/src/gallium/state_trackers/osmesa/SConscript
>> @@ -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', # https://urldefense.proofpoint.com/v2/url?u=http-3A__msdn2.microsoft.com_en-2Dus_library_6dwk3a1z.aspx&d=AwIBaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=V7sOetAjivzNtMiJzzOh63AXslqGWPwHWPoxHrHKbGs&s=2ddtnvnyotNzbqM7WTXS_y4myuI1d-lxwzZA9RPX34o&e=
>> +])
>> +if not env['gles']:
>> +    # prevent _glapi_* from being declared __declspec(dllimport)
>> +    env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
>> +
> Shouldn't these be used when building for windows only ?
>
>> +st_osmesa = env.ConvenienceLibrary(
>> +    target ='st_osmesa',
>> +    source = env.ParseSourceList('Makefile.sources', 'C_SOURCES'),
>> +)
>> +Export('st_osmesa')
>> diff --git a/src/gallium/state_trackers/osmesa/osmesa.def b/src/gallium/state_trackers/osmesa/osmesa.def
>> new file mode 100644
>> index 0000000..e2a31ab
>> --- /dev/null
>> +++ b/src/gallium/state_trackers/osmesa/osmesa.def
> Can we move this file next to it's only user - i.e. into targets/osmesa/ ?
>
>> @@ -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/SConscript b/src/gallium/targets/osmesa/SConscript
>> new file mode 100644
>> index 0000000..2c936cf
>> --- /dev/null
>> +++ b/src/gallium/targets/osmesa/SConscript
>> @@ -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']
>> +
> Afaict this should be included only if the target is Windows.
>
>> +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]
>> +
> One should include softpipe unconditionally as we can switch between
> llvmpipe and softpipe at runtime.
>
>> +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'])
>> +
> Don't think you need this if block.
>
>> +gallium_osmesa = env.SharedLibrary(
>> +    target ='osmesa',
>> +    source = sources,
>> +        LIBS = drivers + st_osmesa + ws_null + glapi + mesa + gallium + trace + glsl + mesautil + env['LIBS'],
> How about we move this before the SharedLibrary construct and use
> env.Prepend(LIBS =...  like other places in mesa ?
>
> Thanks
> Emil
>



More information about the mesa-dev mailing list