2014-08-22 21:41:21 +00:00
|
|
|
|
2014-05-14 04:52:46 +00:00
|
|
|
function findOpenGL()
|
|
|
|
configuration{}
|
|
|
|
if os.is("Linux") then
|
2014-08-19 04:43:08 +00:00
|
|
|
return true
|
2014-05-14 04:52:46 +00:00
|
|
|
end
|
|
|
|
--assume OpenGL is available on Mac OSX, Windows etc
|
|
|
|
return true
|
|
|
|
end
|
2013-03-11 21:03:27 +00:00
|
|
|
|
2014-08-22 21:41:21 +00:00
|
|
|
function findOpenGL3()
|
|
|
|
configuration{}
|
|
|
|
if os.is("MacOSX") then
|
|
|
|
local osversion = os.getversion()
|
|
|
|
--Mac OSX 10.9 and above supports OpenGL 3, below doesn't, so ...
|
|
|
|
if osversion.majorversion > 10 or (osversion.majorversion == 10 and osversion.minorversion >=9) then
|
|
|
|
return findOpenGL()
|
|
|
|
else
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
else
|
|
|
|
return findOpenGL()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-03-11 21:03:27 +00:00
|
|
|
function initOpenGL()
|
|
|
|
configuration {}
|
|
|
|
configuration {"Windows"}
|
|
|
|
links {"opengl32","glu32"}
|
|
|
|
configuration {"MacOSX"}
|
|
|
|
links { "OpenGL.framework"}
|
|
|
|
configuration {"not Windows", "not MacOSX"}
|
2014-08-20 23:28:16 +00:00
|
|
|
if os.is("Linux") then
|
2016-03-25 04:15:49 +00:00
|
|
|
if _OPTIONS["enable_system_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h")) then
|
2014-08-19 05:19:34 +00:00
|
|
|
links {"GL"}
|
2014-08-19 04:43:08 +00:00
|
|
|
else
|
2018-02-21 03:44:02 +00:00
|
|
|
print("No GL/gl.h found, using dynamic loading of GL using glad")
|
2014-08-19 04:43:08 +00:00
|
|
|
defines {"GLEW_INIT_OPENGL11_FUNCTIONS=1"}
|
|
|
|
links {"dl"}
|
|
|
|
end
|
2014-08-20 23:28:16 +00:00
|
|
|
end
|
2013-03-11 21:03:27 +00:00
|
|
|
configuration{}
|
|
|
|
end
|
|
|
|
|
2020-07-25 01:09:13 +00:00
|
|
|
function initX11()
|
|
|
|
if os.is("Linux") 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")
|
|
|
|
includedirs {
|
|
|
|
projectRootDir .. "examples/ThirdPartyLibs/optionalX11"
|
|
|
|
}
|
|
|
|
defines {"DYNAMIC_LOAD_X11_FUNCTIONS"}
|
|
|
|
links {"dl","pthread"}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-03-11 21:03:27 +00:00
|
|
|
|
2020-07-18 14:40:40 +00:00
|
|
|
function initX11()
|
|
|
|
if os.is("Linux") 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")
|
|
|
|
includedirs {
|
|
|
|
projectRootDir .. "examples/ThirdPartyLibs/optionalX11"
|
|
|
|
}
|
|
|
|
defines {"DYNAMIC_LOAD_X11_FUNCTIONS"}
|
|
|
|
links {"dl","pthread"}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-03-11 21:03:27 +00:00
|
|
|
function initGlew()
|
|
|
|
configuration {}
|
|
|
|
if os.is("Windows") then
|
|
|
|
configuration {"Windows"}
|
|
|
|
defines { "GLEW_STATIC"}
|
|
|
|
includedirs {
|
2018-02-21 03:44:02 +00:00
|
|
|
projectRootDir .. "examples/ThirdPartyLibs/glad"
|
2013-03-11 21:03:27 +00:00
|
|
|
}
|
2018-03-05 22:05:22 +00:00
|
|
|
files { projectRootDir .. "examples/ThirdPartyLibs/glad/gl.c"}
|
2013-03-11 21:03:27 +00:00
|
|
|
end
|
2018-02-21 04:09:12 +00:00
|
|
|
if os.is("MacOSX") then
|
|
|
|
includedirs {
|
|
|
|
projectRootDir .. "examples/ThirdPartyLibs/glad"
|
|
|
|
}
|
2018-03-05 22:05:22 +00:00
|
|
|
files { projectRootDir .. "examples/ThirdPartyLibs/glad/gl.c"}
|
2018-02-21 04:09:12 +00:00
|
|
|
end
|
|
|
|
|
2013-03-11 21:03:27 +00:00
|
|
|
if os.is("Linux") then
|
2014-07-01 20:01:42 +00:00
|
|
|
configuration{"Linux"}
|
2020-07-25 01:09:13 +00:00
|
|
|
initX11()
|
2018-02-22 17:08:10 +00:00
|
|
|
if _OPTIONS["enable_system_glx"] then --# and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/glx.h")) then
|
2020-07-25 01:09:13 +00:00
|
|
|
links{"pthread"}
|
2018-02-22 17:08:10 +00:00
|
|
|
print("Using system GL/glx.h")
|
|
|
|
else
|
|
|
|
print("Using glad_glx")
|
|
|
|
defines { "GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1"}
|
|
|
|
files {
|
2018-03-05 22:05:22 +00:00
|
|
|
projectRootDir .. "examples/ThirdPartyLibs/glad/glx.c"}
|
2018-02-22 17:08:10 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
print("Using glad and dynamic loading of GL functions")
|
|
|
|
defines { "GLEW_STATIC"}
|
2014-07-01 20:01:42 +00:00
|
|
|
includedirs {
|
2018-02-21 03:44:02 +00:00
|
|
|
projectRootDir .. "examples/ThirdPartyLibs/glad"
|
2014-07-01 20:01:42 +00:00
|
|
|
}
|
2018-03-05 22:05:22 +00:00
|
|
|
files { projectRootDir .. "examples/ThirdPartyLibs/glad/gl.c",
|
|
|
|
projectRootDir .. "examples/ThirdPartyLibs/glad/glx.c"}
|
2014-08-19 05:19:34 +00:00
|
|
|
links {"dl"}
|
2014-07-01 20:01:42 +00:00
|
|
|
|
2013-03-11 21:03:27 +00:00
|
|
|
end
|
|
|
|
configuration{}
|
|
|
|
end
|
|
|
|
|
|
|
|
|