glapi: Force frame pointer elimination on Windows.
[mesa.git] / src / mapi / glapi / SConscript
index 9882806ce6072f1a21cb0460a9e49442a6f7882e..97ebfe638aeca58afc269ff703e3570242c9e6de 100644 (file)
@@ -2,6 +2,8 @@
 # SConscript for glapi
 
 
+from sys import executable as python_cmd
+
 Import('*')
 
 env = env.Clone()
@@ -14,6 +16,7 @@ if env['platform'] == 'windows':
     env.Append(CPPDEFINES = [
         '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
         'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
+        'KHRONOS_DLL_EXPORTS', # declare gl* as __declspec(dllexport) in Khronos headers
     ])
     if env['gles']:
         env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS'])
@@ -24,6 +27,7 @@ if env['platform'] == 'windows':
 env.Append(CPPPATH = [
     '#/src/mapi',
     '#/src/mesa',
+    Dir('..'), # src/mapi build path
 ])
 
 glapi_sources = [
@@ -31,7 +35,6 @@ glapi_sources = [
     'glapi_entrypoint.c',
     'glapi_getproc.c',
     'glapi_nop.c',
-    'glthread.c',
     'glapi.c',
 ]
 
@@ -40,13 +43,17 @@ mapi_sources = [
     'u_execmem.c',
 ]
 for s in mapi_sources:
-    o = env.SharedObject(s[:-2], '../mapi/' + s)
+    o = env.SharedObject(s[:-2], '../' + s)
     glapi_sources.append(o)
 
 #
 # Assembly sources
 #
-if env['gcc'] and env['platform'] != 'windows':
+if (env['gcc'] or env['clang']) and \
+   env['platform'] not in ('cygwin', 'darwin', 'windows'):
+    GLAPI = '#src/mapi/glapi/'
+    sources = [GLAPI + 'gen/gl_and_es_API.xml'] + env.Glob(GLAPI + 'gen/*.xml')
+
     if env['machine'] == 'x86':
         env.Append(CPPDEFINES = [
             'USE_X86_ASM',
@@ -54,6 +61,12 @@ if env['gcc'] and env['platform'] != 'windows':
         glapi_sources += [
             'glapi_x86.S',
         ]
+        env.CodeGenerate(
+            target = 'glapi_x86.S',
+            script = GLAPI + 'gen/gl_x86_asm.py',
+            source = sources,
+            command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
+            )
     elif env['machine'] == 'x86_64':
         env.Append(CPPDEFINES = [
             'USE_X86_64_ASM',
@@ -61,6 +74,12 @@ if env['gcc'] and env['platform'] != 'windows':
         glapi_sources += [
             'glapi_x86-64.S'
         ]
+        env.CodeGenerate(
+            target = 'glapi_x86-64.S',
+            script = GLAPI + 'gen/gl_x86-64_asm.py',
+            source = sources,
+            command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
+            )
     elif env['machine'] == 'sparc':
         env.Append(CPPDEFINES = [
             'USE_SPARC_ASM',
@@ -68,14 +87,15 @@ if env['gcc'] and env['platform'] != 'windows':
         glapi_sources += [
             'glapi_sparc.S'
         ]
+        env.CodeGenerate(
+            target = 'glapi_sparc.S',
+            script = GLAPI + 'gen/gl_SPARC_asm.py',
+            source = sources,
+            command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
+            )
     else:
         pass
 
-if env['toolchain'] == 'crossmingw':
-    # compile these files without -gstabs option
-    glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_dispatch.c")
-    glapi_sources = env.compile_without_gstabs(glapi_sources, "glapi_getproc.c")
-
 glapi = env.ConvenienceLibrary(
     target = 'glapi',
     source = glapi_sources,