diff options
Diffstat (limited to 'premake5.lua')
| -rw-r--r-- | premake5.lua | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/premake5.lua b/premake5.lua index edcd56b4e..c7ed254cb 100644 --- a/premake5.lua +++ b/premake5.lua @@ -220,6 +220,14 @@ newoption { allowed = { { "true", "True"}, { "false", "False" } } } +newoption { + trigger = "enable-aftermath", + description = "(Optional) Enable aftermath in GFX, and add aftermath crash example to project", + value = "bool", + default = "false", + allowed = { { "true", "True"}, { "false", "False" } } +} + buildLocation = _OPTIONS["build-location"] executeBinary = (_OPTIONS["execute-binary"] == "true") buildGlslang = (_OPTIONS["build-glslang"] == "true") @@ -236,6 +244,7 @@ deployGLSLang = (_OPTIONS["deploy-slang-glslang"] == "true") fullDebugValidation = (_OPTIONS["full-debug-validation"] == "true") enableAsan = (_OPTIONS["enable-asan"] == "true") dxOnVk = (_OPTIONS["dx-on-vk"] == "true") +enableAftermath = (_OPTIONS["enable-aftermath"] == "true") -- If stdlib embedding is enabled, disable stdlib source embedding by default disableStdlibSource = enableEmbedStdLib @@ -245,6 +254,17 @@ if enableEmbedStdLib and _OPTIONS["disable-stdlib-source"] ~= nil then disableStdlibSource = (_OPTIONS["disable-stdlib-source"] == "true") end +if enableAftermath then + aftermathPath = "external/nv-aftermath" + + if not os.isfile(path.join(aftermathPath, "nsight-aftermath-usage-guidelines.txt")) then + print("external/nv-aftermath directory must hold aftermath SDK") + os.exit(0) + end + + printf("Enabled aftermath") +end + -- Determine the target info targetInfo = slangUtil.getTargetInfo() @@ -809,6 +829,40 @@ example "cpu-com-example" example "cpu-hello-world" kind "ConsoleApp" +if enableAftermath then + example "nv-aftermath-example" + filter {} + + local aftermathIncludePath = path.join(aftermathPath, "include") + local aftermathLibPath = path.join(aftermathPath, "lib") + + -- Add the aftermath includes + + includedirs { aftermathIncludePath } + + -- Add the libs directory. + -- Additionally we need to copy dlls that are needed for aftermath usage such that they + -- are available from the executable. + + filter { "platforms:x86" } + local libPath = path.join(aftermathLibPath, "x86") + libdirs { libPath } + links { "GFSDK_Aftermath_Lib.x86" } + + postbuildcommands { + '{COPY} "$(SolutionDir)"' .. libPath .. '/*.* "%{cfg.targetdir}"' + } + + filter { "platforms:x64" } + local libPath = path.join(aftermathLibPath, "x64") + libdirs { libPath } + links { "GFSDK_Aftermath_Lib.x64" } + + postbuildcommands { + '{COPY} "$(SolutionDir)"' .. libPath .. '/*.* "%{cfg.targetdir}"' + } +end + -- Most of the other projects have more interesting configuration going -- on, so let's walk through them in order of increasing complexity. -- @@ -1024,6 +1078,34 @@ tool "gfx" '{COPY} "' .. path.getabsolute("tools/gfx/slang.slang") .. '" "%{cfg.targetdir}"', } end + + -- If aftermath is enabled we need a define to turn on debugging features withing GFX + + if enableAftermath then + defines { "GFX_NV_AFTERMATH" } + + local aftermathIncludePath = path.join(aftermathPath, "include") + local aftermathLibPath = path.join(aftermathPath, "lib") + + -- Add the aftermath includes + includedirs { aftermathIncludePath } + + -- Add the libs + -- + -- We don't copy the dlls as that is something the application should do. + + filter { "platforms:x86" } + local libPath = path.join(aftermathLibPath, "x86") + libdirs { libPath } + links { "GFSDK_Aftermath_Lib.x86" } + + filter { "platforms:x64" } + local libPath = path.join(aftermathLibPath, "x64") + libdirs { libPath } + links { "GFSDK_Aftermath_Lib.x64" } + + end + -- To special case that we may be building using cygwin on windows. If 'true windows' we build for dx12/vk and run the script -- If not we assume it's a cygwin/mingw type situation and remove files that aren't appropriate if targetInfo.isWindows then |
