genie.lua 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. --
  2. -- Copyright 2010-2014 Branimir Karadzic. All rights reserved.
  3. -- License: http://www.opensource.org/licenses/BSD-2-Clause
  4. --
  5. newoption {
  6. trigger = "with-tools",
  7. description = "Enable building tools.",
  8. }
  9. newoption {
  10. trigger = "with-shared-lib",
  11. description = "Enable building shared library.",
  12. }
  13. newoption {
  14. trigger = "with-sdl",
  15. description = "Enable SDL entry.",
  16. }
  17. newoption {
  18. trigger = "with-ovr",
  19. description = "Enable OculusVR integration.",
  20. }
  21. solution "bgfx"
  22. configurations {
  23. "Debug",
  24. "Release",
  25. }
  26. platforms {
  27. "x32",
  28. "x64",
  29. -- "Xbox360",
  30. "Native", -- for targets where bitness is not specified
  31. }
  32. language "C++"
  33. startproject "example-00-helloworld"
  34. BGFX_DIR = (path.getabsolute("..") .. "/")
  35. local BGFX_BUILD_DIR = (BGFX_DIR .. ".build/")
  36. local BGFX_THIRD_PARTY_DIR = (BGFX_DIR .. "3rdparty/")
  37. BX_DIR = (BGFX_DIR .. "../bx/")
  38. defines {
  39. "BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS=1"
  40. }
  41. dofile (BX_DIR .. "scripts/toolchain.lua")
  42. toolchain(BGFX_BUILD_DIR, BGFX_THIRD_PARTY_DIR)
  43. function copyLib()
  44. end
  45. if _OPTIONS["with-sdl"] then
  46. if os.is("windows") then
  47. if not os.getenv("SDL2_DIR") then
  48. print("Set SDL2_DIR enviroment variable.")
  49. end
  50. end
  51. end
  52. function exampleProject(_name)
  53. project ("example-" .. _name)
  54. uuid (os.uuid("example-" .. _name))
  55. kind "WindowedApp"
  56. configuration {}
  57. debugdir (BGFX_DIR .. "examples/runtime/")
  58. includedirs {
  59. BX_DIR .. "include",
  60. BGFX_DIR .. "include",
  61. BGFX_DIR .. "3rdparty",
  62. BGFX_DIR .. "examples/common",
  63. }
  64. files {
  65. BGFX_DIR .. "examples/" .. _name .. "/**.cpp",
  66. BGFX_DIR .. "examples/" .. _name .. "/**.h",
  67. }
  68. links {
  69. "bgfx",
  70. "example-common",
  71. }
  72. if _OPTIONS["with-sdl"] then
  73. defines { "ENTRY_CONFIG_USE_SDL=1" }
  74. links { "SDL2" }
  75. configuration { "x32", "windows" }
  76. libdirs { "$(SDL2_DIR)/lib/x86" }
  77. configuration { "x64", "windows" }
  78. libdirs { "$(SDL2_DIR)/lib/x64" }
  79. configuration {}
  80. end
  81. if _OPTIONS["with-ovr"] then
  82. links {
  83. "winmm",
  84. "ws2_32",
  85. }
  86. configuration { "x32" }
  87. libdirs { "$(OVR_DIR)/LibOVR/Lib/Win32/" .. _ACTION }
  88. configuration { "x64" }
  89. libdirs { "$(OVR_DIR)/LibOVR/Lib/x64/" .. _ACTION }
  90. configuration { "x32", "Debug" }
  91. links { "libovrd" }
  92. configuration { "x32", "Release" }
  93. links { "libovr" }
  94. configuration { "x64", "Debug" }
  95. links { "libovr64d" }
  96. configuration { "x64", "Release" }
  97. links { "libovr64" }
  98. configuration {}
  99. end
  100. configuration { "vs*" }
  101. linkoptions {
  102. "/ignore:4199", -- LNK4199: /DELAYLOAD:*.dll ignored; no imports found from *.dll
  103. }
  104. links { -- this is needed only for testing with GLES2/3 on Windows with VS2008
  105. "DelayImp",
  106. }
  107. configuration { "vs201*" }
  108. linkoptions { -- this is needed only for testing with GLES2/3 on Windows with VS201x
  109. "/DELAYLOAD:\"libEGL.dll\"",
  110. "/DELAYLOAD:\"libGLESv2.dll\"",
  111. }
  112. configuration { "vs20* or mingw*" }
  113. links {
  114. "gdi32",
  115. "psapi",
  116. }
  117. configuration { "mingw*" }
  118. links {
  119. "dxguid",
  120. }
  121. configuration { "mingw-clang" }
  122. kind "ConsoleApp"
  123. configuration { "android*" }
  124. kind "ConsoleApp"
  125. targetextension ".so"
  126. linkoptions {
  127. "-shared",
  128. }
  129. links {
  130. "EGL",
  131. "GLESv2",
  132. }
  133. configuration { "nacl*" }
  134. kind "ConsoleApp"
  135. targetextension ".nexe"
  136. links {
  137. "ppapi",
  138. "ppapi_gles2",
  139. "pthread",
  140. }
  141. configuration { "pnacl" }
  142. kind "ConsoleApp"
  143. targetextension ".pexe"
  144. links {
  145. "ppapi",
  146. "ppapi_gles2",
  147. "pthread",
  148. }
  149. configuration { "asmjs" }
  150. kind "ConsoleApp"
  151. targetextension ".bc"
  152. configuration { "linux-*" }
  153. links {
  154. "X11",
  155. "GL",
  156. "pthread",
  157. }
  158. configuration { "rpi" }
  159. links {
  160. "X11",
  161. "GLESv2",
  162. "EGL",
  163. "bcm_host",
  164. "vcos",
  165. "vchiq_arm",
  166. "pthread",
  167. }
  168. configuration { "osx" }
  169. files {
  170. BGFX_DIR .. "examples/common/**.mm",
  171. }
  172. links {
  173. "Cocoa.framework",
  174. "OpenGL.framework",
  175. }
  176. configuration { "xcode4" }
  177. platforms {
  178. "Universal"
  179. }
  180. files {
  181. BGFX_DIR .. "examples/common/**.mm",
  182. }
  183. links {
  184. "Cocoa.framework",
  185. "Foundation.framework",
  186. "OpenGL.framework",
  187. }
  188. configuration { "ios*" }
  189. kind "ConsoleApp"
  190. files {
  191. BGFX_DIR .. "examples/common/**.mm",
  192. }
  193. linkoptions {
  194. "-framework CoreFoundation",
  195. "-framework Foundation",
  196. "-framework OpenGLES",
  197. "-framework UIKit",
  198. "-framework QuartzCore",
  199. }
  200. configuration { "qnx*" }
  201. targetextension ""
  202. links {
  203. "EGL",
  204. "GLESv2",
  205. }
  206. configuration {}
  207. strip()
  208. end
  209. dofile "bgfx.lua"
  210. dofile "example-common.lua"
  211. bgfxProject("", "StaticLib", {})
  212. exampleProject("00-helloworld")
  213. exampleProject("01-cubes")
  214. exampleProject("02-metaballs")
  215. exampleProject("03-raymarch")
  216. exampleProject("04-mesh")
  217. exampleProject("05-instancing")
  218. exampleProject("06-bump")
  219. exampleProject("07-callback")
  220. exampleProject("08-update")
  221. exampleProject("09-hdr")
  222. exampleProject("10-font")
  223. exampleProject("11-fontsdf")
  224. exampleProject("12-lod")
  225. exampleProject("13-stencil")
  226. exampleProject("14-shadowvolumes")
  227. exampleProject("15-shadowmaps-simple")
  228. exampleProject("16-shadowmaps")
  229. exampleProject("17-drawstress")
  230. exampleProject("18-ibl")
  231. exampleProject("19-oit")
  232. exampleProject("20-nanovg")
  233. exampleProject("21-deferred")
  234. exampleProject("22-windows")
  235. if _OPTIONS["with-shared-lib"] then
  236. bgfxProject("-shared-lib", "SharedLib", {})
  237. end
  238. if _OPTIONS["with-tools"] then
  239. dofile "makedisttex.lua"
  240. dofile "shaderc.lua"
  241. dofile "texturec.lua"
  242. dofile "geometryc.lua"
  243. end