genie.lua 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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 = path.join(BGFX_DIR, ".build")
  42. local BGFX_THIRD_PARTY_DIR = path.join(BGFX_DIR, "3rdparty")
  43. BX_DIR = path.getabsolute(path.join(BGFX_DIR, "../bx"))
  44. defines {
  45. "BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS=1"
  46. }
  47. dofile (path.join(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 (path.join(BGFX_DIR, "examples/runtime"))
  68. end
  69. includedirs {
  70. path.join(BX_DIR, "include"),
  71. path.join(BGFX_DIR, "include"),
  72. path.join(BGFX_DIR, "3rdparty"),
  73. path.join(BGFX_DIR, "examples/common"),
  74. }
  75. files {
  76. path.join(BGFX_DIR, "examples", _name, "**.c"),
  77. path.join(BGFX_DIR, "examples", _name, "**.cpp"),
  78. path.join(BGFX_DIR, "examples", _name, "**.h"),
  79. }
  80. links {
  81. "bgfx",
  82. "example-common",
  83. }
  84. if _OPTIONS["with-sdl"] then
  85. defines { "ENTRY_CONFIG_USE_SDL=1" }
  86. links { "SDL2" }
  87. configuration { "x32", "windows" }
  88. libdirs { "$(SDL2_DIR)/lib/x86" }
  89. configuration { "x64", "windows" }
  90. libdirs { "$(SDL2_DIR)/lib/x64" }
  91. configuration {}
  92. end
  93. if _OPTIONS["with-ovr"] then
  94. links {
  95. "winmm",
  96. "ws2_32",
  97. }
  98. configuration { "x32" }
  99. libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Win32", _ACTION) }
  100. configuration { "x64" }
  101. libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/x64", _ACTION) }
  102. configuration { "x32", "Debug" }
  103. links { "libovrd" }
  104. configuration { "x32", "Release" }
  105. links { "libovr" }
  106. configuration { "x64", "Debug" }
  107. links { "libovr64d" }
  108. configuration { "x64", "Release" }
  109. links { "libovr64" }
  110. configuration {}
  111. end
  112. configuration { "vs*" }
  113. linkoptions {
  114. "/ignore:4199", -- LNK4199: /DELAYLOAD:*.dll ignored; no imports found from *.dll
  115. }
  116. links { -- this is needed only for testing with GLES2/3 on Windows with VS2008
  117. "DelayImp",
  118. }
  119. configuration { "vs201*" }
  120. linkoptions { -- this is needed only for testing with GLES2/3 on Windows with VS201x
  121. "/DELAYLOAD:\"libEGL.dll\"",
  122. "/DELAYLOAD:\"libGLESv2.dll\"",
  123. }
  124. configuration { "mingw*" }
  125. targetextension ".exe"
  126. configuration { "vs20* or mingw*" }
  127. links {
  128. "gdi32",
  129. "psapi",
  130. }
  131. configuration { "winphone8*"}
  132. removelinks {
  133. "DelayImp",
  134. "gdi32",
  135. "psapi"
  136. }
  137. links {
  138. "d3d11",
  139. "dxgi"
  140. }
  141. linkoptions {
  142. "/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
  143. }
  144. -- WinRT targets need their own output directories are build files stomp over each other
  145. targetdir (path.join(BGFX_BUILD_DIR, "arm_" .. _ACTION, "bin", _name))
  146. objdir (path.join(BGFX_BUILD_DIR, "arm_" .. _ACTION, "obj", _name))
  147. configuration { "mingw-clang" }
  148. kind "ConsoleApp"
  149. configuration { "android*" }
  150. kind "ConsoleApp"
  151. targetextension ".so"
  152. linkoptions {
  153. "-shared",
  154. }
  155. links {
  156. "EGL",
  157. "GLESv2",
  158. }
  159. configuration { "nacl*" }
  160. kind "ConsoleApp"
  161. targetextension ".nexe"
  162. links {
  163. "ppapi",
  164. "ppapi_gles2",
  165. "pthread",
  166. }
  167. configuration { "pnacl" }
  168. kind "ConsoleApp"
  169. targetextension ".pexe"
  170. links {
  171. "ppapi",
  172. "ppapi_gles2",
  173. "pthread",
  174. }
  175. configuration { "asmjs" }
  176. kind "ConsoleApp"
  177. targetextension ".bc"
  178. configuration { "linux-*" }
  179. links {
  180. "X11",
  181. "GL",
  182. "pthread",
  183. }
  184. configuration { "rpi" }
  185. links {
  186. "X11",
  187. "GLESv2",
  188. "EGL",
  189. "bcm_host",
  190. "vcos",
  191. "vchiq_arm",
  192. "pthread",
  193. }
  194. configuration { "osx" }
  195. files {
  196. path.join(BGFX_DIR, "examples/common/**.mm"),
  197. }
  198. links {
  199. "Cocoa.framework",
  200. "OpenGL.framework",
  201. }
  202. configuration { "ios*" }
  203. kind "ConsoleApp"
  204. files {
  205. path.join(BGFX_DIR, "examples/common/**.mm"),
  206. }
  207. linkoptions {
  208. "-framework CoreFoundation",
  209. "-framework Foundation",
  210. "-framework OpenGLES",
  211. "-framework UIKit",
  212. "-framework QuartzCore",
  213. }
  214. configuration { "xcode4", "ios" }
  215. kind "WindowedApp"
  216. files {
  217. path.join(BGFX_DIR, "examples/runtime/iOS-Info.plist"),
  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. exampleProject("25-c99")
  260. if _OPTIONS["with-shared-lib"] then
  261. group "libs"
  262. bgfxProject("-shared-lib", "SharedLib", {})
  263. end
  264. if _OPTIONS["with-tools"] then
  265. group "tools"
  266. dofile "makedisttex.lua"
  267. dofile "shaderc.lua"
  268. dofile "texturec.lua"
  269. dofile "geometryc.lua"
  270. end