Check MSVC version before adding flags (#419)

This was originally started as an effort to
fix the Windows+CUDA build, in which case
these special flags need to be added differently
when CUDA is used.
However, they were there to workaround issues in
earlier MSVC versions that today's version doesn't
have, so the changes here actually just check
whether the MSVC being used is old enough to need
these workarounds.
Since using CUDA and MSVC through CMake is relatively
new, there shouldn't be a need to support these
workarounds with CUDA
This commit is contained in:
Dan Ibanez 2021-06-29 12:41:47 -06:00 committed by GitHub
parent e7e2ab36a6
commit 89521dcbf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -387,25 +387,29 @@ endif (HYPRE_USING_OPENMP)
if (MSVC)
target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
# Use the C++ compiler to compile these files to get around lack of C99 support
set_source_files_properties(utilities/hopscotch_hash.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(utilities/merge_sort.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(seq_mv/csr_matop.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_mv/par_csr_matop.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_mv/par_csr_matvec.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/ams.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/aux_interp.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_add_cycle.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_amg_setup.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_coarsen.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_cgc_coarsen.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_jacobi_interp.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_mgr_setup.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_rap.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_relax.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_strength.c PROPERTIES COMPILE_FLAGS /TP)
#Fix issue with visual studio 2013
set_source_files_properties(struct_ls/pfmg3_setup_rap.c PROPERTIES COMPILE_FLAGS /Od)
if (MSVC_VERSION LESS 1928) # Visual Studio 2019 version 16.8 claims full C11 support
# Use the C++ compiler to compile these files to get around lack of C99 support
set_source_files_properties(utilities/hopscotch_hash.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(utilities/merge_sort.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(seq_mv/csr_matop.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_mv/par_csr_matop.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_mv/par_csr_matvec.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/ams.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/aux_interp.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_add_cycle.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_amg_setup.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_coarsen.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_cgc_coarsen.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_jacobi_interp.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_mgr_setup.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_rap.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_relax.c PROPERTIES COMPILE_FLAGS /TP)
set_source_files_properties(parcsr_ls/par_strength.c PROPERTIES COMPILE_FLAGS /TP)
endif()
if (MSVC_VERSION LESS 1900) #1900 is studio 2015, next older is 1800 which is studio 2013
#Fix issue with visual studio 2013
set_source_files_properties(struct_ls/pfmg3_setup_rap.c PROPERTIES COMPILE_FLAGS /Od)
endif()
endif ()
if (HYPRE_USING_FEI)