genie.lua 4.7 KB

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