premake4: add option to force dynamic loading of OpenGL and X11

--force_dlopen_opengl and --force_dlopen_x11
This commit is contained in:
Erwin Coumans 2014-08-18 22:19:34 -07:00
parent bf1bd07636
commit d93b27f16c
2 changed files with 22 additions and 8 deletions

View File

@ -14,8 +14,8 @@
configuration {"MacOSX"}
links { "OpenGL.framework"}
configuration {"not Windows", "not MacOSX"}
if os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h") then
links {"GL","GLU"}
if not _OPTIONS["force_dlopen_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")
defines {"GLEW_INIT_OPENGL11_FUNCTIONS=1"}
@ -57,16 +57,17 @@
end
if os.is("Linux") then
configuration{"Linux"}
--if os.isdir("/usr/include") and os.isfile("/usr/include/GL/glew.h") then
-- links {"GLEW"}
-- else
--print("Using static glew and dynamic loading of glx functions")
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
links {"GLEW"}
else
print("Using static glew and dynamic loading of glx functions")
defines { "GLEW_STATIC","GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1"}
includedirs {
projectRootDir .. "btgui/OpenGLWindow/GlewWindows"
}
files { projectRootDir .. "btgui/OpenGLWindow/GlewWindows/glew.c"}
-- end
links {"dl"}
end
end
configuration{}
@ -74,7 +75,7 @@
function initX11()
if os.is("Linux") then
if os.isdir("/usr/include") and os.isfile("/usr/include/X11/X.h") then
if not _OPTIONS["force_dlopen_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

@ -12,6 +12,19 @@
act = _ACTION
end
newoption
{
trigger = "force_dlopen_opengl",
description = "Dynamically load OpenGL (instead of static/dynamic linking)"
}
newoption
{
trigger = "force_dlopen_x11",
description = "Dynamically load OpenGL (instead of static/dynamic linking)"
}
newoption
{
trigger = "midi",