summaryrefslogtreecommitdiffstats
path: root/premake5.lua
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-03-02 12:30:25 -0500
committerGitHub <noreply@github.com>2020-03-02 12:30:25 -0500
commitb85ca6f86d46ee3c4d5784d0bd4ebc8509e2a9bd (patch)
treee91ce5470664cbd623374534e69e4bfc8a0f1840 /premake5.lua
parent6e9f407ad42ce635528b30f21366f903903a3682 (diff)
Feature/profile tool (#1251)
* WIP slang-profile * Turn on symbols needed for profile. * Remove calls to slang API from core as doing so broke profiling information. Fix premake so slang-profile works on VS.
Diffstat (limited to 'premake5.lua')
-rw-r--r--premake5.lua41
1 files changed, 41 insertions, 0 deletions
diff --git a/premake5.lua b/premake5.lua
index 93bbd0569..ec17bd267 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -92,11 +92,20 @@ newoption {
allowed = { { "true", "True"}, { "false", "False" } }
}
+newoption {
+ trigger = "enable-profile",
+ description = "(Optional) If true will enable slang-profile tool - suitable for gprof usage on linux",
+ value = "bool",
+ default = "false",
+ allowed = { { "true", "True"}, { "false", "False" } }
+}
+
buildLocation = _OPTIONS["build-location"]
executeBinary = (_OPTIONS["execute-binary"] == "true")
targetDetail = _OPTIONS["target-detail"]
buildGlslang = (_OPTIONS["build-glslang"] == "true")
enableCuda = (_OPTIONS["enable-cuda"] == "true")
+enableProfile = (_OPTIONS["enable-profile"] == "true")
-- cudaPath is only set if cuda is enabled, and CUDA_PATH enviromental variable is set
cudaPath = nil
@@ -734,6 +743,38 @@ standardProject "slang"
buildinputs { "%{cfg.targetdir}/slang-generate" .. executableSuffix }
end
+if enableProfile then
+ tool "slang-profile"
+ uuid "375CC87D-F34A-4DF1-9607-C5C990FD6227"
+
+ -- gprof needs symbols
+ symbols "On"
+
+ dependson { "slang" }
+
+ includedirs { "external/spirv-headers/include" }
+
+ defines { "SLANG_STATIC" }
+
+ -- The `standardProject` operation already added all the code in
+ -- `source/slang/*`, but we also want to incldue the umbrella
+ -- `slang.h` header in this prject, so we do that manually here.
+ files { "slang.h" }
+
+ files { "source/core/core.natvis" }
+
+ -- Add the slang source
+ addSourceDir "source/slang"
+
+ includedirs { "." }
+ links { "core"}
+
+ filter { "system:linux" }
+ linkoptions{ "-pg" }
+ buildoptions{ "-pg" }
+
+end
+
if buildGlslang then
--