]> git.tdb.fi Git - libs/gl.git/commitdiff
Guard against missing extensions on OS X
authorMikko Rasa <tdb@tdb.fi>
Fri, 6 Jan 2017 11:48:17 +0000 (13:48 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 6 Jan 2017 12:35:01 +0000 (14:35 +0200)
Symbols are linked directly so the definitions must be present in the
system OpenGL library at compile time.

scripts/extgen.py

index 8d7bfcb1ec1e91c663b33b8aaeec2115b340e05f..b3319e5937d401c2b5ed08e5cd645a041e2a03b3 100755 (executable)
@@ -518,6 +518,7 @@ for f in funcs:
 out.write("\nExtension::SupportLevel init_%s()\n{\n"%target_ext.name.lower())
 if core_version:
        out.write("\tif(is_disabled(\"GL_%s\"))\n\t\treturn Extension::UNSUPPORTED;\n"%target_ext.name)
+       out.write("#if !defined(__APPLE__) || defined(GL_VERSION_%d_%d)\n"%tuple(core_version))
        out.write("\tif(")
        if backport_ext:
                out.write("is_supported(\"GL_%s\") || "%backport_ext.name)
@@ -533,7 +534,9 @@ if core_version:
                        out.write("\t\t%s = reinterpret_cast<%s>(GET_PROC_ADDRESS%s(%s));\n"%(f.name, f.typedef, gpa_suffix, f.name))
        out.write("\t\treturn Extension::CORE;\n")
        out.write("\t}\n")
+       out.write("#endif\n")
 if source_ext and source_ext!=backport_ext:
+       out.write("#if !defined(__APPLE__) || defined(GL_%s)\n"%target_ext.name)
        out.write("\tif(is_supported(\"GL_%s\"))\n\t{\n"%(source_ext.name))
        for f in funcs:
                if f.sources:
@@ -553,6 +556,7 @@ if source_ext and source_ext!=backport_ext:
                        out.write("\t\t%s = reinterpret_cast<%s>(GET_PROC_ADDRESS(%s));\n"%(f.name, f.typedef, src.name))
        out.write("\t\treturn Extension::EXTENSION;\n")
        out.write("\t}\n")
+       out.write("#endif\n")
 out.write("\treturn Extension::UNSUPPORTED;\n")
 out.write("}\n")