diff --git a/External/SPEC/CFP2017speed/628.pop2_s/CMakeLists.txt b/External/SPEC/CFP2017speed/628.pop2_s/CMakeLists.txt --- a/External/SPEC/CFP2017speed/628.pop2_s/CMakeLists.txt +++ b/External/SPEC/CFP2017speed/628.pop2_s/CMakeLists.txt @@ -6,25 +6,9 @@ ninja_required() -speccpu2017_benchmark(SPEED) +speccpu2017_convert_bigendian_required() -# Check if compiler can support big-endian IO format, if true proceed -# otherwise, return immediately. This is due to some binary input -# files stored in big-endian format -if (ENDIAN STREQUAL "little") - # GCC - check_fortran_compiler_flag("-fconvert=big-endian" SUPPORTS_FCONVERT_BIG_ENDIAN) - # Intel - check_fortran_compiler_flag("-convert big_endian" SUPPORTS_CONVERT_BIG_ENDIAN) - # Flang - # TBD - if (NOT SUPPORTS_FCONVERT_BIG_ENDIAN) - elseif (NOT SUPPORTS_CONVERT_BIG_ENDIAN) - else () - message(WARN "628.pop2_s not supported. No way to read big-endian binary IO on little-endian architecture.") - return () - endif () -endif () +speccpu2017_benchmark(SPEED) macro(pop2_prepare_rundir) # Re-use the speccpu2017_prepare_rundir but then implement an input @@ -137,7 +121,7 @@ file(GLOB POP2_F90_SRCS ${SRC_DIR}/*.F90) list(REMOVE_ITEM POP2_F90_SRCS ${SRC_DIR}/test.F90) -speccpu2017_run_specpp( +speccpu2017_run_specpp(SPECPP_TARGET ${PROG} SPECPP_SRCS ${POP2_F90_SRCS} SPECPP_DEFS -D_MPISERIAL -D_NETCDF diff --git a/External/SPEC/SpecCPU2017.cmake b/External/SPEC/SpecCPU2017.cmake --- a/External/SPEC/SpecCPU2017.cmake +++ b/External/SPEC/SpecCPU2017.cmake @@ -368,7 +368,7 @@ # https://www.spec.org/cpu2017/Docs/specpp.html # specpp is needed due to legacy use of filepp by climate/weather codes. macro(speccpu2017_run_specpp) - cmake_parse_arguments(_arg "" "" "SPECPP_SRCS;SPECPP_DEFS" ${ARGN}) + cmake_parse_arguments(_arg "" "SPECPP_TARGET" "SPECPP_SRCS;SPECPP_DEFS" ${ARGN}) set(_specpp_bin ${TEST_SUITE_SPEC2017_ROOT}/bin/specpp) # Add common specpp arguments used by all SPEC CPU 2017 tests. # -U__FILE__ is included as a work around. Source files uses _FILE_ @@ -391,6 +391,27 @@ DEPENDS "${_absfilename}" VERBATIM ) - target_sources(${PROG} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${_filename}") + target_sources(${_arg_SPECPP_TARGET} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/${_filename}") endforeach () endmacro() + + +# Check if compiler can support big-endian IO format, if true proceed +# otherwise, return immediately. This is due to some binary input +# files stored in big-endian format that are required by the SPEC tests +macro(speccpu2017_convert_bigendian_required) + if (ENDIAN STREQUAL "little") + # GCC + check_fortran_compiler_flag("-fconvert=big-endian" SUPPORTS_FCONVERT_BIG_ENDIAN) + # Intel + check_fortran_compiler_flag("-convert big_endian" SUPPORTS_CONVERT_BIG_ENDIAN) + # Flang + # TBD + if (NOT SUPPORTS_FCONVERT_BIG_ENDIAN) + elseif (NOT SUPPORTS_CONVERT_BIG_ENDIAN) + else () + message(WARN "Test not supported. No way to read big-endian binary IO on little-endian architecture.") + return () + endif () + endif () +endmacro ()