From bbd41124b7069bf259096588d1cc1d82fd74d328 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Sat, 9 May 2020 10:24:23 -0700 Subject: [PATCH] Cleanup. --- scripts/bgfx.lua | 41 +++++++++++++++++++++-------------------- scripts/genie.lua | 31 +++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 30 deletions(-) diff --git a/scripts/bgfx.lua b/scripts/bgfx.lua index aa06f4445..bae8374ba 100644 --- a/scripts/bgfx.lua +++ b/scripts/bgfx.lua @@ -163,11 +163,21 @@ function bgfxProjectBase(_kind, _defines) path.join(BGFX_DIR, "src/renderer_nvn.h"), }) - if _OPTIONS["webgpu"] then + if _OPTIONS["with-webgpu"] then defines { "BGFX_CONFIG_RENDERER_WEBGPU=1", } + local generator = "out/VS2019" + + includedirs { + path.join(DAWN_DIR, "src"), + path.join(DAWN_DIR, "src/include"), + path.join(DAWN_DIR, "third_party/vulkan-headers/include"), + path.join(DAWN_DIR, generator, "gen/src"), + path.join(DAWN_DIR, generator, "gen/src/include"), + } + configuration { "asmjs" } defines { "BGFX_CONFIG_RENDERER_OPENGL=0", @@ -176,27 +186,18 @@ function bgfxProjectBase(_kind, _defines) configuration { "not asmjs" } --local generator = "out/Default" - local generator = "out/VS2019" - includedirs { - path.join(DAWN_DIR, "src"), - path.join(DAWN_DIR, "src/include"), - path.join(DAWN_DIR, "third_party/vulkan-headers/include"), - path.join(DAWN_DIR, generator, "gen/src"), - path.join(DAWN_DIR, generator, "gen/src/include"), + configuration { "vs*" } + defines { + "NTDDI_VERSION=NTDDI_WIN10_RS2", + + -- We can't say `=_WIN32_WINNT_WIN10` here because some files do + -- `#if WINVER < 0x0600` without including windows.h before, + -- and then _WIN32_WINNT_WIN10 isn't yet known to be 0x0A00. + "_WIN32_WINNT=0x0A00", + "WINVER=0x0A00", } - configuration { "vs*" } - defines { - "NTDDI_VERSION=NTDDI_WIN10_RS2", - - -- We can't say `=_WIN32_WINNT_WIN10` here because some files do - -- `#if WINVER < 0x0600` without including windows.h before, - -- and then _WIN32_WINNT_WIN10 isn't yet known to be 0x0A00. - "_WIN32_WINNT=0x0A00", - "WINVER=0x0A00", - } - configuration {} end @@ -272,7 +273,7 @@ function bgfxProject(_name, _kind, _defines) copyLib() end -if _OPTIONS["webgpu"] then +if _OPTIONS["with-webgpu"] then function usesWebGPU() configuration { "asmjs" } linkoptions { diff --git a/scripts/genie.lua b/scripts/genie.lua index f8f16c294..357e40db2 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -3,11 +3,6 @@ -- License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause -- -newoption { - trigger = "webgpu", - description = "Enable webgpu experimental renderer.", -} - newoption { trigger = "with-amalgamated", description = "Enable amalgamated build.", @@ -53,6 +48,11 @@ newoption { description = "Enable building examples.", } +newoption { + trigger = "with-webgpu", + description = "Enable webgpu experimental renderer.", +} + newaction { trigger = "idl", description = "Generate bgfx interface source code", @@ -156,19 +156,30 @@ 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) + print("bx not found at \"" .. BX_DIR .. "\". git clone https://github.com/bkaradzic/bx?") end if not os.isdir(BIMG_DIR) then - print("bimg not found at " .. BIMG_DIR) + print("bimg not found at \"" .. BIMG_DIR .. "\". git clone https://github.com/bkaradzic/bimg?") end print("For more info see: https://bkaradzic.github.io/bgfx/build.html") os.exit() end -if _OPTIONS["webgpu"] then - DAWN_DIR = os.getenv("DAWN_DIR") +if _OPTIONS["with-webgpu"] then + DAWN_DIR = os.getenv("DAWN_DIR") + + if not DAWN_DIR then + DAWN_DIR = path.getabsolute(path.join(BGFX_DIR, "../dawn")) + end + + if not os.isdir(DAWN_DIR) then + print("Dawn not found at \"" .. DAWN_DIR .. "\". git clone https://dawn.googlesource.com/dawn?") + + print("For more info see: https://bkaradzic.github.io/bgfx/build.html") + os.exit() + end _OPTIONS["with-windows"] = "10.0" end @@ -225,7 +236,7 @@ function exampleProjectDefaults() "bx", } - if _OPTIONS["webgpu"] then + if _OPTIONS["with-webgpu"] then usesWebGPU() end