genie.lua 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. --
  2. -- Copyright 2010-2015 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-clang" }
  139. kind "ConsoleApp"
  140. configuration { "android*" }
  141. kind "ConsoleApp"
  142. targetextension ".so"
  143. linkoptions {
  144. "-shared",
  145. }
  146. links {
  147. "EGL",
  148. "GLESv2",
  149. }
  150. configuration { "nacl*" }
  151. kind "ConsoleApp"
  152. targetextension ".nexe"
  153. links {
  154. "ppapi",
  155. "ppapi_gles2",
  156. "pthread",
  157. }
  158. configuration { "pnacl" }
  159. kind "ConsoleApp"
  160. targetextension ".pexe"
  161. links {
  162. "ppapi",
  163. "ppapi_gles2",
  164. "pthread",
  165. }
  166. configuration { "asmjs" }
  167. kind "ConsoleApp"
  168. targetextension ".bc"
  169. configuration { "linux-*" }
  170. links {
  171. "X11",
  172. "GL",
  173. "pthread",
  174. }
  175. configuration { "rpi" }
  176. links {
  177. "X11",
  178. "GLESv2",
  179. "EGL",
  180. "bcm_host",
  181. "vcos",
  182. "vchiq_arm",
  183. "pthread",
  184. }
  185. configuration { "osx" }
  186. files {
  187. BGFX_DIR .. "examples/common/**.mm",
  188. }
  189. links {
  190. "Cocoa.framework",
  191. "OpenGL.framework",
  192. }
  193. configuration { "xcode4" }
  194. platforms {
  195. "Universal"
  196. }
  197. files {
  198. BGFX_DIR .. "examples/common/**.mm",
  199. }
  200. links {
  201. "Cocoa.framework",
  202. "Foundation.framework",
  203. "OpenGL.framework",
  204. }
  205. configuration { "ios*" }
  206. kind "ConsoleApp"
  207. files {
  208. BGFX_DIR .. "examples/common/**.mm",
  209. }
  210. linkoptions {
  211. "-framework CoreFoundation",
  212. "-framework Foundation",
  213. "-framework OpenGLES",
  214. "-framework UIKit",
  215. "-framework QuartzCore",
  216. }
  217. configuration { "qnx*" }
  218. targetextension ""
  219. links {
  220. "EGL",
  221. "GLESv2",
  222. }
  223. configuration {}
  224. strip()
  225. end
  226. dofile "bgfx.lua"
  227. group "examples"
  228. dofile "example-common.lua"
  229. group "libs"
  230. bgfxProject("", "StaticLib", {})
  231. group "examples"
  232. exampleProject("00-helloworld")
  233. exampleProject("01-cubes")
  234. exampleProject("02-metaballs")
  235. exampleProject("03-raymarch")
  236. exampleProject("04-mesh")
  237. exampleProject("05-instancing")
  238. exampleProject("06-bump")
  239. exampleProject("07-callback")
  240. exampleProject("08-update")
  241. exampleProject("09-hdr")
  242. exampleProject("10-font")
  243. exampleProject("11-fontsdf")
  244. exampleProject("12-lod")
  245. exampleProject("13-stencil")
  246. exampleProject("14-shadowvolumes")
  247. exampleProject("15-shadowmaps-simple")
  248. exampleProject("16-shadowmaps")
  249. exampleProject("17-drawstress")
  250. exampleProject("18-ibl")
  251. exampleProject("19-oit")
  252. exampleProject("20-nanovg")
  253. exampleProject("21-deferred")
  254. exampleProject("22-windows")
  255. exampleProject("23-vectordisplay")
  256. exampleProject("24-nbody")
  257. if _OPTIONS["with-shared-lib"] then
  258. group "libs"
  259. bgfxProject("-shared-lib", "SharedLib", {})
  260. end
  261. if _OPTIONS["with-tools"] then
  262. group "tools"
  263. dofile "makedisttex.lua"
  264. dofile "shaderc.lua"
  265. dofile "texturec.lua"
  266. dofile "geometryc.lua"
  267. end