genie.lua 6.1 KB

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