diff options
Diffstat (limited to '3rdparty/bgfx/scripts/shaderc.lua')
-rw-r--r-- | 3rdparty/bgfx/scripts/shaderc.lua | 159 |
1 files changed, 102 insertions, 57 deletions
diff --git a/3rdparty/bgfx/scripts/shaderc.lua b/3rdparty/bgfx/scripts/shaderc.lua index 319062c98fc..300c4c6a484 100644 --- a/3rdparty/bgfx/scripts/shaderc.lua +++ b/3rdparty/bgfx/scripts/shaderc.lua @@ -3,6 +3,11 @@ -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- +group "tools/shaderc" + +local GLSL_OPTIMIZER = path.join(BGFX_DIR, "3rdparty/glsl-optimizer") +local FCPP_DIR = path.join(BGFX_DIR, "3rdparty/fcpp") + project "glslang" kind "StaticLib" @@ -19,6 +24,12 @@ project "glslang" buildoptions { "/wd4005", -- warning C4005: '_CRT_SECURE_NO_WARNINGS': macro redefinition "/wd4100", -- error C4100: 'inclusionDepth' : unreferenced formal parameter + "/wd4127", -- warning C4127: conditional expression is constant + "/wd4244", -- warning C4244: '=': conversion from 'int' to 'char', possible loss of data + "/wd4456", -- warning C4456: declaration of 'feature' hides previous local declaration + "/wd4457", -- warning C4457: declaration of 'token' hides function parameter + "/wd4458", -- warning C4458: declaration of 'language' hides class member + "/wd4702", -- warning C4702: unreachable code } configuration { "not vs*" } @@ -90,18 +101,36 @@ project "glslang" configuration {} -project "shaderc" - kind "ConsoleApp" - - local GLSL_OPTIMIZER = path.join(BGFX_DIR, "3rdparty/glsl-optimizer") - local FCPP_DIR = path.join(BGFX_DIR, "3rdparty/fcpp") +project "glsl-optimizer" + kind "StaticLib" includedirs { path.join(GLSL_OPTIMIZER, "src"), + path.join(GLSL_OPTIMIZER, "include"), + path.join(GLSL_OPTIMIZER, "src/mesa"), + path.join(GLSL_OPTIMIZER, "src/mapi"), + path.join(GLSL_OPTIMIZER, "src/glsl"), } - links { - "bx", + files { + path.join(GLSL_OPTIMIZER, "src/mesa/**.c"), + path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"), + path.join(GLSL_OPTIMIZER, "src/mesa/**.h"), + path.join(GLSL_OPTIMIZER, "src/glsl/**.c"), + path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"), + path.join(GLSL_OPTIMIZER, "src/glsl/**.h"), + path.join(GLSL_OPTIMIZER, "src/util/**.c"), + path.join(GLSL_OPTIMIZER, "src/util/**.h"), + } + + removefiles { + path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/glcpp.c"), + path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/tests/**"), + path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.l"), + path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.y"), + path.join(GLSL_OPTIMIZER, "src/glsl/ir_set_program_inouts.cpp"), + path.join(GLSL_OPTIMIZER, "src/glsl/main.cpp"), + path.join(GLSL_OPTIMIZER, "src/glsl/builtin_stubs.cpp"), } configuration { "Release" } @@ -128,38 +157,35 @@ project "shaderc" } buildoptions { + "/wd4100", -- error C4100: '' : unreferenced formal parameter + "/wd4127", -- warning C4127: conditional expression is constant + "/wd4132", -- warning C4132: 'deleted_key_value': const object should be initialized + "/wd4189", -- warning C4189: 'interface_type': local variable is initialized but not referenced + "/wd4204", -- warning C4204: nonstandard extension used: non-constant aggregate initializer + "/wd4244", -- warning C4244: '=': conversion from 'const flex_int32_t' to 'YY_CHAR', possible loss of data + "/wd4389", -- warning C4389: '!=': signed/unsigned mismatch + "/wd4245", -- warning C4245: 'return': conversion from 'int' to 'unsigned int', signed/unsigned mismatch + "/wd4701", -- warning C4701: potentially uninitialized local variable 'lower' used + "/wd4702", -- warning C4702: unreachable code + "/wd4706", -- warning C4706: assignment within conditional expression "/wd4996" -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. } - configuration { "mingw-*" } - targetextension ".exe" - configuration { "mingw* or linux or osx" } buildoptions { "-fno-strict-aliasing", -- glsl-optimizer has bugs if strict aliasing is used. "-Wno-unused-parameter", } + removebuildoptions { "-Wshadow", -- glsl-optimizer is full of -Wshadow warnings ignore it. } - configuration { "osx" } - links { - "Cocoa.framework", - } - - configuration { "vs*" } - includedirs { - path.join(GLSL_OPTIMIZER, "include/c99"), - } - - configuration { "vs20* or mingw*" } - links { - "psapi", - } - configuration {} +project "fcpp" + kind "StaticLib" + defines { -- fcpp "NINCLUDE=64", "NWORK=65536", @@ -167,6 +193,31 @@ project "shaderc" "OLD_PREPROCESSOR=0", } + files { + path.join(FCPP_DIR, "**.h"), + path.join(FCPP_DIR, "cpp1.c"), + path.join(FCPP_DIR, "cpp2.c"), + path.join(FCPP_DIR, "cpp3.c"), + path.join(FCPP_DIR, "cpp4.c"), + path.join(FCPP_DIR, "cpp5.c"), + path.join(FCPP_DIR, "cpp6.c"), + path.join(FCPP_DIR, "cpp6.c"), + } + + configuration { "vs*" } + + buildoptions { + "/wd4055", -- warning C4055: 'type cast': from data pointer 'void *' to function pointer 'void (__cdecl *)(char *,void *)' + "/wd4244", -- warning C4244: '=': conversion from 'const flex_int32_t' to 'YY_CHAR', possible loss of data + "/wd4701", -- warning C4701: potentially uninitialized local variable 'lower' used + "/wd4706", -- warning C4706: assignment within conditional expression + } + + configuration {} + +project "shaderc" + kind "ConsoleApp" + includedirs { path.join(BX_DIR, "include"), path.join(BGFX_DIR, "include"), @@ -177,52 +228,44 @@ project "shaderc" path.join(BGFX_DIR, "3rdparty/glslang/glslang/Public"), path.join(BGFX_DIR, "3rdparty/glslang/glslang/Include"), path.join(BGFX_DIR, "3rdparty/glslang"), --- path.join(BGFX_DIR, "3rdparty/spirv-tools/include"), path.join(GLSL_OPTIMIZER, "include"), - path.join(GLSL_OPTIMIZER, "src/mesa"), - path.join(GLSL_OPTIMIZER, "src/mapi"), path.join(GLSL_OPTIMIZER, "src/glsl"), } + links { + "bx", + "fcpp", + "glslang", + "glsl-optimizer", + } + files { path.join(BGFX_DIR, "tools/shaderc/**.cpp"), path.join(BGFX_DIR, "tools/shaderc/**.h"), path.join(BGFX_DIR, "src/vertexdecl.**"), path.join(BGFX_DIR, "src/shader_spirv.**"), + } - path.join(FCPP_DIR, "**.h"), - path.join(FCPP_DIR, "cpp1.c"), - path.join(FCPP_DIR, "cpp2.c"), - path.join(FCPP_DIR, "cpp3.c"), - path.join(FCPP_DIR, "cpp4.c"), - path.join(FCPP_DIR, "cpp5.c"), - path.join(FCPP_DIR, "cpp6.c"), - path.join(FCPP_DIR, "cpp6.c"), + configuration { "mingw-*" } + targetextension ".exe" - path.join(GLSL_OPTIMIZER, "src/mesa/**.c"), - path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"), - path.join(GLSL_OPTIMIZER, "src/mesa/**.h"), - path.join(GLSL_OPTIMIZER, "src/glsl/**.c"), - path.join(GLSL_OPTIMIZER, "src/glsl/**.cpp"), - path.join(GLSL_OPTIMIZER, "src/glsl/**.h"), - path.join(GLSL_OPTIMIZER, "src/util/**.c"), - path.join(GLSL_OPTIMIZER, "src/util/**.h"), - } + configuration { "osx" } + links { + "Cocoa.framework", + } - removefiles { - path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/glcpp.c"), - path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/tests/**"), - path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.l"), - path.join(GLSL_OPTIMIZER, "src/glsl/glcpp/**.y"), - path.join(GLSL_OPTIMIZER, "src/glsl/ir_set_program_inouts.cpp"), - path.join(GLSL_OPTIMIZER, "src/glsl/main.cpp"), - path.join(GLSL_OPTIMIZER, "src/glsl/builtin_stubs.cpp"), - } + configuration { "vs*" } + includedirs { + path.join(GLSL_OPTIMIZER, "include/c99"), + } - links { - "glslang", - } + configuration { "vs20* or mingw*" } + links { + "psapi", + } + + configuration {} if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), { path.join(BGFX_DIR, "scripts/shaderc.lua"), }) then @@ -246,3 +289,5 @@ project "shaderc" configuration {} strip() + +group "tools" |