genie.lua 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. --
  2. -- Copyright 2010-2014 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. solution "bgfx"
  18. configurations {
  19. "Debug",
  20. "Release",
  21. }
  22. platforms {
  23. "x32",
  24. "x64",
  25. -- "Xbox360",
  26. "Native", -- for targets where bitness is not specified
  27. }
  28. language "C++"
  29. startproject "example-00-helloworld"
  30. BGFX_DIR = (path.getabsolute("..") .. "/")
  31. local BGFX_BUILD_DIR = (BGFX_DIR .. ".build/")
  32. local BGFX_THIRD_PARTY_DIR = (BGFX_DIR .. "3rdparty/")
  33. BX_DIR = (BGFX_DIR .. "../bx/")
  34. defines {
  35. "BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS=1"
  36. }
  37. dofile (BX_DIR .. "scripts/toolchain.lua")
  38. toolchain(BGFX_BUILD_DIR, BGFX_THIRD_PARTY_DIR)
  39. function copyLib()
  40. end
  41. function exampleProject(_name)
  42. project ("example-" .. _name)
  43. uuid (os.uuid("example-" .. _name))
  44. kind "WindowedApp"
  45. configuration {}
  46. debugdir (BGFX_DIR .. "examples/runtime/")
  47. includedirs {
  48. BX_DIR .. "include",
  49. BGFX_DIR .. "include",
  50. BGFX_DIR .. "3rdparty",
  51. BGFX_DIR .. "examples/common",
  52. }
  53. files {
  54. BGFX_DIR .. "examples/" .. _name .. "/**.cpp",
  55. BGFX_DIR .. "examples/" .. _name .. "/**.h",
  56. }
  57. links {
  58. "bgfx",
  59. "example-common",
  60. }
  61. if _OPTIONS["with-sdl"] then
  62. defines { "ENTRY_CONFIG_USE_SDL=1" }
  63. links { "SDL2" }
  64. configuration { "x32", "windows" }
  65. libdirs { "$(SDL2_DIR)/lib/x86" }
  66. configuration { "x64", "windows" }
  67. libdirs { "$(SDL2_DIR)/lib/x64" }
  68. configuration {}
  69. end
  70. configuration { "vs*" }
  71. linkoptions {
  72. "/ignore:4199", -- LNK4199: /DELAYLOAD:*.dll ignored; no imports found from *.dll
  73. }
  74. links { -- this is needed only for testing with GLES2/3 on Windows with VS2008
  75. "DelayImp",
  76. }
  77. configuration { "vs201*" }
  78. linkoptions { -- this is needed only for testing with GLES2/3 on Windows with VS201x
  79. "/DELAYLOAD:\"libEGL.dll\"",
  80. "/DELAYLOAD:\"libGLESv2.dll\"",
  81. }
  82. configuration { "android*" }
  83. kind "ConsoleApp"
  84. targetextension ".so"
  85. linkoptions {
  86. "-shared",
  87. }
  88. links {
  89. "EGL",
  90. "GLESv2",
  91. }
  92. configuration { "nacl or nacl-arm" }
  93. kind "ConsoleApp"
  94. targetextension ".nexe"
  95. links {
  96. "ppapi",
  97. "ppapi_gles2",
  98. "pthread",
  99. }
  100. configuration { "pnacl" }
  101. kind "ConsoleApp"
  102. targetextension ".pexe"
  103. links {
  104. "ppapi",
  105. "ppapi_gles2",
  106. "pthread",
  107. }
  108. configuration { "asmjs" }
  109. kind "ConsoleApp"
  110. targetextension ".bc"
  111. configuration { "linux-*" }
  112. links {
  113. "X11",
  114. "GL",
  115. "pthread",
  116. }
  117. configuration { "rpi" }
  118. links {
  119. "X11",
  120. "GLESv2",
  121. "EGL",
  122. "bcm_host",
  123. "vcos",
  124. "vchiq_arm",
  125. "pthread",
  126. }
  127. configuration { "osx" }
  128. files {
  129. BGFX_DIR .. "examples/common/**.mm",
  130. }
  131. links {
  132. "Cocoa.framework",
  133. "OpenGL.framework",
  134. }
  135. configuration { "xcode4" }
  136. platforms {
  137. "Universal"
  138. }
  139. files {
  140. BGFX_DIR .. "examples/common/**.mm",
  141. }
  142. links {
  143. "Cocoa.framework",
  144. "Foundation.framework",
  145. "OpenGL.framework",
  146. }
  147. configuration { "ios*" }
  148. kind "ConsoleApp"
  149. files {
  150. BGFX_DIR .. "examples/common/**.mm",
  151. }
  152. linkoptions {
  153. "-framework CoreFoundation",
  154. "-framework Foundation",
  155. "-framework OpenGLES",
  156. "-framework UIKit",
  157. "-framework QuartzCore",
  158. }
  159. configuration { "qnx*" }
  160. targetextension ""
  161. links {
  162. "EGL",
  163. "GLESv2",
  164. }
  165. configuration {}
  166. strip()
  167. end
  168. dofile "bgfx.lua"
  169. dofile "example-common.lua"
  170. bgfxProject("", "StaticLib", {})
  171. exampleProject("00-helloworld")
  172. exampleProject("01-cubes")
  173. exampleProject("02-metaballs")
  174. exampleProject("03-raymarch")
  175. exampleProject("04-mesh")
  176. exampleProject("05-instancing")
  177. exampleProject("06-bump")
  178. exampleProject("07-callback")
  179. exampleProject("08-update")
  180. exampleProject("09-hdr")
  181. exampleProject("10-font")
  182. exampleProject("11-fontsdf")
  183. exampleProject("12-lod")
  184. exampleProject("13-stencil")
  185. exampleProject("14-shadowvolumes")
  186. exampleProject("15-shadowmaps-simple")
  187. exampleProject("16-shadowmaps")
  188. exampleProject("17-drawstress")
  189. exampleProject("18-ibl")
  190. exampleProject("19-oit")
  191. exampleProject("20-nanovg")
  192. exampleProject("21-deferred")
  193. exampleProject("22-windows")
  194. if _OPTIONS["with-shared-lib"] then
  195. bgfxProject("-shared-lib", "SharedLib", {})
  196. end
  197. if _OPTIONS["with-tools"] then
  198. dofile "makedisttex.lua"
  199. dofile "shaderc.lua"
  200. dofile "texturec.lua"
  201. dofile "geometryc.lua"
  202. end