bgfx/scripts/shaderc.lua

302 lines
7.8 KiB
Lua
Raw Normal View History

2013-05-18 06:39:08 +04:00
--
2018-01-01 22:16:06 +03:00
-- Copyright 2010-2018 Branimir Karadzic. All rights reserved.
2016-01-01 11:11:04 +03:00
-- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
2013-05-18 06:39:08 +04:00
--
2017-03-12 01:44:00 +03:00
group "tools/shaderc"
local GLSL_OPTIMIZER = path.join(BGFX_DIR, "3rdparty/glsl-optimizer")
local FCPP_DIR = path.join(BGFX_DIR, "3rdparty/fcpp")
2016-12-16 06:03:47 +03:00
project "glslang"
kind "StaticLib"
2016-12-16 09:48:14 +03:00
local GLSLANG = path.join(BGFX_DIR, "3rdparty/glslang")
2016-12-16 08:11:35 +03:00
configuration { "vs2012" }
defines {
2016-12-16 08:26:47 +03:00
"atoll=_atoi64",
2016-12-16 08:11:35 +03:00
"strtoll=_strtoi64",
"strtoull=_strtoui64",
}
2016-12-16 07:53:13 +03:00
configuration { "vs*" }
buildoptions {
"/wd4005", -- warning C4005: '_CRT_SECURE_NO_WARNINGS': macro redefinition
2017-12-29 22:21:21 +03:00
"/wd4100", -- warning C4100: 'inclusionDepth' : unreferenced formal parameter
"/wd4127", -- warning C4127: conditional expression is constant
2017-03-13 04:28:18 +03:00
"/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
2016-12-16 07:53:13 +03:00
}
2016-12-16 07:31:18 +03:00
configuration { "not vs*" }
buildoptions {
2017-12-29 22:21:21 +03:00
-- "-Wno-deprecated-register",
2016-12-16 07:31:18 +03:00
"-Wno-ignored-qualifiers",
2017-12-29 22:21:21 +03:00
-- "-Wno-inconsistent-missing-override",
2016-12-16 07:31:18 +03:00
"-Wno-missing-field-initializers",
"-Wno-reorder",
2017-02-04 06:32:35 +03:00
"-Wno-return-type",
2016-12-16 07:31:18 +03:00
"-Wno-shadow",
"-Wno-sign-compare",
"-Wno-undef",
"-Wno-unknown-pragmas",
2017-12-29 22:21:21 +03:00
"-Wno-unused-function",
2016-12-16 07:31:18 +03:00
"-Wno-unused-parameter",
"-Wno-unused-variable",
}
2016-12-16 06:03:47 +03:00
configuration { "osx" }
buildoptions {
"-Wno-c++11-extensions",
"-Wno-unused-const-variable",
2018-02-21 00:29:54 +03:00
"-Wno-deprecated-register",
2016-12-16 06:03:47 +03:00
}
2016-12-16 07:46:12 +03:00
configuration { "linux-*" }
2016-12-16 06:03:47 +03:00
buildoptions {
"-Wno-unused-but-set-variable",
}
configuration {}
defines {
"ENABLE_HLSL=1",
}
2016-12-16 06:03:47 +03:00
includedirs {
2016-12-16 09:48:14 +03:00
GLSLANG,
2016-12-16 06:03:47 +03:00
}
files {
2016-12-16 09:48:14 +03:00
path.join(GLSLANG, "glslang/**.cpp"),
path.join(GLSLANG, "glslang/**.h"),
2016-12-16 06:03:47 +03:00
2016-12-16 09:48:14 +03:00
path.join(GLSLANG, "hlsl/**.cpp"),
path.join(GLSLANG, "hlsl/**.h"),
2016-12-16 06:03:47 +03:00
2016-12-16 09:48:14 +03:00
path.join(GLSLANG, "SPIRV/**.cpp"),
path.join(GLSLANG, "SPIRV/**.h"),
2016-12-16 06:03:47 +03:00
2016-12-16 09:48:14 +03:00
path.join(GLSLANG, "OGLCompilersDLL/**.cpp"),
path.join(GLSLANG, "OGLCompilersDLL/**.h"),
2016-12-16 06:03:47 +03:00
}
removefiles {
2016-12-16 09:48:14 +03:00
path.join(GLSLANG, "glslang/OSDependent/Unix/main.cpp"),
path.join(GLSLANG, "glslang/OSDependent/Windows/main.cpp"),
2016-12-16 06:03:47 +03:00
}
2016-12-16 07:53:13 +03:00
configuration { "windows" }
removefiles {
2016-12-16 09:48:14 +03:00
path.join(GLSLANG, "glslang/OSDependent/Unix/**.cpp"),
path.join(GLSLANG, "glslang/OSDependent/Unix/**.h"),
2016-12-16 07:53:13 +03:00
}
configuration { "not windows" }
removefiles {
2016-12-16 09:48:14 +03:00
path.join(GLSLANG, "glslang/OSDependent/Windows/**.cpp"),
path.join(GLSLANG, "glslang/OSDependent/Windows/**.h"),
2016-12-16 07:53:13 +03:00
}
configuration {}
project "glsl-optimizer"
kind "StaticLib"
2013-02-22 09:13:56 +04:00
2014-10-11 23:32:43 +04:00
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"),
2014-10-11 23:32:43 +04:00
}
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"),
2017-01-09 02:55:14 +03:00
}
2017-01-09 04:38:32 +03:00
configuration { "Release" }
flags {
"Optimize",
}
removeflags {
-- GCC 4.9 -O2 + -fno-strict-aliasing don't work together...
"OptimizeSpeed",
}
2013-02-22 09:13:56 +04:00
configuration { "vs*" }
includedirs {
path.join(GLSL_OPTIMIZER, "src/glsl/msvc"),
2013-02-22 09:13:56 +04:00
}
defines { -- glsl-optimizer
"__STDC__",
"__STDC_VERSION__=199901L",
"strdup=_strdup",
"alloca=_alloca",
"isascii=__isascii",
}
2013-03-20 10:34:17 +04:00
buildoptions {
2017-03-12 01:35:32 +03:00
"/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
2013-03-20 10:34:17 +04:00
"/wd4996" -- warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup.
}
2014-10-19 02:44:45 +04:00
configuration { "mingw* or linux or osx" }
buildoptions {
2015-04-05 21:55:04 +03:00
"-fno-strict-aliasing", -- glsl-optimizer has bugs if strict aliasing is used.
"-Wno-unused-parameter",
}
2017-03-12 01:35:32 +03:00
2015-04-05 05:45:45 +03:00
removebuildoptions {
"-Wshadow", -- glsl-optimizer is full of -Wshadow warnings ignore it.
}
configuration {}
2017-03-12 01:50:03 +03:00
project "fcpp"
kind "StaticLib"
defines { -- fcpp
2013-02-22 09:13:56 +04:00
"NINCLUDE=64",
"NWORK=65536",
"NBUFF=65536",
2014-08-22 20:53:14 +04:00
"OLD_PREPROCESSOR=0",
2013-02-22 09:13:56 +04:00
}
2017-03-12 01:50:03 +03:00
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
}
2017-06-28 06:26:31 +03:00
configuration { "not vs*" }
buildoptions {
"-Wno-implicit-fallthrough",
}
2017-03-12 01:50:03 +03:00
configuration {}
project "shaderc"
kind "ConsoleApp"
2013-02-22 09:13:56 +04:00
includedirs {
2017-04-04 08:42:27 +03:00
path.join(BX_DIR, "include"),
path.join(BIMG_DIR, "include"),
path.join(BGFX_DIR, "include"),
2013-02-22 09:13:56 +04:00
2016-01-31 04:14:09 +03:00
path.join(BGFX_DIR, "3rdparty/dxsdk/include"),
2013-02-22 09:13:56 +04:00
FCPP_DIR,
2016-12-16 06:03:47 +03:00
path.join(BGFX_DIR, "3rdparty/glslang/glslang/Public"),
path.join(BGFX_DIR, "3rdparty/glslang/glslang/Include"),
path.join(BGFX_DIR, "3rdparty/glslang"),
path.join(GLSL_OPTIMIZER, "include"),
path.join(GLSL_OPTIMIZER, "src/glsl"),
2013-02-22 09:13:56 +04:00
}
2017-03-12 01:50:03 +03:00
links {
"bx",
"fcpp",
"glslang",
"glsl-optimizer",
}
2013-02-22 09:13:56 +04:00
files {
path.join(BGFX_DIR, "tools/shaderc/**.cpp"),
path.join(BGFX_DIR, "tools/shaderc/**.h"),
path.join(BGFX_DIR, "src/vertexdecl.**"),
2016-12-16 06:03:47 +03:00
path.join(BGFX_DIR, "src/shader_spirv.**"),
2013-02-22 09:13:56 +04:00
}
2013-04-29 01:08:59 +04:00
2017-03-12 01:35:32 +03:00
configuration { "mingw-*" }
targetextension ".exe"
configuration { "osx" }
links {
"Cocoa.framework",
}
configuration { "vs*" }
includedirs {
path.join(GLSL_OPTIMIZER, "include/c99"),
}
configuration { "vs20* or mingw*" }
links {
"psapi",
}
configuration {}
2016-12-16 06:03:47 +03:00
2016-10-05 08:48:59 +03:00
if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), {
path.join(BGFX_DIR, "scripts/shaderc.lua"), }) then
if filesexist(BGFX_DIR, path.join(BGFX_DIR, "../bgfx-ext"), {
path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"), }) then
removefiles {
path.join(BGFX_DIR, "tools/shaderc/shaderc_pssl.cpp"),
}
end
2016-10-05 08:48:59 +03:00
dofile(path.join(BGFX_DIR, "../bgfx-ext/scripts/shaderc.lua") )
end
2016-10-01 06:03:16 +03:00
configuration { "osx or linux*" }
2016-12-16 06:03:47 +03:00
links {
"pthread",
}
configuration {}
2013-04-29 01:08:59 +04:00
strip()
2017-03-12 01:44:00 +03:00
group "tools"