genie.lua 5.9 KB

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