premake: disable linking system OpenGL and X11 by default,

use dlopen to dynamically load GL/X11
This commit is contained in:
Erwin Coumans
2016-03-24 21:15:49 -07:00
parent 643cf5ab1d
commit 7d72f23711
2 changed files with 7 additions and 7 deletions

View File

@@ -32,7 +32,7 @@
links { "OpenGL.framework"}
configuration {"not Windows", "not MacOSX"}
if os.is("Linux") then
if not _OPTIONS["force_dlopen_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h")) then
if _OPTIONS["enable_system_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h")) then
links {"GL"}
else
print("No GL/gl.h found, using dynamic loading of GL using glew")
@@ -56,7 +56,7 @@
end
if os.is("Linux") then
configuration{"Linux"}
if not _OPTIONS["force_dlopen_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h") and os.isfile("/usr/include/GL/glew.h")) then
if _OPTIONS["enable_system_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h") and os.isfile("/usr/include/GL/glew.h")) then
links {"GLEW"}
print ("linking against system GLEW")
else
@@ -75,7 +75,7 @@
function initX11()
if os.is("Linux") then
if not _OPTIONS["force_dlopen_x11"] and (os.isdir("/usr/include") and os.isfile("/usr/include/X11/X.h")) then
if _OPTIONS["enable_system_x11"] and (os.isdir("/usr/include") and os.isfile("/usr/include/X11/X.h")) then
links{"X11","pthread"}
else
print("No X11/X.h found, using dynamic loading of X11")

View File

@@ -25,14 +25,14 @@
newoption
{
trigger = "force_dlopen_opengl",
description = "Dynamically load OpenGL (instead of static/dynamic linking)"
trigger = "enable_system_opengl",
description = "Try to link and use the system OpenGL headers version instead of dynamically loading OpenGL (dlopen is default)"
}
newoption
{
trigger = "force_dlopen_x11",
description = "Dynamically load OpenGL (instead of static/dynamic linking)"
trigger = "enable_system_x11",
description = "Try to link and use system X11 headers instead of dynamically loading X11 (dlopen is default)"
}
newoption