-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathfindOpenGLGlewGlut.lua
90 lines (81 loc) · 2.68 KB
/
findOpenGLGlewGlut.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
function findOpenGL()
configuration{}
if os.is("Linux") then
return true
end
--assume OpenGL is available on Mac OSX, Windows etc
return true
end
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
function initOpenGL()
configuration {}
configuration {"Windows"}
links {"opengl32","glu32"}
configuration {"MacOSX"}
links { "OpenGL.framework"}
configuration {"not Windows", "not MacOSX"}
if os.is("Linux") 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")
defines {"GLEW_INIT_OPENGL11_FUNCTIONS=1"}
links {"dl"}
end
end
configuration{}
end
function initGlew()
configuration {}
if os.is("Windows") then
configuration {"Windows"}
defines { "GLEW_STATIC"}
includedirs {
projectRootDir .. "ThirdPartyLibs/Glew"
}
files { projectRootDir .. "ThirdPartyLibs/Glew/glew.c"}
end
if os.is("Linux") then
configuration{"Linux"}
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
print("Using static glew and dynamic loading of glx functions")
defines { "GLEW_STATIC","GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1"}
includedirs {
projectRootDir .. "ThirdPartyLibs/Glew"
}
files { projectRootDir .. "ThirdPartyLibs/Glew/glew.c"}
links {"dl"}
end
end
configuration{}
end
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 .. "ThirdPartyLibs/optionalX11"
}
defines {"DYNAMIC_LOAD_X11_FUNCTIONS"}
links {"dl","pthread"}
end
end
end