Unverified Commit 4d51ffd3 authored by Graham, Aaron's avatar Graham, Aaron Committed by GitHub
Browse files

Add CheckMPIF2008StandardCompiles and switch Futility_Configurations … (#326)

* Add CheckMPIF2008StandardCompiles and switch Futility_Configurations to use it

* Specify full path to fortran standard check function
parent ef0deee4
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
#   Futility Development Group    !
#              All rights reserved.           !
#                         !
# Futility is a jointly-maintained, open-source project between the University !
# of Michigan and Oak Ridge National Laboratory.  The copyright and license !
# can be found in LICENSE.txt in the head directory of this repository.   !
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
FUNCTION(CHECK_MPI_F2008_STANDARD_COMPILES )
SET(CHECK_TEST_SOURCE
"
PROGRAM main
INCLUDE 'mpif.h'
WRITE(*,*) 'HELLO WORLD'
ENDPROGRAM
"
)
IF(TPL_ENABLE_MPI AND NOT DEFINED MPI_F2008_STANDARD_COMPLIANT)
IF("3.1.3" VERSION_GREATER CMAKE_VERSION)
MESSAGE(STATUS "Skipping check if MPI is F2008 standard compliant")
GLOBAL_SET(MPI_F2008_STANDARD_COMPLIANT TRUE)
ELSE()
#CMake module "CHECK_Fortran_SOURCE_COMPILERS" is only available in
#version 3.1.3 and later
INCLUDE(CheckFortranSourceCompiles)
#Determine appropriate flag for compiler test
IF(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR
(MSVC_IDE AND "${CMAKE_Fortran_COMPILER}" STREQUAL "ifort"))
IF("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
SET(FSTDFLAG "/std:f08")
ELSE()
SET(FSTDFLAG "-std f08")
ENDIF()
ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
SET(FSTDFLAG "-std=f2008")
# ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
# SET(FSTDFLAG "-Mstandard")
# ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
# SET(FSTDFLAG "-e n")
# ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "IBM")
#
# ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "Pathscale")
#
ENDIF()
SET(OLD_CRF ${CMAKE_REQUIRED_FLAGS})
SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} ${FSTDFLAG})
CHECK_Fortran_SOURCE_COMPILES(${CHECK_TEST_SOURCE}
MPI_F2008_STANDARD_COMPILES)
IF(MPI_F2008_STANDARD_COMPILES)
GLOBAL_SET(MPI_F2008_STANDARD_COMPLIANT TRUE)
ELSE()
GLOBAL_SET(MPI_F2008_STANDARD_COMPLIANT FALSE)
ENDIF()
SET(CMAKE_REQUIRED_FLAGS ${OLD_CRF})
ENDIF()
ELSE()
IF(TPL_ENABLE_MPI)
MESSAGE(STATUS
"MPI F2008 standard compliance already set as: "
${MPI_F2008_STANDARD_COMPLIANT}
)
ELSE()
GLOBAL_SET(MPI_F2008_STANDARD_COMPLIANT TRUE)
ENDIF()
ENDIF()
ENDFUNCTION()
......@@ -6,7 +6,7 @@
# of Michigan and Oak Ridge National Laboratory.  The copyright and license !
# can be found in LICENSE.txt in the head directory of this repository.   !
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++!
INCLUDE(CheckMPIF2003StandardCompiles)
INCLUDE(${Futility_SOURCE_DIR}/cmake/CheckMPIF2008StandardCompiles.cmake)
IF(${PROJECT_NAME}_VERBOSE_CONFIGURE)
MESSAGE("Configuring Futility compiler options for:")
PRINT_VAR(PACKAGE_NAME)
......@@ -110,14 +110,14 @@ ENDIF()
# Check if MPI supports Fortran 2003 standard
IF(${PROJECT_NAME}_BUILD_STANDARD)
CHECK_MPI_F2003_STANDARD_COMPILES()
IF(${PROJECT_NAME}_BUILD_STANDARD AND NOT MPI_F2003_STANDARD_COMPLIANT)
MESSAGE(STATUS "Disabling F2003 Standard since MPI install is not F2003 compliant")
GLOBAL_SET(${PROJECT_NAME}_BUILD_STANDARD ${MPI_F2003_STANDARD_COMPLIANT})
CHECK_MPI_F2008_STANDARD_COMPILES()
IF(${PROJECT_NAME}_BUILD_STANDARD AND NOT MPI_F2008_STANDARD_COMPLIANT)
MESSAGE(STATUS "Disabling F2008 Standard since MPI install is not F2008 compliant")
GLOBAL_SET(${PROJECT_NAME}_BUILD_STANDARD ${MPI_F2008_STANDARD_COMPLIANT})
ENDIF()
ELSE()
IF(${PACKAGE_NAME} STREQUAL "Futility")
MESSAGE(STATUS "Project has disabled F2003 standard compilation")
MESSAGE(STATUS "Project has disabled F2008 standard compilation")
ENDIF()
ENDIF()
......@@ -145,7 +145,7 @@ IF(CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" OR
IF(${PROJECT_NAME}_BUILD_STANDARD)
SET(Fortran_FLAGS
${Fortran_FLAGS}
${CSYM}stand${s}f03
${CSYM}stand${s}f08
)
ENDIF()
......@@ -242,7 +242,7 @@ ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
IF(${PROJECT_NAME}_BUILD_STANDARD)
SET(Fortran_FLAGS
${Fortran_FLAGS}
${CSYM}std=f2003
${CSYM}std=f2008
)
ENDIF()
......@@ -307,7 +307,7 @@ ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "PGI")
${CSYM}Mallocatable=03
${CSYM}pgf90libs
)
## TODO: Figure out what sets 2003 standard for PGI and add same if statement for Futility_BUILD_NOSTANDARD
## TODO: Figure out what sets 2008 standard for PGI and add same if statement for Futility_BUILD_NOSTANDARD
SET(Fortran_FLAGS_DEBUG
${CSYM}g
${CSYM}Mbounds
......@@ -355,7 +355,7 @@ ELSEIF(CMAKE_Fortran_COMPILER_ID STREQUAL "NAG")
IF(${PROJECT_NAME}_BUILD_STANDARD)
SET(Fortran_FLAGS
${Fortran_FLAGS}
${CSYM}f2003
${CSYM}f2008
)
ENDIF()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment