genie.lua 6.5 KB

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