@@ -169,14 +169,19 @@ set(CUDA_PROPAGATE_HOST_FLAGS OFF)
169
169
170
170
# Release/Debug flags set by cmake. Such as -O3 -g -DNDEBUG etc.
171
171
# So, don't set these flags here.
172
+ if (NOT WIN32 ) # windows msvc2015 support c++11 natively.
173
+ # -std=c++11 -fPIC not recoginize by msvc, -Xcompiler will be added by cmake.
172
174
list (APPEND CUDA_NVCC_FLAGS "-std=c++11" )
173
- list (APPEND CUDA_NVCC_FLAGS "--use_fast_math" )
174
175
list (APPEND CUDA_NVCC_FLAGS "-Xcompiler -fPIC" )
176
+ endif (NOT WIN32 )
177
+
178
+ list (APPEND CUDA_NVCC_FLAGS "--use_fast_math" )
175
179
# in cuda9, suppress cuda warning on eigen
176
180
list (APPEND CUDA_NVCC_FLAGS "-w" )
177
181
# Set :expt-relaxed-constexpr to suppress Eigen warnings
178
182
list (APPEND CUDA_NVCC_FLAGS "--expt-relaxed-constexpr" )
179
183
184
+ if (NOT WIN32 )
180
185
if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
181
186
list (APPEND CUDA_NVCC_FLAGS ${CMAKE_CXX_FLAGS_DEBUG} )
182
187
elseif (CMAKE_BUILD_TYPE STREQUAL "Release" )
@@ -187,6 +192,13 @@ elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
187
192
# nvcc 9 does not support -Os. Use Release flags instead
188
193
list (APPEND CUDA_NVCC_FLAGS ${CMAKE_CXX_FLAGS_RELEASE} )
189
194
endif ()
195
+ else (NOT WIN32 )
196
+ if (CMAKE_BUILD_TYPE STREQUAL "Release" )
197
+ list (APPEND CUDA_NVCC_FLAGS "-O3 -DNDEBUG" )
198
+ else ()
199
+ message (FATAL "Windows only support Release build now. Please set visual studio build type to Release, x64 build." )
200
+ endif ()
201
+ endif (NOT WIN32 )
190
202
191
203
mark_as_advanced (CUDA_BUILD_CUBIN CUDA_BUILD_EMULATION CUDA_VERBOSE_BUILD )
192
204
mark_as_advanced (CUDA_SDK_ROOT_DIR CUDA_SEPARABLE_COMPILATION )
0 commit comments