genie.lua 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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. if _ACTION == "xcode4" then
  27. platforms {
  28. "Universal",
  29. }
  30. else
  31. platforms {
  32. "x32",
  33. "x64",
  34. -- "Xbox360",
  35. "Native", -- for targets where bitness is not specified
  36. }
  37. end
  38. language "C++"
  39. startproject "example-00-helloworld"
  40. BGFX_DIR = (path.getabsolute("..") .. "/")
  41. local BGFX_BUILD_DIR = (BGFX_DIR .. ".build/")
  42. local BGFX_THIRD_PARTY_DIR = (BGFX_DIR .. "3rdparty/")
  43. BX_DIR = (BGFX_DIR .. "../bx/")
  44. defines {
  45. "BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS=1"
  46. }
  47. dofile (BX_DIR .. "scripts/toolchain.lua")
  48. if not toolchain(BGFX_BUILD_DIR, BGFX_THIRD_PARTY_DIR) then
  49. return -- no action specified
  50. end
  51. function copyLib()
  52. end
  53. if _OPTIONS["with-sdl"] then
  54. if os.is("windows") then
  55. if not os.getenv("SDL2_DIR") then
  56. print("Set SDL2_DIR enviroment variable.")
  57. end
  58. end
  59. end
  60. function exampleProject(_name)
  61. project ("example-" .. _name)
  62. uuid (os.uuid("example-" .. _name))
  63. kind "WindowedApp"
  64. configuration {}
  65. -- don't output debugdir for winphone builds
  66. if "winphone81" ~= _OPTIONS["vs"] then
  67. debugdir (BGFX_DIR .. "examples/runtime/")
  68. end
  69. includedirs {
  70. BX_DIR .. "include",
  71. BGFX_DIR .. "include",
  72. BGFX_DIR .. "3rdparty",
  73. BGFX_DIR .. "examples/common",
  74. }
  75. files {
  76. BGFX_DIR .. "examples/" .. _name .. "/**.cpp",
  77. BGFX_DIR .. "examples/" .. _name .. "/**.h",
  78. }
  79. links {
  80. "bgfx",
  81. "example-common",
  82. }
  83. if _OPTIONS["with-sdl"] then
  84. defines { "ENTRY_CONFIG_USE_SDL=1" }
  85. links { "SDL2" }
  86. configuration { "x32", "windows" }
  87. libdirs { "$(SDL2_DIR)/lib/x86" }
  88. configuration { "x64", "windows" }
  89. libdirs { "$(SDL2_DIR)/lib/x64" }
  90. configuration {}
  91. end
  92. if _OPTIONS["with-ovr"] then
  93. links {
  94. "winmm",
  95. "ws2_32",
  96. }
  97. configuration { "x32" }
  98. libdirs { "$(OVR_DIR)/LibOVR/Lib/Win32/" .. _ACTION }
  99. configuration { "x64" }
  100. libdirs { "$(OVR_DIR)/LibOVR/Lib/x64/" .. _ACTION }
  101. configuration { "x32", "Debug" }
  102. links { "libovrd" }
  103. configuration { "x32", "Release" }
  104. links { "libovr" }
  105. configuration { "x64", "Debug" }
  106. links { "libovr64d" }
  107. configuration { "x64", "Release" }
  108. links { "libovr64" }
  109. configuration {}
  110. end
  111. configuration { "vs*" }
  112. linkoptions {
  113. "/ignore:4199", -- LNK4199: /DELAYLOAD:*.dll ignored; no imports found from *.dll
  114. }
  115. links { -- this is needed only for testing with GLES2/3 on Windows with VS2008
  116. "DelayImp",
  117. }
  118. configuration { "vs201*" }
  119. linkoptions { -- this is needed only for testing with GLES2/3 on Windows with VS201x
  120. "/DELAYLOAD:\"libEGL.dll\"",
  121. "/DELAYLOAD:\"libGLESv2.dll\"",
  122. }
  123. configuration { "mingw*" }
  124. targetextension ".exe"
  125. configuration { "vs20* or mingw*" }
  126. links {
  127. "gdi32",
  128. "psapi",
  129. }
  130. configuration { "winphone8*"}
  131. removelinks {
  132. "DelayImp",
  133. "gdi32",
  134. "psapi"
  135. }
  136. links {
  137. "d3d11",
  138. "dxgi"
  139. }
  140. linkoptions {
  141. "/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
  142. }
  143. -- WinRT targets need their own output directories are build files stomp over each other
  144. targetdir (BGFX_BUILD_DIR .. "arm_" .. _ACTION .. "/bin/" .. _name)
  145. objdir (BGFX_BUILD_DIR .. "arm_" .. _ACTION .. "/obj/" .. _name)
  146. configuration { "mingw-clang" }
  147. kind "ConsoleApp"
  148. configuration { "android*" }
  149. kind "ConsoleApp"
  150. targetextension ".so"
  151. linkoptions {
  152. "-shared",
  153. }
  154. links {
  155. "EGL",
  156. "GLESv2",
  157. }
  158. configuration { "nacl*" }
  159. kind "ConsoleApp"
  160. targetextension ".nexe"
  161. links {
  162. "ppapi",
  163. "ppapi_gles2",
  164. "pthread",
  165. }
  166. configuration { "pnacl" }
  167. kind "ConsoleApp"
  168. targetextension ".pexe"
  169. links {
  170. "ppapi",
  171. "ppapi_gles2",
  172. "pthread",
  173. }
  174. configuration { "asmjs" }
  175. kind "ConsoleApp"
  176. targetextension ".bc"
  177. configuration { "linux-*" }
  178. links {
  179. "X11",
  180. "GL",
  181. "pthread",
  182. }
  183. configuration { "rpi" }
  184. links {
  185. "X11",
  186. "GLESv2",
  187. "EGL",
  188. "bcm_host",
  189. "vcos",
  190. "vchiq_arm",
  191. "pthread",
  192. }
  193. configuration { "osx" }
  194. files {
  195. BGFX_DIR .. "examples/common/**.mm",
  196. }
  197. links {
  198. "Cocoa.framework",
  199. "OpenGL.framework",
  200. }
  201. configuration { "ios*" }
  202. kind "ConsoleApp"
  203. files {
  204. BGFX_DIR .. "examples/common/**.mm",
  205. }
  206. linkoptions {
  207. "-framework CoreFoundation",
  208. "-framework Foundation",
  209. "-framework OpenGLES",
  210. "-framework UIKit",
  211. "-framework QuartzCore",
  212. }
  213. configuration { "xcode4", "ios" }
  214. kind "WindowedApp"
  215. files {
  216. BGFX_DIR .. "examples/runtime/iOS-Info.plist"
  217. }
  218. configuration { "qnx*" }
  219. targetextension ""
  220. links {
  221. "EGL",
  222. "GLESv2",
  223. }
  224. configuration {}
  225. strip()
  226. end
  227. dofile "bgfx.lua"
  228. group "examples"
  229. dofile "example-common.lua"
  230. group "libs"
  231. bgfxProject("", "StaticLib", {})
  232. group "examples"
  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. exampleProject("24-nbody")
  258. if _OPTIONS["with-shared-lib"] then
  259. group "libs"
  260. bgfxProject("-shared-lib", "SharedLib", {})
  261. end
  262. if _OPTIONS["with-tools"] then
  263. group "tools"
  264. dofile "makedisttex.lua"
  265. dofile "shaderc.lua"
  266. dofile "texturec.lua"
  267. dofile "geometryc.lua"
  268. end