Add an option to statically link cuda (#10596)
Summary:
Need to link CUDA statically for benchmarking purpose.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/10596
Reviewed By: llyfacebook
Differential Revision: D9370738
Pulled By: sf-wind
fbshipit-source-id: 4464d62473e95fe8db65b0bd3b301f262bf269bf
diff --git a/scripts/build_windows.bat b/scripts/build_windows.bat
index ebb76cc..281d20a 100644
--- a/scripts/build_windows.bat
+++ b/scripts/build_windows.bat
@@ -10,6 +10,10 @@
 SET ORIGINAL_DIR=%cd%
 SET CAFFE2_ROOT=%~dp0%..
 
+if NOT DEFINED CAFFE2_STATIC_LINK_CUDA (
+  set CAFFE2_STATIC_LINK_CUDA=OFF
+)
+
 if NOT DEFINED CMAKE_BUILD_TYPE (
   set CMAKE_BUILD_TYPE=Release
 )
@@ -57,6 +61,7 @@
   -G%CMAKE_GENERATOR% ^
   -DBUILD_TEST=OFF ^
   -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
+  -DCAFFE2_STATIC_LINK_CUDA=%CAFFE2_STATIC_LINK_CUDA% ^
   -DUSE_CUDA=%USE_CUDA% ^
   -DTORCH_CUDA_ARCH_LIST=5.0 ^
   -DUSE_NNPACK=OFF ^