diff options
Diffstat (limited to '3rdparty/bgfx/scripts')
-rw-r--r-- | 3rdparty/bgfx/scripts/bgfx.lua | 13 | ||||
-rw-r--r-- | 3rdparty/bgfx/scripts/build.ninja | 9 | ||||
-rw-r--r-- | 3rdparty/bgfx/scripts/example-common.lua | 22 | ||||
-rw-r--r-- | 3rdparty/bgfx/scripts/genie.lua | 195 | ||||
-rw-r--r-- | 3rdparty/bgfx/scripts/geometryc.lua | 10 | ||||
-rw-r--r-- | 3rdparty/bgfx/scripts/shader.mk | 12 | ||||
-rw-r--r-- | 3rdparty/bgfx/scripts/shaderc.lua | 8 | ||||
-rw-r--r-- | 3rdparty/bgfx/scripts/texturec.lua | 37 | ||||
-rw-r--r-- | 3rdparty/bgfx/scripts/texturev.lua | 3 |
9 files changed, 206 insertions, 103 deletions
diff --git a/3rdparty/bgfx/scripts/bgfx.lua b/3rdparty/bgfx/scripts/bgfx.lua index f95e99f6d78..adccbf026d2 100644 --- a/3rdparty/bgfx/scripts/bgfx.lua +++ b/3rdparty/bgfx/scripts/bgfx.lua @@ -36,9 +36,13 @@ function overridefiles(_srcPath, _dstPath, _files) end function bgfxProject(_name, _kind, _defines) - project ("bgfx" .. _name) uuid (os.uuid("bgfx" .. _name)) + bgfxProjectBase(_kind, _defines) + copyLib() +end + +function bgfxProjectBase(_kind, _defines) kind (_kind) if _kind == "SharedLib" then @@ -47,6 +51,7 @@ function bgfxProject(_name, _kind, _defines) } links { + "bimg", "bx", } @@ -73,6 +78,7 @@ function bgfxProject(_name, _kind, _defines) path.join(BGFX_DIR, "3rdparty"), path.join(BGFX_DIR, "3rdparty/dxsdk/include"), path.join(BX_DIR, "include"), + path.join(BIMG_DIR, "include"), } defines { @@ -141,10 +147,11 @@ function bgfxProject(_name, _kind, _defines) "-weak_framework MetalKit", } - configuration { "not nacl", "not linux-steamlink" } + configuration { "not nacl", "not linux-steamlink", "not NX32", "not NX64" } includedirs { --nacl has GLES2 headers modified... --steamlink has EGL headers modified... + --NX has EGL headers modified... path.join(BGFX_DIR, "3rdparty/khronos"), } @@ -220,6 +227,4 @@ function bgfxProject(_name, _kind, _defines) end configuration {} - - copyLib() end diff --git a/3rdparty/bgfx/scripts/build.ninja b/3rdparty/bgfx/scripts/build.ninja index 54b099e0b6f..f36701ea387 100644 --- a/3rdparty/bgfx/scripts/build.ninja +++ b/3rdparty/bgfx/scripts/build.ninja @@ -29,6 +29,15 @@ rule texturec_etc1 rule texturec_etc2 command = texturec -f $in -o $out -t etc2 -m +rule texturec_diffuse + command = texturec -f $in -o $out -t bc2 -m + +rule texturec_normal + command = texturec -f $in -o $out -t bc5 -m -n + +rule texturec_height + command = texturec -f $in -o $out -t r8 + pwd = ../examples/assets/meshes subninja ../examples/assets/meshes/meshes.ninja diff --git a/3rdparty/bgfx/scripts/example-common.lua b/3rdparty/bgfx/scripts/example-common.lua index f87849f3437..78fe16ed1c3 100644 --- a/3rdparty/bgfx/scripts/example-common.lua +++ b/3rdparty/bgfx/scripts/example-common.lua @@ -3,12 +3,26 @@ -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- +project ("example-glue") + kind "StaticLib" + + includedirs { + path.join(BX_DIR, "include"), + path.join(BIMG_DIR, "include"), + path.join(BGFX_DIR, "include"), + path.join(BGFX_DIR, "3rdparty"), + } + + files { + path.join(BGFX_DIR, "examples/common/example-glue.cpp"), + } + project ("example-common") - uuid ("21cc0e26-bf62-11e2-a01e-0291bd4c8125") kind "StaticLib" includedirs { - path.join(BX_DIR, "include"), + path.join(BX_DIR, "include"), + path.join(BIMG_DIR, "include"), path.join(BGFX_DIR, "include"), path.join(BGFX_DIR, "3rdparty"), } @@ -23,6 +37,10 @@ project ("example-common") path.join(BGFX_DIR, "examples/common/**.h"), } + removefiles { + path.join(BGFX_DIR, "examples/common/example-glue.cpp"), + } + if _OPTIONS["with-scintilla"] then defines { "SCI_NAMESPACE", diff --git a/3rdparty/bgfx/scripts/genie.lua b/3rdparty/bgfx/scripts/genie.lua index a01d7fe068a..cacec034e8a 100644 --- a/3rdparty/bgfx/scripts/genie.lua +++ b/3rdparty/bgfx/scripts/genie.lua @@ -44,6 +44,11 @@ newoption { } newoption { + trigger = "with-combined-examples", + description = "Enable building examples (combined as single executable).", +} + +newoption { trigger = "with-examples", description = "Enable building examples.", } @@ -73,6 +78,7 @@ solution "bgfx" MODULE_DIR = path.getabsolute("../") BGFX_DIR = path.getabsolute("..") BX_DIR = os.getenv("BX_DIR") +BIMG_DIR = os.getenv("BIMG_DIR") local BGFX_BUILD_DIR = path.join(BGFX_DIR, ".build") local BGFX_THIRD_PARTY_DIR = path.join(BGFX_DIR, "3rdparty") @@ -80,8 +86,20 @@ if not BX_DIR then BX_DIR = path.getabsolute(path.join(BGFX_DIR, "../bx")) end -if not os.isdir(BX_DIR) then - print("bx not found at " .. BX_DIR) +if not BIMG_DIR then + BIMG_DIR = path.getabsolute(path.join(BGFX_DIR, "../bimg")) +end + +if not os.isdir(BX_DIR) or not os.isdir(BIMG_DIR) then + + if not os.isdir(BX_DIR) then + print("bx not found at " .. BX_DIR) + end + + if not os.isdir(BIMG_DIR) then + print("bimg not found at " .. BIMG_DIR) + end + print("For more info see: https://bkaradzic.github.io/bgfx/build.html") os.exit() end @@ -105,45 +123,32 @@ end if _OPTIONS["with-profiler"] then defines { "ENTRY_CONFIG_PROFILER=1", - "BGFX_CONFIG_PROFILER_REMOTERY=1", - "_WINSOCKAPI_" + "BGFX_CONFIG_PROFILER=1", } end -function exampleProject(_name) - - project ("example-" .. _name) - uuid (os.uuid("example-" .. _name)) - kind "WindowedApp" - - configuration {} +function exampleProjectDefaults() debugdir (path.join(BGFX_DIR, "examples/runtime")) includedirs { path.join(BX_DIR, "include"), + path.join(BIMG_DIR, "include"), path.join(BGFX_DIR, "include"), path.join(BGFX_DIR, "3rdparty"), path.join(BGFX_DIR, "examples/common"), } - files { - path.join(BGFX_DIR, "examples", _name, "**.c"), - path.join(BGFX_DIR, "examples", _name, "**.cpp"), - path.join(BGFX_DIR, "examples", _name, "**.h"), - } - - removefiles { - path.join(BGFX_DIR, "examples", _name, "**.bin.h"), - } - flags { "FatalWarnings", } links { "example-common", + "example-glue", "bgfx", + "bimg_decode", + "bimg", "bx", } @@ -308,8 +313,8 @@ function exampleProject(_name) configuration { "rpi" } links { "X11", - "GLESv2", - "EGL", + "brcmGLESv2", + "brcmEGL", "bcm_host", "vcos", "vchiq_arm", @@ -347,6 +352,7 @@ function exampleProject(_name) path.join(BGFX_DIR, "examples/runtime/tvOS-Info.plist"), } + configuration { "qnx*" } targetextension "" links { @@ -359,56 +365,127 @@ function exampleProject(_name) strip() end +function exampleProject(_combined, ...) + + if _combined then + + project ("examples") + uuid (os.uuid("examples")) + kind "WindowedApp" + + for _, name in ipairs({...}) do + + files { + path.join(BGFX_DIR, "examples", name, "**.c"), + path.join(BGFX_DIR, "examples", name, "**.cpp"), + path.join(BGFX_DIR, "examples", name, "**.h"), + } + + removefiles { + path.join(BGFX_DIR, "examples", name, "**.bin.h"), + } + + end + + files { + path.join(BGFX_DIR, "examples/25-c99/helloworld.c"), -- hack for _main_ + } + + exampleProjectDefaults() + + else + + for _, name in ipairs({...}) do + project ("example-" .. name) + uuid (os.uuid("example-" .. name)) + kind "WindowedApp" + + files { + path.join(BGFX_DIR, "examples", name, "**.c"), + path.join(BGFX_DIR, "examples", name, "**.cpp"), + path.join(BGFX_DIR, "examples", name, "**.h"), + } + + removefiles { + path.join(BGFX_DIR, "examples", name, "**.bin.h"), + } + + defines { + "ENTRY_CONFIG_IMPLEMENT_MAIN=1", + } + + exampleProjectDefaults() + end + end + +end + dofile "bgfx.lua" group "libs" bgfxProject("", "StaticLib", {}) -dofile(path.join(BX_DIR, "scripts/bx.lua")) +dofile(path.join(BX_DIR, "scripts/bx.lua")) +dofile(path.join(BIMG_DIR, "scripts/bimg.lua")) +dofile(path.join(BIMG_DIR, "scripts/bimg_decode.lua")) + +if _OPTIONS["with-tools"] then + dofile(path.join(BIMG_DIR, "scripts/bimg_encode.lua")) +end -if _OPTIONS["with-examples"] or _OPTIONS["with-tools"] then +if _OPTIONS["with-examples"] +or _OPTIONS["with-combined-examples"] +or _OPTIONS["with-tools"] then group "examples" dofile "example-common.lua" end -if _OPTIONS["with-examples"] then +if _OPTIONS["with-examples"] +or _OPTIONS["with-combined-examples"] then group "examples" - exampleProject("00-helloworld") - exampleProject("01-cubes") - exampleProject("02-metaballs") - exampleProject("03-raymarch") - exampleProject("04-mesh") - exampleProject("05-instancing") - exampleProject("06-bump") - exampleProject("07-callback") - exampleProject("08-update") - exampleProject("09-hdr") - exampleProject("10-font") - exampleProject("11-fontsdf") - exampleProject("12-lod") - exampleProject("13-stencil") - exampleProject("14-shadowvolumes") - exampleProject("15-shadowmaps-simple") - exampleProject("16-shadowmaps") - exampleProject("17-drawstress") - exampleProject("18-ibl") - exampleProject("19-oit") - exampleProject("20-nanovg") - exampleProject("21-deferred") - exampleProject("22-windows") - exampleProject("23-vectordisplay") - exampleProject("24-nbody") - exampleProject("26-occlusion") - exampleProject("27-terrain") - exampleProject("28-wireframe") - exampleProject("29-debugdraw") - exampleProject("30-picking") - exampleProject("31-rsm") - exampleProject("32-particles") + + exampleProject(_OPTIONS["with-combined-examples"] + , "00-helloworld" + , "01-cubes" + , "02-metaballs" + , "03-raymarch" + , "04-mesh" + , "05-instancing" + , "06-bump" + , "07-callback" + , "08-update" + , "09-hdr" + , "10-font" + , "11-fontsdf" + , "12-lod" + , "13-stencil" + , "14-shadowvolumes" + , "15-shadowmaps-simple" + , "16-shadowmaps" + , "17-drawstress" + , "18-ibl" + , "19-oit" + , "20-nanovg" + , "21-deferred" + , "22-windows" + , "23-vectordisplay" + , "24-nbody" + , "26-occlusion" + , "27-terrain" + , "28-wireframe" + , "29-debugdraw" + , "30-picking" + , "31-rsm" + , "32-particles" + , "33-pom" + , "34-mvs" + , "35-dynamic" + , "36-sky" + ) -- C99 source doesn't compile under WinRT settings if not premake.vstudio.iswinrt() then - exampleProject("25-c99") + exampleProject(false, "25-c99") end end diff --git a/3rdparty/bgfx/scripts/geometryc.lua b/3rdparty/bgfx/scripts/geometryc.lua index 902b310caf8..e4fbd909ee2 100644 --- a/3rdparty/bgfx/scripts/geometryc.lua +++ b/3rdparty/bgfx/scripts/geometryc.lua @@ -4,7 +4,7 @@ -- project "geometryc" - uuid "8794dc3a-2d57-11e2-ba18-368d09e48fda" + uuid (os.uuid("geometryc")) kind "ConsoleApp" includedirs { @@ -31,12 +31,20 @@ project "geometryc" configuration { "mingw-*" } targetextension ".exe" + links { + "psapi", + } configuration { "osx" } links { "Cocoa.framework", } + configuration { "vs20*" } + links { + "psapi", + } + configuration {} strip() diff --git a/3rdparty/bgfx/scripts/shader.mk b/3rdparty/bgfx/scripts/shader.mk index 4a695d070c0..86cbf79aaa6 100644 --- a/3rdparty/bgfx/scripts/shader.mk +++ b/3rdparty/bgfx/scripts/shader.mk @@ -116,19 +116,9 @@ CS_BIN = $(addprefix $(BUILD_INTERMEDIATE_DIR)/, $(addsuffix .bin, $(basename $( BIN = $(VS_BIN) $(FS_BIN) ASM = $(VS_ASM) $(FS_ASM) -ifeq ($(TARGET), 1) -BIN += $(CS_BIN) -ASM += $(CS_ASM) -else -ifeq ($(TARGET), 3) +ifeq ($(TARGET), $(filter $(TARGET),1 3 4 6)) BIN += $(CS_BIN) ASM += $(CS_ASM) -else -ifeq ($(TARGET), 4) -BIN += $(CS_BIN) -ASM += $(CS_ASM) -endif -endif endif $(BUILD_INTERMEDIATE_DIR)/vs_%.bin : $(SHADERS_DIR)vs_%.sc diff --git a/3rdparty/bgfx/scripts/shaderc.lua b/3rdparty/bgfx/scripts/shaderc.lua index 300c4c6a484..d61ace02c4a 100644 --- a/3rdparty/bgfx/scripts/shaderc.lua +++ b/3rdparty/bgfx/scripts/shaderc.lua @@ -213,13 +213,19 @@ project "fcpp" "/wd4706", -- warning C4706: assignment within conditional expression } + configuration { "not vs*" } + buildoptions { + "-Wno-implicit-fallthrough", + } + configuration {} project "shaderc" kind "ConsoleApp" includedirs { - path.join(BX_DIR, "include"), + path.join(BX_DIR, "include"), + path.join(BIMG_DIR, "include"), path.join(BGFX_DIR, "include"), path.join(BGFX_DIR, "3rdparty/dxsdk/include"), diff --git a/3rdparty/bgfx/scripts/texturec.lua b/3rdparty/bgfx/scripts/texturec.lua index 07184ed7d1b..e229293e3e2 100644 --- a/3rdparty/bgfx/scripts/texturec.lua +++ b/3rdparty/bgfx/scripts/texturec.lua @@ -4,52 +4,39 @@ -- project "texturec" - uuid "838801ee-7bc3-11e1-9f19-eae7d36e7d26" + uuid (os.uuid("texturec")) kind "ConsoleApp" includedirs { - path.join(BX_DIR, "include"), + path.join(BX_DIR, "include"), + path.join(BIMG_DIR, "include"), path.join(BGFX_DIR, "include"), - path.join(BGFX_DIR, "src"), - path.join(BGFX_DIR, "3rdparty"), - path.join(BGFX_DIR, "3rdparty/nvtt"), - path.join(BGFX_DIR, "3rdparty/iqa/include"), + path.join(BIMG_DIR, "3rdparty/iqa/include"), } files { - path.join(BGFX_DIR, "src/image.*"), - path.join(BGFX_DIR, "3rdparty/libsquish/**.cpp"), - path.join(BGFX_DIR, "3rdparty/libsquish/**.h"), - path.join(BGFX_DIR, "3rdparty/edtaa3/**.cpp"), - path.join(BGFX_DIR, "3rdparty/edtaa3/**.h"), - path.join(BGFX_DIR, "3rdparty/etc1/**.cpp"), - path.join(BGFX_DIR, "3rdparty/etc1/**.h"), - path.join(BGFX_DIR, "3rdparty/etc2/**.cpp"), - path.join(BGFX_DIR, "3rdparty/etc2/**.hpp"), - path.join(BGFX_DIR, "3rdparty/nvtt/**.cpp"), - path.join(BGFX_DIR, "3rdparty/nvtt/**.h"), - path.join(BGFX_DIR, "3rdparty/pvrtc/**.cpp"), - path.join(BGFX_DIR, "3rdparty/pvrtc/**.h"), - path.join(BGFX_DIR, "3rdparty/tinyexr/**.h"), - path.join(BGFX_DIR, "3rdparty/iqa/include/**.h"), - path.join(BGFX_DIR, "3rdparty/iqa/source/**.c"), - path.join(BGFX_DIR, "tools/texturec/**.cpp"), - path.join(BGFX_DIR, "tools/texturec/**.h"), + path.join(BIMG_DIR, "tools/texturec/texturec.cpp"), } links { + "bimg_decode", + "bimg_encode", + "bimg", "bx", } configuration { "mingw-*" } targetextension ".exe" + links { + "psapi", + } configuration { "osx" } links { "Cocoa.framework", } - configuration { "vs20* or mingw*" } + configuration { "vs20*" } links { "psapi", } diff --git a/3rdparty/bgfx/scripts/texturev.lua b/3rdparty/bgfx/scripts/texturev.lua index fe08f59d6d4..4443391a27d 100644 --- a/3rdparty/bgfx/scripts/texturev.lua +++ b/3rdparty/bgfx/scripts/texturev.lua @@ -6,6 +6,7 @@ project ("texturev") includedirs { path.join(BX_DIR, "include"), + path.join(BIMG_DIR, "include"), path.join(BGFX_DIR, "include"), path.join(BGFX_DIR, "3rdparty"), path.join(BGFX_DIR, "examples/common"), @@ -19,6 +20,8 @@ project ("texturev") links { "example-common", + "bimg_decode", + "bimg", "bgfx", "bx", } |