genie.lua 4.6 KB

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