🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.7 KiB

  1. function findOpenGL()
  2. configuration{}
  3. if os.is("Linux") then
  4. return true
  5. end
  6. --assume OpenGL is available on Mac OSX, Windows etc
  7. return true
  8. end
  9. function findOpenGL3()
  10. configuration{}
  11. if os.is("MacOSX") then
  12. local osversion = os.getversion()
  13. --Mac OSX 10.9 and above supports OpenGL 3, below doesn't, so ...
  14. if osversion.majorversion > 10 or (osversion.majorversion == 10 and osversion.minorversion >=9) then
  15. return findOpenGL()
  16. else
  17. return false
  18. end
  19. else
  20. return findOpenGL()
  21. end
  22. end
  23. function initOpenGL()
  24. configuration {}
  25. configuration {"Windows"}
  26. links {"opengl32","glu32"}
  27. configuration {"MacOSX"}
  28. links { "OpenGL.framework"}
  29. configuration {"not Windows", "not MacOSX"}
  30. if os.is("Linux") then
  31. if _OPTIONS["enable_system_opengl"] and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/gl.h")) then
  32. links {"GL"}
  33. else
  34. print("No GL/gl.h found, using dynamic loading of GL using glew")
  35. defines {"GLEW_INIT_OPENGL11_FUNCTIONS=1"}
  36. links {"dl"}
  37. end
  38. end
  39. configuration{}
  40. end
  41. function initGlew()
  42. configuration {}
  43. if os.is("Windows") then
  44. configuration {"Windows"}
  45. defines { "GLEW_STATIC"}
  46. includedirs {
  47. projectRootDir .. "ThirdPartyLibs/Glew"
  48. }
  49. files { projectRootDir .. "ThirdPartyLibs/Glew/glew.c"}
  50. end
  51. if os.is("Linux") then
  52. configuration{"Linux"}
  53. 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
  54. links {"GLEW"}
  55. print ("linking against system GLEW")
  56. else
  57. print("Using static glew and dynamic loading of glx functions")
  58. defines { "GLEW_STATIC","GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1"}
  59. includedirs {
  60. projectRootDir .. "ThirdPartyLibs/Glew"
  61. }
  62. files { projectRootDir .. "ThirdPartyLibs/Glew/glew.c"}
  63. links {"dl"}
  64. end
  65. end
  66. configuration{}
  67. end
  68. function initX11()
  69. if os.is("Linux") then
  70. if _OPTIONS["enable_system_x11"] and (os.isdir("/usr/include") and os.isfile("/usr/include/X11/X.h")) then
  71. links{"X11","pthread"}
  72. else
  73. print("No X11/X.h found, using dynamic loading of X11")
  74. includedirs {
  75. projectRootDir .. "ThirdPartyLibs/optionalX11"
  76. }
  77. defines {"DYNAMIC_LOAD_X11_FUNCTIONS"}
  78. links {"dl","pthread"}
  79. end
  80. end
  81. end