bgfx.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. --
  2. -- Copyright 2010-2015 Branimir Karadzic. All rights reserved.
  3. -- License: http://www.opensource.org/licenses/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(BGFX_DIR, "../bx/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_USE_OVR=1",
  44. }
  45. includedirs {
  46. "$(OVR_DIR)/LibOVR/Include",
  47. }
  48. end
  49. configuration { "Debug" }
  50. defines {
  51. "BGFX_CONFIG_DEBUG=1",
  52. }
  53. configuration { "android*" }
  54. links {
  55. "EGL",
  56. "GLESv2",
  57. }
  58. configuration { "winphone8* or winstore8*"}
  59. linkoptions {
  60. "/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
  61. }
  62. configuration { "osx" }
  63. links {
  64. "Cocoa.framework",
  65. }
  66. configuration { "not nacl" }
  67. includedirs {
  68. --nacl has GLES2 headers modified...
  69. path.join(BGFX_DIR, "3rdparty/khronos"),
  70. }
  71. configuration {}
  72. includedirs {
  73. path.join(BGFX_DIR, "include"),
  74. }
  75. files {
  76. path.join(BGFX_DIR, "include/**.h"),
  77. path.join(BGFX_DIR, "src/**.cpp"),
  78. path.join(BGFX_DIR, "src/**.h"),
  79. }
  80. removefiles {
  81. path.join(BGFX_DIR, "src/**.bin.h"),
  82. }
  83. if _OPTIONS["with-amalgamated"] then
  84. excludes {
  85. path.join(BGFX_DIR, "src/bgfx.cpp"),
  86. path.join(BGFX_DIR, "src/glcontext_egl.cpp"),
  87. path.join(BGFX_DIR, "src/glcontext_glx.cpp"),
  88. path.join(BGFX_DIR, "src/glcontext_ppapi.cpp"),
  89. path.join(BGFX_DIR, "src/glcontext_wgl.cpp"),
  90. path.join(BGFX_DIR, "src/image.cpp"),
  91. path.join(BGFX_DIR, "src/ovr.cpp"),
  92. path.join(BGFX_DIR, "src/renderdoc.cpp"),
  93. path.join(BGFX_DIR, "src/renderer_d3d9.cpp"),
  94. path.join(BGFX_DIR, "src/renderer_d3d11.cpp"),
  95. path.join(BGFX_DIR, "src/renderer_d3d12.cpp"),
  96. path.join(BGFX_DIR, "src/renderer_null.cpp"),
  97. path.join(BGFX_DIR, "src/renderer_gl.cpp"),
  98. path.join(BGFX_DIR, "src/renderer_vk.cpp"),
  99. path.join(BGFX_DIR, "src/shader_dx9bc.cpp"),
  100. path.join(BGFX_DIR, "src/shader_dxbc.cpp"),
  101. path.join(BGFX_DIR, "src/shader_spirv.cpp"),
  102. path.join(BGFX_DIR, "src/vertexdecl.cpp"),
  103. }
  104. configuration { "xcode4 or osx or ios*" }
  105. files {
  106. path.join(BGFX_DIR, "src/amalgamated.mm"),
  107. }
  108. excludes {
  109. path.join(BGFX_DIR, "src/glcontext_eagl.mm"),
  110. path.join(BGFX_DIR, "src/glcontext_nsgl.mm"),
  111. path.join(BGFX_DIR, "src/renderer_mtl.mm"),
  112. path.join(BGFX_DIR, "src/amalgamated.cpp"),
  113. }
  114. configuration {}
  115. else
  116. configuration { "xcode4 or osx or ios*" }
  117. files {
  118. path.join(BGFX_DIR, "src/glcontext_eagl.mm"),
  119. path.join(BGFX_DIR, "src/glcontext_nsgl.mm"),
  120. path.join(BGFX_DIR, "src/renderer_mtl.mm"),
  121. }
  122. configuration {}
  123. excludes {
  124. path.join(BGFX_DIR, "src/amalgamated.**"),
  125. }
  126. end
  127. configuration {}
  128. copyLib()
  129. end