bgfx.lua 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. --
  2. -- Copyright 2010-2016 Branimir Karadzic. All rights reserved.
  3. -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. --
  5. function bgfxProject(_name, _kind, _defines)
  6. project ("bgfx" .. _name)
  7. uuid (os.uuid("bgfx" .. _name))
  8. kind (_kind)
  9. if _kind == "SharedLib" then
  10. defines {
  11. "BGFX_SHARED_LIB_BUILD=1",
  12. }
  13. configuration { "vs20* or mingw*" }
  14. links {
  15. "gdi32",
  16. "psapi",
  17. }
  18. configuration { "mingw*" }
  19. linkoptions {
  20. "-shared",
  21. }
  22. configuration { "linux-*" }
  23. buildoptions {
  24. "-fPIC",
  25. }
  26. configuration {}
  27. end
  28. includedirs {
  29. path.join(BGFX_DIR, "3rdparty"),
  30. path.join(BGFX_DIR, "3rdparty/dxsdk/include"),
  31. path.join(BX_DIR, "include"),
  32. }
  33. defines {
  34. _defines,
  35. }
  36. if _OPTIONS["with-glfw"] then
  37. defines {
  38. "BGFX_CONFIG_MULTITHREADED=0",
  39. }
  40. end
  41. if _OPTIONS["with-ovr"] then
  42. defines {
  43. -- "BGFX_CONFIG_MULTITHREADED=0",
  44. "BGFX_CONFIG_USE_OVR=1",
  45. }
  46. includedirs {
  47. "$(OVR_DIR)/LibOVR/Include",
  48. }
  49. configuration { "x32" }
  50. libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/Win32/Release", _ACTION) }
  51. configuration { "x64" }
  52. libdirs { path.join("$(OVR_DIR)/LibOVR/Lib/Windows/x64/Release", _ACTION) }
  53. configuration { "x32 or x64" }
  54. links { "libovr" }
  55. configuration {}
  56. end
  57. configuration { "Debug" }
  58. defines {
  59. "BGFX_CONFIG_DEBUG=1",
  60. }
  61. configuration { "android*" }
  62. links {
  63. "EGL",
  64. "GLESv2",
  65. }
  66. configuration { "winphone8* or winstore8*" }
  67. linkoptions {
  68. "/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata
  69. }
  70. configuration { "*clang*" }
  71. buildoptions {
  72. "-Wno-microsoft-enum-value", -- enumerator value is not representable in the underlying type 'int'
  73. "-Wno-microsoft-const-init", -- default initialization of an object of const type '' without a user-provided default constructor is a Microsoft extension
  74. }
  75. configuration { "osx" }
  76. linkoptions {
  77. "-framework Cocoa",
  78. "-framework QuartzCore",
  79. "-framework OpenGL",
  80. "-weak_framework Metal",
  81. }
  82. configuration { "not nacl", "not linux-steamlink" }
  83. includedirs {
  84. --nacl has GLES2 headers modified...
  85. --steamlink has EGL headers modified...
  86. path.join(BGFX_DIR, "3rdparty/khronos"),
  87. }
  88. configuration { "linux-steamlink" }
  89. defines {
  90. "EGL_API_FB",
  91. }
  92. configuration {}
  93. includedirs {
  94. path.join(BGFX_DIR, "include"),
  95. }
  96. files {
  97. path.join(BGFX_DIR, "include/**.h"),
  98. path.join(BGFX_DIR, "src/**.cpp"),
  99. path.join(BGFX_DIR, "src/**.h"),
  100. }
  101. removefiles {
  102. path.join(BGFX_DIR, "src/**.bin.h"),
  103. }
  104. if _OPTIONS["with-amalgamated"] then
  105. excludes {
  106. path.join(BGFX_DIR, "src/bgfx.cpp"),
  107. path.join(BGFX_DIR, "src/glcontext_egl.cpp"),
  108. path.join(BGFX_DIR, "src/glcontext_glx.cpp"),
  109. path.join(BGFX_DIR, "src/glcontext_ppapi.cpp"),
  110. path.join(BGFX_DIR, "src/glcontext_wgl.cpp"),
  111. path.join(BGFX_DIR, "src/image.cpp"),
  112. path.join(BGFX_DIR, "src/ovr.cpp"),
  113. path.join(BGFX_DIR, "src/renderdoc.cpp"),
  114. path.join(BGFX_DIR, "src/renderer_d3d9.cpp"),
  115. path.join(BGFX_DIR, "src/renderer_d3d11.cpp"),
  116. path.join(BGFX_DIR, "src/renderer_d3d12.cpp"),
  117. path.join(BGFX_DIR, "src/renderer_null.cpp"),
  118. path.join(BGFX_DIR, "src/renderer_gl.cpp"),
  119. path.join(BGFX_DIR, "src/renderer_vk.cpp"),
  120. path.join(BGFX_DIR, "src/shader_dx9bc.cpp"),
  121. path.join(BGFX_DIR, "src/shader_dxbc.cpp"),
  122. path.join(BGFX_DIR, "src/shader_spirv.cpp"),
  123. path.join(BGFX_DIR, "src/vertexdecl.cpp"),
  124. }
  125. configuration { "xcode* or osx or ios*" }
  126. files {
  127. path.join(BGFX_DIR, "src/amalgamated.mm"),
  128. }
  129. excludes {
  130. path.join(BGFX_DIR, "src/glcontext_eagl.mm"),
  131. path.join(BGFX_DIR, "src/glcontext_nsgl.mm"),
  132. path.join(BGFX_DIR, "src/renderer_mtl.mm"),
  133. path.join(BGFX_DIR, "src/amalgamated.cpp"),
  134. }
  135. configuration {}
  136. else
  137. configuration { "xcode* or osx or ios*" }
  138. files {
  139. path.join(BGFX_DIR, "src/glcontext_eagl.mm"),
  140. path.join(BGFX_DIR, "src/glcontext_nsgl.mm"),
  141. path.join(BGFX_DIR, "src/renderer_mtl.mm"),
  142. }
  143. configuration {}
  144. excludes {
  145. path.join(BGFX_DIR, "src/amalgamated.**"),
  146. }
  147. end
  148. configuration {}
  149. copyLib()
  150. end