summaryrefslogtreecommitdiffstats
path: root/premake5.lua
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-01-08 11:09:20 -0500
committerGitHub <noreply@github.com>2020-01-08 11:09:20 -0500
commitcae5ddd4a2c9343ec7367c9049c5cc0c8628a9c4 (patch)
treec8200a495f3c0bc5a841ce752fdfb13a73278faf /premake5.lua
parent17285faf9b4fe7f6c28b43972212068465bdb42e (diff)
Setup of runtime cuda device (#1162)
* CUDA generated first test compiles. * WIP on enabling CUDA in render-test. * Detect CUDA_PATH environmental variable to build build cuda support into render-test. Added WIP cuda-compute-util.cpp/h Added CUDA as a renderer type. * Fix libraries needed for cuda in premake. * Added -enable-cuda premake option. Defaults to false. * Creates CUDA device, loads PTX and finds entry point. * Fix some erroneous cruft from slang-cuda-prelude.h
Diffstat (limited to 'premake5.lua')
-rw-r--r--premake5.lua31
1 files changed, 31 insertions, 0 deletions
diff --git a/premake5.lua b/premake5.lua
index 1905bd2f4..4de256321 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -84,10 +84,26 @@ newoption {
allowed = { { "true", "True"}, { "false", "False" } }
}
+newoption {
+ trigger = "enable-cuda",
+ description = "(Optional) If true will enable cuda tests, if CUDA is found via CUDA_PATH",
+ 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")
+
+-- cudaPath is only set if cuda is enabled, and CUDA_PATH enviromental variable is set
+cudaPath = nil
+if enableCuda then
+ -- Get the CUDA path from the environment variable. If set, CUDA will be assumed installed
+ cudaPath = os.getenv("CUDA_PATH")
+end
-- Is true when the target is really windows (ie not something on top of windows like cygwin)
local isTargetWindows = (os.target() == "windows") and not (targetDetail == "mingw" or targetDetail == "cygwin")
@@ -529,6 +545,21 @@ toolSharedLibrary "render-test"
-- d3dcompiler_47.dll is copied from the external/slang-binaries submodule.
postbuildcommands { '"$(SolutionDir)tools\\copy-hlsl-libs.bat" "$(WindowsSdkDir)Redist/D3D/%{cfg.platform:lower()}/" "%{cfg.targetdir}/" "windows-%{cfg.platform:lower()}"'}
end
+
+ if type(cudaPath) == "string" and isTargetWindows then
+ addSourceDir "tools/render-test/cuda"
+ defines { "RENDER_TEST_CUDA" }
+ includedirs { cudaPath .. "/include" }
+ includedirs { cudaPath .. "/include", cudaPath .. "/common/inc" }
+
+ filter { "platforms:x86" }
+ libdirs { cudaPath .. "/lib/Win32/" }
+
+ filter { "platforms:x64" }
+ libdirs { cudaPath .. "/lib/x64/" }
+
+ links { "cuda", "cudart" }
+ end
--
-- `gfx` is a utility library for doing GPU rendering