diff --git a/CMake/VTKmCompilerFlags.cmake b/CMake/VTKmCompilerFlags.cmake index 1b421ce80ea4f895196bb301e29d2d038e7b8960..6c56f9d78c9da2bf99ab45e35b8b98a9444aa6af 100644 --- a/CMake/VTKmCompilerFlags.cmake +++ b/CMake/VTKmCompilerFlags.cmake @@ -56,8 +56,15 @@ endif() # Enable large object support so we can have 2^32 addressable sections if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=\"/bigobj\" -Xcudafe=\"--diag_suppress=1394 --diag_suppress=766 --display_error_number\"") + if(CMAKE_VERSION VERSION_LESS 3.11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=\"/bigobj\"") + else() + target_compile_options(vtkm_compiler_flags INTERFACE $:/bigobj>>) + if(TARGET vtkm::cuda) + target_compile_options(vtkm_compiler_flags INTERFACE $:-Xcompiler="/bigobj">>) + endif() + endif() endif() # Setup the include directories that are needed for vtkm @@ -97,7 +104,7 @@ if(VTKM_COMPILER_IS_MSVC) #CMake COMPILE_LANGUAGE doesn't work with MSVC, ans since we want these flags #only for C++ compilation we have to resort to setting CMAKE_CXX_FLAGS :( set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4702 /wd4505") - set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=\"/wd4702 /wd4505\"") + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=\"/wd4702 /wd4505\" -Xcudafe=\"--diag_suppress=1394 --diag_suppress=766 --display_error_number\"") if(MSVC_VERSION LESS 1900) # In VS2013 the C4127 warning has a bug in the implementation and @@ -116,10 +123,16 @@ elseif(VTKM_COMPILER_IS_ICC) target_compile_definitions(vtkm_developer_flags INTERFACE $<$:-wd1478 -wd13379>) elseif(VTKM_COMPILER_IS_GNU OR VTKM_COMPILER_IS_CLANG) - set(flags -Wall -Wno-long-long -Wcast-align -Wconversion -Wchar-subscripts -Wextra -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused-parameter -fno-common) + set(cxx_flags -Wall -Wno-long-long -Wcast-align -Wconversion -Wchar-subscripts -Wextra -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused-parameter -fno-common) + set(cuda_flags "-Xcudafe=\"--display_error_number\"") target_compile_options(vtkm_compiler_flags - INTERFACE $:${flags}>> + INTERFACE $:${cxx_flags}>> ) + if(TARGET vtkm::cuda) + target_compile_options(vtkm_compiler_flags + INTERFACE $:${cuda_flags}>> + ) + endif() endif() if(NOT VTKm_INSTALL_ONLY_LIBRARIES) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24d15a848d4053834fb4fbef390486195c3e07ba..70e4647fa7f8952239884bbb41fef2689eceb98a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,11 +126,14 @@ set(CMAKE_CXX_EXTENSIONS False) # Setup default build types include(VTKmBuildType) +# Include the vtk-m wrappers +include(VTKmWrappers) + # Create vtkm_compiler_flags library. This is an interface library that # holds all the C++ compiler flags that are needed for consumers and # when building VTK-m. include(VTKmCompilerFlags) -include(VTKmWrappers) + #----------------------------------------------------------------------------- # When building VTK-m it self we want to explicitly disable compiler extensions