genie.lua 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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. if not toolchain(BGFX_BUILD_DIR, BGFX_THIRD_PARTY_DIR) then
  43. return -- no action specified
  44. end
  45. function copyLib()
  46. end
  47. if _OPTIONS["with-sdl"] then
  48. if os.is("windows") then
  49. if not os.getenv("SDL2_DIR") then
  50. print("Set SDL2_DIR enviroment variable.")
  51. end
  52. end
  53. end
  54. function exampleProject(_name)
  55. project ("example-" .. _name)
  56. uuid (os.uuid("example-" .. _name))
  57. kind "WindowedApp"
  58. configuration {}
  59. -- don't output debugdir for winphone builds
  60. if "winphone81" ~= _OPTIONS["vs"] then
  61. debugdir (BGFX_DIR .. "examples/runtime/")
  62. end
  63. includedirs {
  64. BX_DIR .. "include",
  65. BGFX_DIR .. "include",
  66. BGFX_DIR .. "3rdparty",
  67. BGFX_DIR .. "examples/common",
  68. }
  69. files {
  70. BGFX_DIR .. "examples/" .. _name .. "/**.cpp",
  71. BGFX_DIR .. "examples/" .. _name .. "/**.h",
  72. }
  73. links {
  74. "bgfx",
  75. "example-common",
  76. }
  77. if _OPTIONS["with-sdl"] then
  78. defines { "ENTRY_CONFIG_USE_SDL=1" }
  79. links { "SDL2" }
  80. configuration { "x32", "windows" }
  81. libdirs { "$(SDL2_DIR)/lib/x86" }
  82. configuration { "x64", "windows" }
  83. libdirs { "$(SDL2_DIR)/lib/x64" }
  84. configuration {}
  85. end
  86. if _OPTIONS["with-ovr"] then
  87. links {
  88. "winmm",
  89. "ws2_32",
  90. }
  91. configuration { "x32" }
  92. libdirs { "$(OVR_DIR)/LibOVR/Lib/Win32/" .. _ACTION }
  93. configuration { "x64" }
  94. libdirs { "$(OVR_DIR)/LibOVR/Lib/x64/" .. _ACTION }
  95. configuration { "x32", "Debug" }
  96. links { "libovrd" }
  97. configuration { "x32", "Release" }
  98. links { "libovr" }
  99. configuration { "x64", "Debug" }
  100. links { "libovr64d" }
  101. configuration { "x64", "Release" }
  102. links { "libovr64" }
  103. configuration {}
  104. end
  105. configuration { "vs*" }
  106. linkoptions {
  107. "/ignore:4199", -- LNK4199: /DELAYLOAD:*.dll ignored; no imports found from *.dll
  108. }
  109. links { -- this is needed only for testing with GLES2/3 on Windows with VS2008
  110. "DelayImp",
  111. }
  112. configuration { "vs201*" }
  113. linkoptions { -- this is needed only for testing with GLES2/3 on Windows with VS201x
  114. "/DELAYLOAD:\"libEGL.dll\"",
  115. "/DELAYLOAD:\"libGLESv2.dll\"",
  116. }
  117. configuration { "vs20* or mingw*" }
  118. links {
  119. "gdi32",
  120. "psapi",
  121. }
  122. configuration { "winphone8*"}
  123. removelinks {
  124. "DelayImp",
  125. "gdi32",
  126. "psapi"
  127. }
  128. links {
  129. "d3d11",
  130. "dxgi"
  131. }
  132. linkoptions {
  133. "/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata
  134. }
  135. -- WinRT targets need their own output directories are build files stomp over each other
  136. targetdir (BGFX_BUILD_DIR .. "arm_" .. _ACTION .. "/bin/" .. _name)
  137. objdir (BGFX_BUILD_DIR .. "arm_" .. _ACTION .. "/obj/" .. _name)
  138. configuration { "mingw*" }
  139. links {
  140. "dxguid",
  141. }
  142. configuration { "mingw-clang" }
  143. kind "ConsoleApp"
  144. configuration { "android*" }
  145. kind "ConsoleApp"
  146. targetextension ".so"
  147. linkoptions {
  148. "-shared",
  149. }
  150. links {
  151. "EGL",
  152. "GLESv2",
  153. }
  154. configuration { "nacl*" }
  155. kind "ConsoleApp"
  156. targetextension ".nexe"
  157. links {
  158. "ppapi",
  159. "ppapi_gles2",
  160. "pthread",
  161. }
  162. configuration { "pnacl" }
  163. kind "ConsoleApp"
  164. targetextension ".pexe"
  165. links {
  166. "ppapi",
  167. "ppapi_gles2",
  168. "pthread",
  169. }
  170. configuration { "asmjs" }
  171. kind "ConsoleApp"
  172. targetextension ".bc"
  173. configuration { "linux-*" }
  174. links {
  175. "X11",
  176. "GL",
  177. "pthread",
  178. }
  179. configuration { "rpi" }
  180. links {
  181. "X11",
  182. "GLESv2",
  183. "EGL",
  184. "bcm_host",
  185. "vcos",
  186. "vchiq_arm",
  187. "pthread",
  188. }
  189. configuration { "osx" }
  190. files {
  191. BGFX_DIR .. "examples/common/**.mm",
  192. }
  193. links {
  194. "Cocoa.framework",
  195. "OpenGL.framework",
  196. }
  197. configuration { "xcode4" }
  198. platforms {
  199. "Universal"
  200. }
  201. files {
  202. BGFX_DIR .. "examples/common/**.mm",
  203. }
  204. links {
  205. "Cocoa.framework",
  206. "Foundation.framework",
  207. "OpenGL.framework",
  208. }
  209. configuration { "ios*" }
  210. kind "ConsoleApp"
  211. files {
  212. BGFX_DIR .. "examples/common/**.mm",
  213. }
  214. linkoptions {
  215. "-framework CoreFoundation",
  216. "-framework Foundation",
  217. "-framework OpenGLES",
  218. "-framework UIKit",
  219. "-framework QuartzCore",
  220. }
  221. configuration { "qnx*" }
  222. targetextension ""
  223. links {
  224. "EGL",
  225. "GLESv2",
  226. }
  227. configuration {}
  228. strip()
  229. end
  230. dofile "bgfx.lua"
  231. dofile "example-common.lua"
  232. bgfxProject("", "StaticLib", {})
  233. exampleProject("00-helloworld")
  234. exampleProject("01-cubes")
  235. exampleProject("02-metaballs")
  236. exampleProject("03-raymarch")
  237. exampleProject("04-mesh")
  238. exampleProject("05-instancing")
  239. exampleProject("06-bump")
  240. exampleProject("07-callback")
  241. exampleProject("08-update")
  242. exampleProject("09-hdr")
  243. exampleProject("10-font")
  244. exampleProject("11-fontsdf")
  245. exampleProject("12-lod")
  246. exampleProject("13-stencil")
  247. exampleProject("14-shadowvolumes")
  248. exampleProject("15-shadowmaps-simple")
  249. exampleProject("16-shadowmaps")
  250. exampleProject("17-drawstress")
  251. exampleProject("18-ibl")
  252. exampleProject("19-oit")
  253. exampleProject("20-nanovg")
  254. exampleProject("21-deferred")
  255. exampleProject("22-windows")
  256. exampleProject("23-vectordisplay")
  257. if _OPTIONS["with-shared-lib"] then
  258. bgfxProject("-shared-lib", "SharedLib", {})
  259. end
  260. if _OPTIONS["with-tools"] then
  261. dofile "makedisttex.lua"
  262. dofile "shaderc.lua"
  263. dofile "texturec.lua"
  264. dofile "geometryc.lua"
  265. end