shaderc.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. --
  2. -- Copyright 2010-2016 Branimir Karadzic. All rights reserved.
  3. -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. --
  5. project "shaderc"
  6. uuid "f3cd2e90-52a4-11e1-b86c-0800200c9a66"
  7. kind "ConsoleApp"
  8. local GLSL_OPTIMIZER = path.join(BGFX_DIR, "3rdparty/glsl-optimizer")
  9. local FCPP_DIR = path.join(BGFX_DIR, "3rdparty/fcpp")
  10. includedirs {
  11. path.join(GLSL_OPTIMIZER, "src"),
  12. }
  13. removeflags {
  14. -- GCC 4.9 -O2 + -fno-strict-aliasing don't work together...
  15. "OptimizeSpeed",
  16. }
  17. configuration { "vs*" }
  18. includedirs {
  19. path.join(GLSL_OPTIMIZER, "src/glsl/msvc"),
  20. }
  21. defines { -- glsl-optimizer
  22. "__STDC__",
  23. "__STDC_VERSION__=199901L",
  24. "strdup=_strdup",
  25. "alloca=_alloca",
  26. "isascii=__isascii",
  27. }
  28. buildoptions {
  29. "/wd4996" -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup.
  30. }
  31. configuration { "mingw-*" }
  32. targetextension ".exe"
  33. configuration { "mingw* or linux or osx" }
  34. buildoptions {
  35. "-fno-strict-aliasing", -- glsl-optimizer has bugs if strict aliasing is used.
  36. "-Wno-unused-parameter",
  37. }
  38. removebuildoptions {
  39. "-Wshadow", -- glsl-optimizer is full of -Wshadow warnings ignore it.
  40. }
  41. configuration { "osx" }
  42. links {
  43. "Cocoa.framework",
  44. }
  45. configuration { "vs*" }
  46. includedirs {
  47. path.join(GLSL_OPTIMIZER, "include/c99"),
  48. }
  49. configuration {}
  50. defines { -- fcpp
  51. "NINCLUDE=64",
  52. "NWORK=65536",
  53. "NBUFF=65536",
  54. "OLD_PREPROCESSOR=0",
  55. }
  56. includedirs {
  57. path.join(BX_DIR, "include"),
  58. path.join(BGFX_DIR, "include"),
  59. path.join(BGFX_DIR, "3rdparty/dxsdk/include"),
  60. FCPP_DIR,
  61. path.join(GLSL_OPTIMIZER, "include"),
  62. path.join(GLSL_OPTIMIZER, "src/mesa"),
  63. path.join(GLSL_OPTIMIZER, "src/mapi"),
  64. path.join(GLSL_OPTIMIZER, "src/glsl"),
  65. }
  66. files {
  67. path.join(BGFX_DIR, "tools/shaderc/**.cpp"),
  68. path.join(BGFX_DIR, "tools/shaderc/**.h"),
  69. path.join(BGFX_DIR, "src/vertexdecl.**"),
  70. path.join(FCPP_DIR, "**.h"),
  71. path.join(FCPP_DIR, "cpp1.c"),
  72. path.join(FCPP_DIR, "cpp2.c"),
  73. path.join(FCPP_DIR, "cpp3.c"),
  74. path.join(FCPP_DIR, "cpp4.c"),
  75. path.join(FCPP_DIR, "cpp5.c"),
  76. path.join(FCPP_DIR, "cpp6.c"),
  77. path.join(FCPP_DIR, "cpp6.c"),
  78. path.join(GLSL_OPTIMIZER, "src/mesa/**.c"),
  79. path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"),
  80. path.join(GLSL_OPTIMIZER, "src/mesa/**.h"),
  81. path.join(GLSL_OPTIMIZER, "src/glsl/**.c"),
  82. path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"),
  83. path.join(GLSL_OPTIMIZER, "src/glsl/**.h"),
  84. path.join(GLSL_OPTIMIZER, "src/util/**.c"),
  85. path.join(GLSL_OPTIMIZER, "src/util/**.h"),
  86. }
  87. removefiles {
  88. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/glcpp.c"),
  89. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/tests/**"),
  90. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.l"),
  91. path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.y"),
  92. path.join(GLSL_OPTIMIZER, "src/glsl/ir_set_program_inouts.cpp"),
  93. path.join(GLSL_OPTIMIZER, "src/glsl/main.cpp"),
  94. path.join(GLSL_OPTIMIZER, "src/glsl/builtin_stubs.cpp"),
  95. }
  96. if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), {
  97. path.join(BGFX_DIR, "scripts/shaderc.lua"), }) then
  98. if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), {
  99. path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"), }) then
  100. removefiles {
  101. path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"),
  102. }
  103. end
  104. if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), {
  105. path.join(BGFX_DIR, "tools/shaderc/shaderc_spirv.cpp"), }) then
  106. removefiles {
  107. path.join(BGFX_DIR, "tools/shaderc/shaderc_spirv.cpp"),
  108. }
  109. end
  110. dofile(path.join(BGFX_DIR, "../bgfx-ext/scripts/shaderc.lua") )
  111. end
  112. strip()