premake4.lua 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. solution "bgfx"
  14. configurations {
  15. "Debug",
  16. "Release",
  17. }
  18. platforms {
  19. "x32",
  20. "x64",
  21. -- "Xbox360",
  22. "Native", -- for targets where bitness is not specified
  23. }
  24. language "C++"
  25. BGFX_DIR = (path.getabsolute("..") .. "/")
  26. local BGFX_BUILD_DIR = (BGFX_DIR .. ".build/")
  27. local BGFX_THIRD_PARTY_DIR = (BGFX_DIR .. "3rdparty/")
  28. BX_DIR = (BGFX_DIR .. "../bx/")
  29. defines {
  30. "BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS=1"
  31. }
  32. dofile (BX_DIR .. "premake/toolchain.lua")
  33. toolchain(BGFX_BUILD_DIR, BGFX_THIRD_PARTY_DIR)
  34. function copyLib()
  35. end
  36. function exampleProject(_name, _uuid)
  37. project ("example-" .. _name)
  38. uuid (_uuid)
  39. kind "WindowedApp"
  40. configuration {}
  41. debugdir (BGFX_DIR .. "examples/runtime/")
  42. includedirs {
  43. BX_DIR .. "include",
  44. BGFX_DIR .. "include",
  45. BGFX_DIR .. "3rdparty",
  46. BGFX_DIR .. "examples/common",
  47. }
  48. files {
  49. BGFX_DIR .. "examples/" .. _name .. "/**.cpp",
  50. BGFX_DIR .. "examples/" .. _name .. "/**.h",
  51. }
  52. links {
  53. "bgfx",
  54. "example-common",
  55. }
  56. configuration { "vs*" }
  57. linkoptions {
  58. "/ignore:4199", -- LNK4199: /DELAYLOAD:*.dll ignored; no imports found from *.dll
  59. }
  60. links { -- this is needed only for testing with GLES2/3 on Windows with VS2008
  61. "DelayImp",
  62. }
  63. configuration { "vs201*" }
  64. linkoptions { -- this is needed only for testing with GLES2/3 on Windows with VS201x
  65. "/DELAYLOAD:\"libEGL.dll\"",
  66. "/DELAYLOAD:\"libGLESv2.dll\"",
  67. }
  68. configuration { "android*" }
  69. kind "ConsoleApp"
  70. targetextension ".so"
  71. linkoptions {
  72. "-shared",
  73. }
  74. links {
  75. "EGL",
  76. "GLESv2",
  77. }
  78. configuration { "nacl or nacl-arm" }
  79. kind "ConsoleApp"
  80. targetextension ".nexe"
  81. links {
  82. "ppapi",
  83. "ppapi_gles2",
  84. "pthread",
  85. }
  86. configuration { "pnacl" }
  87. kind "ConsoleApp"
  88. targetextension ".pexe"
  89. links {
  90. "ppapi",
  91. "ppapi_gles2",
  92. "pthread",
  93. }
  94. configuration { "asmjs" }
  95. kind "ConsoleApp"
  96. targetextension ".bc"
  97. configuration { "linux-*" }
  98. links {
  99. "X11",
  100. "GL",
  101. "pthread",
  102. }
  103. configuration { "rpi" }
  104. links {
  105. "X11",
  106. "GLESv2",
  107. "EGL",
  108. "bcm_host",
  109. "vcos",
  110. "vchiq_arm",
  111. "pthread",
  112. }
  113. configuration { "osx" }
  114. files {
  115. BGFX_DIR .. "examples/common/**.mm",
  116. }
  117. links {
  118. "Cocoa.framework",
  119. "OpenGL.framework",
  120. -- "SDL2",
  121. }
  122. configuration { "xcode4" }
  123. platforms {
  124. "Universal"
  125. }
  126. files {
  127. BGFX_DIR .. "examples/common/**.mm",
  128. }
  129. links {
  130. "Cocoa.framework",
  131. "Foundation.framework",
  132. "OpenGL.framework",
  133. }
  134. configuration { "ios*" }
  135. kind "ConsoleApp"
  136. files {
  137. BGFX_DIR .. "examples/common/**.mm",
  138. }
  139. linkoptions {
  140. "-framework CoreFoundation",
  141. "-framework Foundation",
  142. "-framework OpenGLES",
  143. "-framework UIKit",
  144. "-framework QuartzCore",
  145. }
  146. configuration { "qnx*" }
  147. targetextension ""
  148. links {
  149. "EGL",
  150. "GLESv2",
  151. }
  152. configuration {}
  153. strip()
  154. end
  155. dofile "bgfx.lua"
  156. dofile "example-common.lua"
  157. bgfxProject("", "2dc7fd80-ed76-11e0-be50-0800200c9a66", "StaticLib", {})
  158. exampleProject("00-helloworld", "ff2c8450-ebf4-11e0-9572-0800200c9a66")
  159. exampleProject("01-cubes", "fec3bc94-e1e5-11e1-9c59-c7eeec2c1c51")
  160. exampleProject("02-metaballs", "413b2cb4-f7db-11e1-bf5f-a716de6a022f")
  161. exampleProject("03-raymarch", "1cede802-0220-11e2-91ba-e108de6a022f")
  162. exampleProject("04-mesh", "546bbc76-0c4a-11e2-ab09-debcdd6a022f")
  163. exampleProject("05-instancing", "5d3da660-1105-11e2-aece-71e4dd6a022f")
  164. exampleProject("06-bump", "ffb23e6c-167b-11e2-81df-94c4dd6a022f")
  165. exampleProject("07-callback", "acc53bbc-52f0-11e2-9781-ad8edd4b7d02")
  166. exampleProject("08-update", "e011e246-5862-11e2-b202-b7cb257a7926")
  167. exampleProject("09-hdr", "969a4626-67ee-11e2-9726-9023267a7926")
  168. exampleProject("10-font" , "ef6fd5b3-b52a-41c2-a257-9dfe709af9e1")
  169. exampleProject("11-fontsdf", "f4e6f96f-3daa-4c68-8df8-bf2a3ecd9092")
  170. exampleProject("12-lod", "0512e9e6-bfd8-11e2-8e34-0291bd4c8125")
  171. exampleProject("13-stencil", "d12d6522-37bc-11e3-b89c-e46428d43830")
  172. exampleProject("14-shadowvolumes", "d7eb4bcc-37bc-11e3-b7a4-e46428d43830")
  173. exampleProject("15-shadowmaps-simple", "a10f22ab-e0ee-471a-b2b6-2f6cb1c63fdc")
  174. exampleProject("16-shadowmaps", "f9a91cb0-7b1b-11e3-981f-0800200c9a66")
  175. exampleProject("17-drawstress", "9aeea4c6-80dc-11e3-b3ca-4da6db0f677b")
  176. exampleProject("18-ibl", "711bcbb0-9531-11e3-a5e2-0800200c9a66")
  177. exampleProject("19-oit", "d7eca4fc-96d7-11e3-a73b-fcafdb0f677b")
  178. exampleProject("20-nanovg", "359ce7c4-cd06-11e3-bb8b-6c2f9a125b5a")
  179. exampleProject("21-deferred", "f89e59ec-d16b-11e3-bc9c-2dfd99125b5a")
  180. if _OPTIONS["with-shared-lib"] then
  181. bgfxProject("-shared-lib", "09986168-e9d9-11e3-9c8e-f2aef940a72a", "SharedLib", {})
  182. end
  183. if _OPTIONS["with-tools"] then
  184. dofile "makedisttex.lua"
  185. dofile "shaderc.lua"
  186. dofile "texturec.lua"
  187. dofile "geometryc.lua"
  188. end