genie.lua 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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 { "vs20* or mingw*" }
  90. links {
  91. "gdi32",
  92. "psapi",
  93. }
  94. configuration { "mingw*" }
  95. links {
  96. "dxguid",
  97. }
  98. configuration { "mingw-clang" }
  99. kind "ConsoleApp"
  100. configuration { "android*" }
  101. kind "ConsoleApp"
  102. targetextension ".so"
  103. linkoptions {
  104. "-shared",
  105. }
  106. links {
  107. "EGL",
  108. "GLESv2",
  109. }
  110. configuration { "nacl or nacl-arm" }
  111. kind "ConsoleApp"
  112. targetextension ".nexe"
  113. links {
  114. "ppapi",
  115. "ppapi_gles2",
  116. "pthread",
  117. }
  118. configuration { "pnacl" }
  119. kind "ConsoleApp"
  120. targetextension ".pexe"
  121. links {
  122. "ppapi",
  123. "ppapi_gles2",
  124. "pthread",
  125. }
  126. configuration { "asmjs" }
  127. kind "ConsoleApp"
  128. targetextension ".bc"
  129. configuration { "linux-*" }
  130. links {
  131. "X11",
  132. "GL",
  133. "pthread",
  134. }
  135. configuration { "rpi" }
  136. links {
  137. "X11",
  138. "GLESv2",
  139. "EGL",
  140. "bcm_host",
  141. "vcos",
  142. "vchiq_arm",
  143. "pthread",
  144. }
  145. configuration { "osx" }
  146. files {
  147. BGFX_DIR .. "examples/common/**.mm",
  148. }
  149. links {
  150. "Cocoa.framework",
  151. "OpenGL.framework",
  152. }
  153. configuration { "xcode4" }
  154. platforms {
  155. "Universal"
  156. }
  157. files {
  158. BGFX_DIR .. "examples/common/**.mm",
  159. }
  160. links {
  161. "Cocoa.framework",
  162. "Foundation.framework",
  163. "OpenGL.framework",
  164. }
  165. configuration { "ios*" }
  166. kind "ConsoleApp"
  167. files {
  168. BGFX_DIR .. "examples/common/**.mm",
  169. }
  170. linkoptions {
  171. "-framework CoreFoundation",
  172. "-framework Foundation",
  173. "-framework OpenGLES",
  174. "-framework UIKit",
  175. "-framework QuartzCore",
  176. }
  177. configuration { "qnx*" }
  178. targetextension ""
  179. links {
  180. "EGL",
  181. "GLESv2",
  182. }
  183. configuration {}
  184. strip()
  185. end
  186. dofile "bgfx.lua"
  187. dofile "example-common.lua"
  188. bgfxProject("", "StaticLib", {})
  189. exampleProject("00-helloworld")
  190. exampleProject("01-cubes")
  191. exampleProject("02-metaballs")
  192. exampleProject("03-raymarch")
  193. exampleProject("04-mesh")
  194. exampleProject("05-instancing")
  195. exampleProject("06-bump")
  196. exampleProject("07-callback")
  197. exampleProject("08-update")
  198. exampleProject("09-hdr")
  199. exampleProject("10-font")
  200. exampleProject("11-fontsdf")
  201. exampleProject("12-lod")
  202. exampleProject("13-stencil")
  203. exampleProject("14-shadowvolumes")
  204. exampleProject("15-shadowmaps-simple")
  205. exampleProject("16-shadowmaps")
  206. exampleProject("17-drawstress")
  207. exampleProject("18-ibl")
  208. exampleProject("19-oit")
  209. exampleProject("20-nanovg")
  210. exampleProject("21-deferred")
  211. exampleProject("22-windows")
  212. if _OPTIONS["with-shared-lib"] then
  213. bgfxProject("-shared-lib", "SharedLib", {})
  214. end
  215. if _OPTIONS["with-tools"] then
  216. dofile "makedisttex.lua"
  217. dofile "shaderc.lua"
  218. dofile "texturec.lua"
  219. dofile "geometryc.lua"
  220. end