Remove the old files.
This commit was SVN r26561.
Этот коммит содержится в:
родитель
9b3ddfa7b2
Коммит
38c0de5541
@ -1,114 +0,0 @@
|
||||
# Copyright (c) 2008-2010 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
|
||||
# OMPI_FORTRAN_CHECK(Fortran type, c type required,
|
||||
# types to search, expected size)
|
||||
#----------------------------------------------------------
|
||||
# Check Fortran type, including:
|
||||
# - whether compiler supports or not
|
||||
# - size of type
|
||||
# - equal to expected size
|
||||
# - alignment
|
||||
# - associated C type
|
||||
#
|
||||
# types to search is a list of values
|
||||
|
||||
MACRO(OMPI_FORTRAN_CHECK FORTRAN_TYPE C_TYPE TYPE_LIST EXPECTED_SIZE)
|
||||
|
||||
STRING(REPLACE "*" "" TYPE_NAME ${FORTRAN_TYPE})
|
||||
STRING(REPLACE " " "_" TYPE_NAME ${TYPE_NAME})
|
||||
STRING(TOLOWER ${TYPE_NAME} TYPE_NAME_L)
|
||||
|
||||
INCLUDE(FORTRAN_check_type)
|
||||
INCLUDE(FORTRAN_get_alignment)
|
||||
INCLUDE(FORTRAN_get_sizeof)
|
||||
INCLUDE(ompi_find_type)
|
||||
|
||||
SET(ofc_expected_size ${EXPECTED_SIZE})
|
||||
SET(ofc_have_type 0)
|
||||
SET(ofc_type_size ${SIZEOF_INT})
|
||||
SET(ofc_type_alignment ${SIZEOF_INT})
|
||||
SET(ofc_c_type ${ompi_fortran_bogus_type_t})
|
||||
|
||||
IF(OMPI_WANT_FORTRAN_BINDINGS)
|
||||
IF(NOT DEFINED FORTRAN_SETUP_${TYPE_NAME}_DONE)
|
||||
|
||||
OMPI_FORTRAN_CHECK_TYPE(${FORTRAN_TYPE} ofc_have_type)
|
||||
|
||||
IF(ofc_have_type)
|
||||
# What is the size of this type?
|
||||
|
||||
# NOTE: Some Fortran compilers actually will return that a
|
||||
# type exists even if it doesn't support it -- the compiler
|
||||
# will automatically convert the unsupported type to a type
|
||||
# that it *does* support. For example, if you try to use
|
||||
# INTEGER*16 and the compiler doesn't support it, it may well
|
||||
# automatically convert it to INTEGER*8 for you (!). So we
|
||||
# have to check the actual size of the type once we determine
|
||||
# that the compiler doesn't error if we try to use it
|
||||
# (i.e,. the compiler *might* support that type). If the size
|
||||
# doesn't match the expected size, then the compiler doesn't
|
||||
# really support it.
|
||||
OMPI_FORTRAN_GET_SIZEOF(${FORTRAN_TYPE} ofc_type_size)
|
||||
|
||||
IF(NOT ${ofc_expected_size} STREQUAL "-1" AND NOT ${ofc_type_size} EQUAL "${ofc_expected_size}")
|
||||
MESSAGE(STATUS "*** Fortran 77 ${FORTRAN_TYPE} does not have expected size!")
|
||||
MESSAGE(STATUS "*** Expected ${ofc_expected_size}, got ${ofc_type_size}")
|
||||
MESSAGE(STATUS "*** Disabling MPI support for Fortran 77 ${FORTRAN_TYPE}")
|
||||
SET(ofc_have_type 0)
|
||||
ELSE(NOT ${ofc_expected_size} STREQUAL "-1" AND NOT ${ofc_type_size} EQUAL "${ofc_expected_size}")
|
||||
# Look for a corresponding C type (will abort by itself if the
|
||||
# type isn't found and we need it)
|
||||
IF(NOT "${TYPE_LIST}" STREQUAL "")
|
||||
OMPI_FIND_TYPE(${FORTRAN_TYPE} "${TYPE_LIST}" ${C_TYPE} ${ofc_type_size} ofc_c_type)
|
||||
ENDIF(NOT "${TYPE_LIST}" STREQUAL "")
|
||||
|
||||
OMPI_FORTRAN_GET_ALIGNMENT(${FORTRAN_TYPE} ofc_type_alignment)
|
||||
|
||||
ENDIF(NOT ${ofc_expected_size} STREQUAL "-1" AND NOT ${ofc_type_size} EQUAL "${ofc_expected_size}")
|
||||
SET(FORTRAN_SETUP_${TYPE_NAME}_DONE TRUE CACHE INTERNAL "FORTRAN ${TYPE_NAME} check done or not.")
|
||||
ENDIF(ofc_have_type)
|
||||
|
||||
SET(OMPI_HAVE_FORTRAN_${TYPE_NAME}_C ${ofc_have_type} CACHE INTERNAL "OMPI_HAVE_FORTRAN_${TYPE_NAME}")
|
||||
SET(OMPI_SIZEOF_FORTRAN_${TYPE_NAME}_C ${ofc_type_size} CACHE INTERNAL "OMPI_SIZEOF_FORTRAN_${TYPE_NAME}")
|
||||
SET(OMPI_ALIGNMENT_FORTRAN_${TYPE_NAME}_C ${ofc_type_alignment} CACHE INTERNAL "OMPI_ALIGNMENT_FORTRAN_${TYPE_NAME}")
|
||||
|
||||
ENDIF(NOT DEFINED FORTRAN_SETUP_${TYPE_NAME}_DONE)
|
||||
|
||||
SET(OMPI_HAVE_FORTRAN_${TYPE_NAME} ${OMPI_HAVE_FORTRAN_${TYPE_NAME}_C}
|
||||
CACHE INTERNAL "OMPI_HAVE_FORTRAN_${TYPE_NAME}")
|
||||
SET(OMPI_SIZEOF_FORTRAN_${TYPE_NAME} ${OMPI_SIZEOF_FORTRAN_${TYPE_NAME}_C}
|
||||
CACHE INTERNAL "OMPI_SIZEOF_FORTRAN_${TYPE_NAME}")
|
||||
SET(OMPI_ALIGNMENT_FORTRAN_${TYPE_NAME} ${OMPI_ALIGNMENT_FORTRAN_${TYPE_NAME}_C}
|
||||
CACHE INTERNAL "OMPI_ALIGNMENT_FORTRAN_${TYPE_NAME}")
|
||||
|
||||
ELSEIF(NOT OMPI_WANT_FORTRAN_BINDINGS)
|
||||
UNSET(FORTRAN_SETUP_${TYPE_NAME}_DONE)
|
||||
SET(OMPI_HAVE_FORTRAN_${TYPE_NAME} ${ofc_have_type} CACHE INTERNAL "OMPI_HAVE_FORTRAN_${TYPE_NAME}")
|
||||
SET(OMPI_SIZEOF_FORTRAN_${TYPE_NAME} ${ofc_type_size} CACHE INTERNAL "OMPI_SIZEOF_FORTRAN_${TYPE_NAME}")
|
||||
SET(OMPI_ALIGNMENT_FORTRAN_${TYPE_NAME} ${ofc_type_alignment} CACHE INTERNAL "OMPI_ALIGNMENT_FORTRAN_${TYPE_NAME}")
|
||||
ENDIF(OMPI_WANT_FORTRAN_BINDINGS)
|
||||
|
||||
IF(NOT "${TYPE_LIST}" STREQUAL "")
|
||||
SET(ompi_fortran_${TYPE_NAME_L}_t ${ofc_c_type} CACHE INTERNAL "ompi_fortran_${TYPE_NAME_L}_t")
|
||||
ENDIF(NOT "${TYPE_LIST}" STREQUAL "")
|
||||
|
||||
#MESSAGE("OMPI_HAVE_FORTRAN_${TYPE_NAME}:${OMPI_HAVE_FORTRAN_${TYPE_NAME}}")
|
||||
#MESSAGE("OMPI_SIZEOF_FORTRAN_${TYPE_NAME}:${OMPI_SIZEOF_FORTRAN_${TYPE_NAME}}")
|
||||
#MESSAGE("OMPI_ALIGNMENT_FORTRAN_${TYPE_NAME}:${OMPI_ALIGNMENT_FORTRAN_${TYPE_NAME}}")
|
||||
#MESSAGE("ompi_fortran_${TYPE_NAME_L}_t:${ompi_fortran_${TYPE_NAME_L}_t}")
|
||||
|
||||
OMPI_DEF_VAR(OMPI_HAVE_FORTRAN_${TYPE_NAME} "Whether we have Fortran 77 `${FORTRAN_TYPE}' or not." 0 1)
|
||||
OMPI_DEF_VAR(OMPI_SIZEOF_FORTRAN_${TYPE_NAME} "Size of Fortran 77 `${FORTRAN_TYPE}'." 0 1)
|
||||
OMPI_DEF_VAR(OMPI_ALIGNMENT_FORTRAN_${TYPE_NAME} "Alignment of Fortran 77 `${FORTRAN_TYPE}'." 0 1)
|
||||
OMPI_DEF_VAR(ompi_fortran_${TYPE_NAME_L}_t "C type corresponding to Fortran 77 `${FORTRAN_TYPE}'." 0 0)
|
||||
|
||||
ENDMACRO(OMPI_FORTRAN_CHECK FORTRAN_TYPE C_TYPE TYPE_LIST EXPECTED_SIZE)
|
@ -1,99 +0,0 @@
|
||||
# Copyright (c) 2008-2010 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
|
||||
# OMPI_FORTRAN_CHECK_REAL16_C_EQUIV
|
||||
# ----------------------------------------------------
|
||||
MACRO(OMPI_FORTRAN_CHECK_REAL16_C_EQUIV)
|
||||
SET(OMPI_REAL16_MATCHES_C 0)
|
||||
|
||||
IF(OMPI_WANT_FORTRAN_BINDINGS AND OMPI_HAVE_FORTRAN_REAL16 AND NOT DEFINED REAL16_MATCHES_CHECK_DONE)
|
||||
IF(NOT ${ompi_fortran_real16_t} STREQUAL "")
|
||||
STRING(TOUPPER ${ompi_fortran_real16_t} REAL16_C_TYPE)
|
||||
|
||||
IF(${OMPI_SIZEOF_FORTRAN_REAL16} EQUAL SIZEOF_${REAL16_C_TYPE})
|
||||
OMPI_FORTRAN_MAKE_C_FUNCTION(ompi_ac_c_fn c)
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest_c.c
|
||||
"#include <stdio.h>\n"
|
||||
"#include <stdlib.h>\n"
|
||||
"\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"extern \"C\" {\n"
|
||||
"#endif\n"
|
||||
"void ${ompi_ac_c_fn}(${ompi_fortran_real16_t} *a) {\n"
|
||||
" ${ompi_fortran_real16_t} foo = 11; "
|
||||
" FILE *fp = fopen(\"conftestval\", \"w\");\n"
|
||||
" if (NULL == fp) exit(1);\n"
|
||||
" foo = 1 / foo;"
|
||||
" fprintf(fp, \"%s\n\", (foo == *a) ? \"yes\" : \"no\");\n"
|
||||
" fclose(fp);\n"
|
||||
"}\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"}\n"
|
||||
"#endif\n")
|
||||
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest_f.f
|
||||
"\tprogram bogus\n"
|
||||
"\tREAL*16 :: foo = 11\n"
|
||||
"\tfoo = 1 / foo\n"
|
||||
"\tcall c(foo)\n"
|
||||
"\tend program bogus\n")
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} ${OMPI_C_OPTION_COMPILE} conftest_c.c ${OMPI_C_INCLUDE_DIR}${C_COMPILER_INCLUDE}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${FORTRAN} conftest_f.f conftest_c.obj ${FORTRAN_OUTPUT_OBJ}conftest
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND conftest.exe
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
IF(RESULT)
|
||||
UNSET(REAL16_MATCHES_CHECK_DONE CACHE)
|
||||
MESSAGE(FATAL_ERROR "Can not determine if REAL*16 bit-matches C.")
|
||||
ELSE(RESULT)
|
||||
IF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval)
|
||||
# read out type size value from the file, and write back to the output variable
|
||||
FILE(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval ${OUTPUT_VARIABLE})
|
||||
MESSAGE(STATUS "Check if REAL*16 bit-matches C...${OUTPUT_VARIABLE}")
|
||||
SET(OMPI_REAL16_MATCHES_C 1)
|
||||
SET(REAL16_MATCHES_CHECK_DONE TRUE CACHE INTERNAL "Real16 matches c type check done.")
|
||||
ELSE(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval)
|
||||
UNSET(REAL16_MATCHES_CHECK_DONE CACHE)
|
||||
MESSAGE(STATUS "Check if REAL*16 bit-matches C...failed")
|
||||
ENDIF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval)
|
||||
ENDIF(RESULT)
|
||||
|
||||
ELSE(${OMPI_SIZEOF_FORTRAN_REAL16} EQUAL SIZEOF_${REAL16_C_TYPE})
|
||||
SET(REAL16_MATCHES_CHECK_DONE TRUE CACHE INTERNAL "Real16 matches c type check done.")
|
||||
MESSAGE(STATUS "Check if REAL*16 bit-matches C...skipped. (no corresponding C type)")
|
||||
ENDIF(${OMPI_SIZEOF_FORTRAN_REAL16} EQUAL SIZEOF_${REAL16_C_TYPE})
|
||||
|
||||
ELSE(NOT ${ompi_fortran_real16_t} STREQUAL "")
|
||||
SET(REAL16_MATCHES_CHECK_DONE TRUE CACHE INTERNAL "Real16 matches c type check done.")
|
||||
MESSAGE(STATUS "Check if REAL*16 bit-matches C...skipped. (no REAL*16)")
|
||||
ENDIF(NOT ${ompi_fortran_real16_t} STREQUAL "")
|
||||
|
||||
ELSEIF(NOT OMPI_WANT_FORTRAN_BINDINGS)
|
||||
UNSET(REAL16_MATCHES_CHECK_DONE CACHE)
|
||||
ENDIF(OMPI_WANT_FORTRAN_BINDINGS AND OMPI_HAVE_FORTRAN_REAL16 AND NOT DEFINED REAL16_MATCHES_CHECK_DONE)
|
||||
|
||||
OMPI_DEF_VAR(OMPI_REAL16_MATCHES_C "if REAL*16 bit-matches C." 0 1)
|
||||
|
||||
ENDMACRO(OMPI_FORTRAN_CHECK_REAL16_C_EQUIV)
|
@ -1,45 +0,0 @@
|
||||
# Copyright (c) 2008-2010 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# OMPI_FORTRAN_CHECK_TYPE
|
||||
# in: TYPE - fortran type to check.
|
||||
# out: HAVE_TYPE - 0/1 whether we have that type.
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
MACRO(OMPI_FORTRAN_CHECK_TYPE TYPE HAVE_TYPE)
|
||||
|
||||
IF(NOT DEFINED ${TYPE_NAME}_CHECK_DONE)
|
||||
|
||||
MESSAGE(STATUS "Check if Fortran 77 compiler supports ${TYPE}...")
|
||||
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_fortran_type.f
|
||||
"\t program main \n"
|
||||
"\t ${TYPE} bogus_variable \n"
|
||||
"\t END \n")
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${FORTRAN} check_fortran_type.f
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
IF(RESULT)
|
||||
SET(${HAVE_TYPE} 0 CACHE INTERNAL "have Fortran ${TYPE}")
|
||||
MESSAGE(STATUS "Check if Fortran 77 compiler supports ${TYPE}...no")
|
||||
ELSE(RESULT)
|
||||
SET(${HAVE_TYPE} 1 CACHE INTERNAL "have Fortran ${TYPE}")
|
||||
MESSAGE(STATUS "Check if Fortran 77 compiler supports ${TYPE}...yes")
|
||||
ENDIF(RESULT)
|
||||
|
||||
SET(${TYPE_NAME}_CHECK_DONE TRUE CACHE INTERNAL "${TYPE_NAME} check done")
|
||||
|
||||
ENDIF(NOT DEFINED ${TYPE_NAME}_CHECK_DONE)
|
||||
|
||||
ENDMACRO(OMPI_FORTRAN_CHECK_TYPE TYPE HAVE_TYPE)
|
@ -1,157 +0,0 @@
|
||||
# Copyright (c) 2008-2010 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
|
||||
MACRO(OMPI_FORTRAN_FIND_EXT_SYMBOL_CONVENTION)
|
||||
IF(NOT SYMBOL_CONVENTION_CHECK_DONE)
|
||||
SET(OMPI_FORTRAN_DOUBLE_UNDERSCORE 0
|
||||
CACHE INTERNAL "external symbol convention - double underscore")
|
||||
SET(OMPI_FORTRAN_SINGLE_UNDERSCORE 0
|
||||
CACHE INTERNAL "external symbol convention - single underscore")
|
||||
SET(OMPI_FORTRAN_CAPS 0
|
||||
CACHE INTERNAL "external symbol convention - captital")
|
||||
SET(OMPI_FORTRAN_PLAIN 0
|
||||
CACHE INTERNAL "external symbol convention - plain")
|
||||
|
||||
# make sure we know our linking convention...
|
||||
MESSAGE(STATUS "Check ${FORTRAN} external symbol convention...")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.f
|
||||
"\t subroutine FOO_bar(a) \n"
|
||||
"\t integer a \n"
|
||||
"\t a = 1 \n"
|
||||
"\t return \n"
|
||||
"\t end \n")
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${FORTRAN} ${FORTRAN_OPTION_COMPILE} conftest.f ${FORTRAN_OUTPUT_OBJ}conftest.lib
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
SET(OUTPUT_OBJ_FILE "conftest.lib")
|
||||
|
||||
# now run dumpbin to generate an output file
|
||||
EXECUTE_PROCESS(COMMAND ${DUMP_UTIL} ${OUTPUT_OBJ_FILE} ${DUMP_UTIL_OPT}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE DUMP_OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
STRING(REGEX MATCH foo_bar__\n DOUBLE_UNDERSCORE ${DUMP_OUTPUT})
|
||||
STRING(REGEX MATCH foo_bar_\n SINGLE_UNDERSCORE ${DUMP_OUTPUT})
|
||||
STRING(REGEX MATCH FOO_bar\n MIXED_CASE ${DUMP_OUTPUT})
|
||||
STRING(REGEX MATCH foo_bar\n NO_UNDERSCORE ${DUMP_OUTPUT})
|
||||
STRING(REGEX MATCH FOO_BAR\n UPPER_CASE ${DUMP_OUTPUT})
|
||||
|
||||
# set up the corresponding values
|
||||
IF(NOT DOUBLE_UNDERSCORE STREQUAL "")
|
||||
SET(OMPI_FORTRAN_DOUBLE_UNDERSCORE 1
|
||||
CACHE INTERNAL "external symbol convention - double underscore")
|
||||
SET(FUNC_NAME "foo_bar__")
|
||||
SET(ompi_cv_fortran_external_symbol "double underscore"
|
||||
CACHE INTERNAL "FORTRAN external symbol convention")
|
||||
ELSEIF(NOT SINGLE_UNDERSCORE STREQUAL "")
|
||||
SET(OMPI_FORTRAN_SINGLE_UNDERSCORE 1
|
||||
CACHE INTERNAL "external symbol convention - single underscore")
|
||||
SET(FUNC_NAME "foo_bar_")
|
||||
SET(ompi_cv_fortran_external_symbol "single underscore"
|
||||
CACHE INTERNAL "FORTRAN external symbol convention")
|
||||
ELSEIF(NOT MIXED_CASE STREQUAL "")
|
||||
SET(OMPI_FORTRAN_CAPS 1
|
||||
CACHE INTERNAL "external symbol convention - captital")
|
||||
SET(FUNC_NAME "FOO_bar")
|
||||
SET(ompi_cv_fortran_external_symbol "mixed case"
|
||||
CACHE INTERNAL "FORTRAN external symbol convention")
|
||||
ELSEIF(NOT NO_UNDERSCORE STREQUAL "")
|
||||
SET(OMPI_FORTRAN_PLAIN 1
|
||||
CACHE INTERNAL "external symbol convention - plain")
|
||||
SET(FUNC_NAME "foo_bar")
|
||||
SET(ompi_cv_fortran_external_symbol "no underscore"
|
||||
CACHE INTERNAL "FORTRAN external symbol convention")
|
||||
ELSEIF(NOT UPPER_CASE STREQUAL "")
|
||||
SET(OMPI_FORTRAN_CAPS 1
|
||||
CACHE INTERNAL "external symbol convention - captital")
|
||||
SET(FUNC_NAME "FOO_BAR")
|
||||
SET(ompi_cv_fortran_external_symbol "upper case"
|
||||
CACHE INTERNAL "FORTRAN external symbol convention")
|
||||
ELSE(NOT UPPER_CASE STREQUAL "")
|
||||
MESSAGE(FATAL_ERROR "unknow Fortran naming convertion.")
|
||||
SET(ompi_cv_fortran_external_symbol "unknow")
|
||||
ENDIF(NOT DOUBLE_UNDERSCORE STREQUAL "")
|
||||
|
||||
MESSAGE(STATUS "Check ${FORTRAN} external symbol convention...${ompi_cv_fortran_external_symbol}")
|
||||
|
||||
# now test if we can link the library with c program
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest_c.c
|
||||
"int main(){${FUNC_NAME}();return(0);}")
|
||||
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CMakeLists.txt
|
||||
"CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)\n"
|
||||
"PROJECT(conftest_c C)\n"
|
||||
"IF(NOT \"${FORTRAN_LIB_PATH}\" STREQUAL \"\")\n"
|
||||
" LINK_DIRECTORIES(\"${FORTRAN_LIB_PATH}\")\n"
|
||||
"ENDIF(NOT \"${FORTRAN_LIB_PATH}\" STREQUAL \"\")\n"
|
||||
"LINK_DIRECTORIES(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/)\n"
|
||||
"ADD_EXECUTABLE(conftest_c conftest_c.c)\n"
|
||||
"TARGET_LINK_LIBRARIES(conftest_c ${OUTPUT_OBJ_FILE})\n")
|
||||
|
||||
TRY_COMPILE(
|
||||
TEST_OK
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
conftest_c
|
||||
OUTPUT_VARIABLE MY_OUTPUT)
|
||||
|
||||
#MESSAGE("MY_OUTPUT:${MY_OUTPUT}")
|
||||
|
||||
IF(TEST_OK)
|
||||
SET(SYMBOL_CONVENTION_CHECK_DONE TRUE CACHE INTERNAL "Symbol convention check done.")
|
||||
ELSE(TEST_OK)
|
||||
UNSET(SYMBOL_CONVENTION_CHECK_DONE CACHE)
|
||||
MESSAGE(STATUS "${MY_OUTPUT}")
|
||||
MESSAGE(STATUS "*** Probably you have to setup the library path of the Fortran compiler.")
|
||||
MESSAGE(FATAL_ERROR "C and Fortran 77 compilers are not link compatible. Cannot continue.")
|
||||
ENDIF(TEST_OK)
|
||||
|
||||
ENDIF(NOT SYMBOL_CONVENTION_CHECK_DONE)
|
||||
|
||||
ENDMACRO(OMPI_FORTRAN_FIND_EXT_SYMBOL_CONVENTION)
|
||||
|
||||
|
||||
# return the corresponding C function name
|
||||
# OMPI_FORTRAN_MAKE_C_FUNCTION
|
||||
# in: FUNCTION_NAME -Fortran function name
|
||||
# out: OUTPUT_VARIABLE -C function name
|
||||
MACRO(OMPI_FORTRAN_MAKE_C_FUNCTION OUTPUT_VARIABLE FUNCTION_NAME)
|
||||
IF("${ompi_cv_fortran_external_symbol}" STREQUAL "double underscore")
|
||||
# so the general rule is that if there is an _ in the function
|
||||
# name, then there are two trailing underscores. Otherwise,
|
||||
# there is only one trailing underscore.
|
||||
STRING(TOLOWER ${FUNCTION_NAME} ${OUTPUT_VARIABLE})
|
||||
STRING(REGEX MATCH "_" RESULT ${FUNCTION_NAME})
|
||||
IF("${RESULT}" STREQUAL "")
|
||||
SET(${OUTPUT_VARIABLE} "${${OUTPUT_VARIABLE}}_")
|
||||
ELSE("${RESULT}" STREQUAL "")
|
||||
SET(${OUTPUT_VARIABLE} "${${OUTPUT_VARIABLE}}__")
|
||||
ENDIF("${RESULT}" STREQUAL "")
|
||||
ELSEIF("${ompi_cv_fortran_external_symbol}" STREQUAL "single underscore")
|
||||
STRING(TOLOWER ${FUNCTION_NAME} ${OUTPUT_VARIABLE})
|
||||
SET(${OUTPUT_VARIABLE} "${${OUTPUT_VARIABLE}}_")
|
||||
ELSEIF("${ompi_cv_fortran_external_symbol}" STREQUAL "mixed case")
|
||||
SET(${OUTPUT_VARIABLE} ${FUNCTION_NAME})
|
||||
ELSEIF("${ompi_cv_fortran_external_symbol}" STREQUAL "no underscore")
|
||||
STRING(TOLOWER ${FUNCTION_NAME} ${OUTPUT_VARIABLE})
|
||||
ELSEIF("${ompi_cv_fortran_external_symbol}" STREQUAL "upper case")
|
||||
STRING(TOUPPER ${FUNCTION_NAME} ${OUTPUT_VARIABLE})
|
||||
ELSE("${ompi_cv_fortran_external_symbol}" STREQUAL "double underscore")
|
||||
MESSAGE(FATAL_ERROR "unknown naming convention: ${ompi_cv_fortran_external_symbol}")
|
||||
ENDIF("${ompi_cv_fortran_external_symbol}" STREQUAL "double underscore")
|
||||
|
||||
ENDMACRO(OMPI_FORTRAN_MAKE_C_FUNCTION OUTPUT_VARIABLE FUNCTION_NAME)
|
@ -1,99 +0,0 @@
|
||||
# Copyright (c) 2008 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# OMPI_FORTRAN_GET_ALIGNMENT
|
||||
# in: TYPE - fortran type to check
|
||||
# out: ALIGNMENT - alignment to return
|
||||
# ----------------------------------------------------
|
||||
|
||||
INCLUDE(FORTRAN_find_ext_symbol_convention)
|
||||
|
||||
MACRO(OMPI_FORTRAN_GET_ALIGNMENT TYPE OUTPUT_VARIABLE)
|
||||
MESSAGE(STATUS "Check alignment of Fortran ${TYPE}...")
|
||||
|
||||
OMPI_FORTRAN_MAKE_C_FUNCTION(ompi_ac_align_fn align)
|
||||
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.f
|
||||
"\t program falign\n"
|
||||
"\t external align\n"
|
||||
"\t $1 w,x,y,z\n"
|
||||
"\t CHARACTER a,b,c\n"
|
||||
"\t common /foo/a,w,b,x,y,c,z\n"
|
||||
"\t call align(w,x,y,z)\n"
|
||||
"\t end \n")
|
||||
|
||||
IF(EXISTS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.h")
|
||||
SET(ompi_conftest_h "#include \"conftest.h\"")
|
||||
ELSE(EXISTS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.h")
|
||||
SET(ompi_conftest_h "")
|
||||
ENDIF(EXISTS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.h")
|
||||
|
||||
FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.c"
|
||||
"\t #include <stdio.h> \n"
|
||||
"\t #include <stdlib.h> \n"
|
||||
"\t $conftest \n"
|
||||
"\t \n"
|
||||
"\t #ifdef __cplusplus \n"
|
||||
"\t extern \"C\" { \n"
|
||||
"\t #endif \n"
|
||||
"\t void ${ompi_ac_align_fn}(char *w, char *x, char *y, char *z) \n"
|
||||
"\t { unsigned long aw, ax, ay, az; \n"
|
||||
"\t FILE *f=fopen(\"conftestval\", \"w\"); \n"
|
||||
"\t if (!f) exit(1); \n"
|
||||
"\t aw = (unsigned long) w; \n"
|
||||
"\t ax = (unsigned long) x; \n"
|
||||
"\t ay = (unsigned long) y; \n"
|
||||
"\t az = (unsigned long) z; \n"
|
||||
"\t if (! ((aw%16)||(ax%16)||(ay%16)||(az%16))) fprintf(f, \"%d\n\", 16); \n"
|
||||
"\t else if (! ((aw%12)||(ax%12)||(ay%12)||(az%12))) fprintf(f, \"%d\n\", 12); \n"
|
||||
"\t else if (! ((aw%8)||(ax%8)||(ay%8)||(az%8))) fprintf(f, \"%d\n\", 8); \n"
|
||||
"\t else if (! ((aw%4)||(ax%4)||(ay%4)||(az%4))) fprintf(f, \"%d\n\", 4); \n"
|
||||
"\t else if (! ((aw%2)||(ax%2)||(ay%2)||(az%2))) fprintf(f, \"%d\n\", 2); \n"
|
||||
"\t else fprintf(f, \"%d\n\", 1); \n"
|
||||
"\t fclose(f); \n"
|
||||
"\t } \n"
|
||||
"\t #ifdef __cplusplus \n"
|
||||
"\t } \n"
|
||||
"\t #endif \n"
|
||||
)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${CL_EXE} /c conftest.c /I${VC_INCLUDE_PATH}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${FORTRAN} conftest.f conftest.obj -o conftest
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND conftest.exe
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
#MESSAGE("RESULT:${RESULT}")
|
||||
|
||||
IF(RESULT)
|
||||
MESSAGE(FATAL_ERROR "Could not determine alignment of ${TYPE}.")
|
||||
ELSE(RESULT)
|
||||
IF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval)
|
||||
# read out type size value from the file, and write back to the output variable
|
||||
FILE(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval ${OUTPUT_VARIABLE})
|
||||
MESSAGE(STATUS "Check alignment of Fortran ${TYPE}...${${OUTPUT_VARIABLE}}")
|
||||
ELSE(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval)
|
||||
MESSAGE(FATAL_ERROR "Could not determine alignment of ${TYPE}.")
|
||||
ENDIF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval)
|
||||
ENDIF(RESULT)
|
||||
|
||||
ENDMACRO(OMPI_FORTRAN_GET_ALIGNMENT TYPE OUTPUT_VARIABLE)
|
@ -1,106 +0,0 @@
|
||||
# Copyright (c) 2010 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
|
||||
# OMPI_FORTRAN_GET_FORTRAN_HANDLE_MAX()
|
||||
# -------------------------------------------------------
|
||||
# Find the maximum value of fortran integers, then calculate
|
||||
# min(INT_MAX, max fortran INTEGER). This represents the maximum
|
||||
# number of fortran MPI handle index.
|
||||
MACRO(OMPI_FORTRAN_GET_FORTRAN_HANDLE_MAX)
|
||||
|
||||
#store previous value for later use.
|
||||
IF(DEFINED OMPI_FINT_MAX)
|
||||
SET(OMPI_FINT_MAX_OLD ${OMPI_FINT_MAX})
|
||||
ENDIF(DEFINED OMPI_FINT_MAX)
|
||||
|
||||
IF(NOT OMPI_WANT_FORTRAN_BINDINGS)
|
||||
SET(OMPI_FINT_MAX 0 CACHE INTERNAL "fortran int max")
|
||||
ELSE(NOT OMPI_WANT_FORTRAN_BINDINGS)
|
||||
# Calculate the number of f's that we need to append to the hex
|
||||
# value. Do one less than we really need becaue we assume the
|
||||
# top nybble is 0x7 to avoid sign issues.
|
||||
MATH(EXPR OMPI_NUMF ${OMPI_SIZEOF_FORTRAN_INTEGER}*2-1)
|
||||
SET(OMPI_FINT_MAX 0x7)
|
||||
|
||||
WHILE(${OMPI_NUMF} GREATER 0)
|
||||
SET(OMPI_FINT_MAX ${OMPI_FINT_MAX}f CACHE INTERNAL "fortran int max")
|
||||
MATH(EXPR OMPI_NUMF ${OMPI_NUMF}-1)
|
||||
ENDWHILE(${OMPI_NUMF} GREATER 0)
|
||||
ENDIF(NOT OMPI_WANT_FORTRAN_BINDINGS)
|
||||
|
||||
#OMPI_CINT_MAX doesn't change, check only once and cache the result.
|
||||
IF(NOT DEFINED CINT_MAX_CHECK_DONE)
|
||||
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_handle_max.c
|
||||
"#include <stdio.h>\n"
|
||||
"#include <limits.h>\n"
|
||||
"\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"extern \"C\" {\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" FILE *fp = fopen(\"fortran_handle_max\", \"w\");\n"
|
||||
" long cint = INT_MAX;\n"
|
||||
" fprintf(fp, \"%ld\", cint);\n"
|
||||
" fclose(fp);\n"
|
||||
"}\n"
|
||||
)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} fortran_handle_max.c ${OMPI_C_INCLUDE_DIR}${C_COMPILER_INCLUDE}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND fortran_handle_max.exe
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
IF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_handle_max)
|
||||
FILE(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_handle_max OUTPUT_VALUE)
|
||||
SET(OMPI_CINT_MAX ${OUTPUT_VALUE} CACHE INTERNAL "c int max")
|
||||
ELSE(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_handle_max)
|
||||
SET(OMPI_CINT_MAX 0)
|
||||
ENDIF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_handle_max)
|
||||
|
||||
ENDIF(NOT DEFINED CINT_MAX_CHECK_DONE)
|
||||
|
||||
#whenever OMPI_FINT_MAX changes, recalculate OMPI_FORTRAN_HANDLE_MAX
|
||||
IF(NOT DEFINED OMPI_FINT_MAX OR NOT "${OMPI_FINT_MAX}" STREQUAL "${OMPI_FINT_MAX_OLD}")
|
||||
|
||||
MESSAGE(STATUS "Check Max handle value for Fortran MPI handles...")
|
||||
|
||||
IF(${OMPI_CINT_MAX} EQUAL 0)
|
||||
# wow - something went really wrong. Be conservative
|
||||
SET(OMPI_FORTRAN_HANDLE_MAX 32767 CACHE INTERNAL "Fortran handle max")
|
||||
ELSEIF(${OMPI_FINT_MAX} EQUAL 0)
|
||||
# we aren't compiling Fortran - just set it to C INT_MAX
|
||||
SET(OMPI_FORTRAN_HANDLE_MAX ${OMPI_CINT_MAX} CACHE INTERNAL "Fortran handle max")
|
||||
ELSE(${OMPI_FINT_MAX} EQUAL 0)
|
||||
# take the lesser of C INT_MAX and Fortran INTEGER
|
||||
# max. The resulting value will then be storable in
|
||||
# either type. There's no easy way to do this in
|
||||
# the shell, so make the preprocessor do it.
|
||||
SET(OMPI_FORTRAN_HANDLE_MAX "( ${OMPI_FINT_MAX} < ${OMPI_CINT_MAX} ? ${OMPI_FINT_MAX} : ${OMPI_CINT_MAX} )" CACHE INTERNAL "Fortran handle max")
|
||||
ENDIF(${OMPI_CINT_MAX} EQUAL 0)
|
||||
|
||||
MESSAGE(STATUS "Check Max handle value for Fortran MPI handles...${OMPI_FORTRAN_HANDLE_MAX}")
|
||||
SET(FORTRAN_MAX_HANDLE_CHECK_DONE TRUE CACHE INTERNAL "Fortran handle max check done")
|
||||
|
||||
ENDIF(NOT DEFINED OMPI_FINT_MAX OR NOT "${OMPI_FINT_MAX}" STREQUAL "${OMPI_FINT_MAX_OLD}")
|
||||
|
||||
OMPI_DEF_VAR(OMPI_FORTRAN_HANDLE_MAX "Max handle value for fortran MPI handles, effectively min(INT_MAX, max fortran INTEGER value)." 0 1)
|
||||
|
||||
ENDMACRO(OMPI_FORTRAN_GET_FORTRAN_HANDLE_MAX)
|
@ -1,98 +0,0 @@
|
||||
# Copyright (c) 2008-2010 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
|
||||
# OMPI_FORTRAN_GET_SIZEOF(type, variable to set)
|
||||
# ------------------------------------------
|
||||
|
||||
INCLUDE(FORTRAN_find_ext_symbol_convention)
|
||||
|
||||
MACRO(OMPI_FORTRAN_GET_SIZEOF TYPE OUTPUT_VARIABLE)
|
||||
MESSAGE(STATUS "Check size of Fortran 77 ${TYPE}...")
|
||||
|
||||
OMPI_FORTRAN_MAKE_C_FUNCTION(ompi_ac_size_fn size)
|
||||
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.f
|
||||
"\t program fsize \n"
|
||||
"\t external size \n "
|
||||
"\t ${TYPE} x(2) \n"
|
||||
"\t call size(x(1),x(2)) \n"
|
||||
"\t end \n")
|
||||
|
||||
IF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.h)
|
||||
SET(ompi_conftest_h "#include \"conftest.h\"")
|
||||
ELSE(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.h)
|
||||
SET(ompi_conftest_h "")
|
||||
ENDIF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.h)
|
||||
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.c
|
||||
"#include <stdio.h> \n"
|
||||
"#include <stdlib.h> \n"
|
||||
"${ompi_conftest_h} \n"
|
||||
"#ifdef __cplusplus \n"
|
||||
"extern \"C\" { \n"
|
||||
"#endif \n"
|
||||
""
|
||||
"void ${ompi_ac_size_fn}(char *a, char *b) \n"
|
||||
"{ \n"
|
||||
" int diff = (int) (b - a); \n"
|
||||
" FILE *f=fopen(\"conftestval\", \"w\"); \n"
|
||||
" if (!f) exit(1); \n"
|
||||
" fprintf(f, \"%d\\n\", diff); \n"
|
||||
" fclose(f); \n"
|
||||
"} \n"
|
||||
"#ifdef __cplusplus \n"
|
||||
"} \n"
|
||||
"#endif \n")
|
||||
|
||||
# generate the C object file
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} ${OMPI_C_OPTION_COMPILE} conftest.c ${OMPI_C_OUTPUT_OBJ}conftest_c.obj
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
# generate the Fortran object file
|
||||
# some Fortran compilers don't allow to compile and link in one step. :-(
|
||||
EXECUTE_PROCESS(COMMAND ${FORTRAN} ${FORTRAN_OPTION_COMPILE} conftest.f ${FORTRAN_OUTPUT_OBJ}conftest.obj
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
# link the C and Fortran object files.
|
||||
EXECUTE_PROCESS(COMMAND ${FORTRAN} conftest.obj conftest_c.obj ${FORTRAN_OUTPUT_EXE}conftest.exe
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND conftest.exe
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
# MESSAGE("RESULT:${RESULT}")
|
||||
|
||||
IF(RESULT)
|
||||
MESSAGE(FATAL_ERROR "Could not determine size of ${TYPE}.")
|
||||
ELSE(RESULT)
|
||||
IF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval)
|
||||
# read out type size value from the file, and write back to the output variable
|
||||
FILE(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval ${OUTPUT_VARIABLE})
|
||||
STRING(REPLACE "\n" "" ${OUTPUT_VARIABLE} ${${OUTPUT_VARIABLE}})
|
||||
MESSAGE(STATUS "Check size of Fortran 77 ${TYPE}...${${OUTPUT_VARIABLE}}")
|
||||
ELSE(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval)
|
||||
MESSAGE(FATAL_ERROR "Could not determine size of ${TYPE}.")
|
||||
ENDIF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftestval)
|
||||
ENDIF(RESULT)
|
||||
|
||||
ENDMACRO(OMPI_FORTRAN_GET_SIZEOF TYPE OUTPUT_VARIABLE)
|
@ -1,128 +0,0 @@
|
||||
# Copyright (c) 2010 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
|
||||
# OMPI_FORTRAN_GET_VALUE_TRUE()
|
||||
# -------------------------------------------------------
|
||||
# Determine the value of .TRUE. of this Fortran compiler.
|
||||
MACRO(OMPI_FORTRAN_GET_VALUE_TRUE)
|
||||
|
||||
IF(OMPI_WANT_FORTRAN_BINDINGS AND NOT DEFINED FORTRAN_VALUE_CHECK_DONE)
|
||||
|
||||
MESSAGE(STATUS "Check Fortran value for .TRUE. logical type...")
|
||||
|
||||
OMPI_FORTRAN_MAKE_C_FUNCTION(ompi_print_logical_fn print)
|
||||
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest_c.c
|
||||
"#include <stdio.h>\n"
|
||||
"#include <stdlib.h>\n"
|
||||
"\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"extern \"C\" {\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"void ${ompi_print_logical_fn}(${ompi_fortran_logical_t} * logical);\n"
|
||||
"\n"
|
||||
"void ${ompi_print_logical_fn}(${ompi_fortran_logical_t} * logical)\n"
|
||||
"{\n"
|
||||
" FILE *f=fopen(\"fortran_true_value\", \"w\");\n"
|
||||
" if (!f) exit(1);\n"
|
||||
"\n"
|
||||
" if( ${SIZEOF_INT} >= sizeof(${ompi_fortran_logical_t}) ) {\n"
|
||||
" fprintf(f, \"%d\\n\", (int)*logical);\n"
|
||||
" } else if (${SIZEOF_LONG} >= sizeof(${ompi_fortran_logical_t}) ) {\n"
|
||||
" fprintf(f, \"%ld\\n\", (long) *logical);\n"
|
||||
"#ifdef HAVE_LONG_LONG\n"
|
||||
" } else if (${SIZEOF_LONG_LONG} >= sizeof(${ompi_fortran_logical_t}) ) {\n"
|
||||
" fprintf(f, \"%lld\\n\", (long long) *logical);\n"
|
||||
"#endif\n"
|
||||
" } else {\n"
|
||||
" exit(1);\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"#ifdef __cplusplus\n"
|
||||
"}\n"
|
||||
"#endif\n")
|
||||
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest_f.f
|
||||
"\tprogram main\n"
|
||||
"\tlogical value\n"
|
||||
"\tvalue=.TRUE.\n"
|
||||
"\tCALL print(value)\n"
|
||||
"\tend\n")
|
||||
|
||||
IF(NOT "${C_COMPILER_INCLUDE}" STREQUAL "")
|
||||
SET(EXECUTE_OPT "${OMPI_C_INCLUDE_DIR}${C_COMPILER_INCLUDE}")
|
||||
ENDIF(NOT "${C_COMPILER_INCLUDE}" STREQUAL "")
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} ${OMPI_C_OPTION_COMPILE} conftest_c.c ${EXECUTE_OPT} ${OMPI_C_OUTPUT_OBJ}conftest_c.obj
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
IF(RESULT)
|
||||
MESSAGE(STATUS "${OUTPUT}\n${ERROR}")
|
||||
MESSAGE(FATAL_ERROR "Could not determine value of Fortran .TRUE.. Aborting.")
|
||||
ENDIF(RESULT)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${FORTRAN} ${FORTRAN_OPTION_COMPILE} conftest_f.f ${FORTRAN_OUTPUT_OBJ}conftest_f.obj
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
IF(RESULT)
|
||||
MESSAGE(STATUS "${OUTPUT}\n${ERROR}")
|
||||
MESSAGE(FATAL_ERROR "Could not determine value of Fortran .TRUE.. Aborting.")
|
||||
ENDIF(RESULT)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${FORTRAN} conftest_f.obj conftest_c.obj ${FORTRAN_OUTPUT_EXE}conftest.exe
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
IF(RESULT)
|
||||
MESSAGE(STATUS "${OUTPUT}\n${ERROR}")
|
||||
MESSAGE(FATAL_ERROR "Could not determine value of Fortran .TRUE.. Aborting.")
|
||||
ENDIF(RESULT)
|
||||
|
||||
EXECUTE_PROCESS(COMMAND conftest.exe
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
IF(RESULT)
|
||||
UNSET(FORTRAN_VALUE_CHECK_DONE CACHE)
|
||||
MESSAGE(STATUS "${OUTPUT}\n${ERROR}")
|
||||
MESSAGE(FATAL_ERROR "Could not determine value of Fortran .TRUE.. Aborting.")
|
||||
ELSE(RESULT)
|
||||
IF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_true_value)
|
||||
FILE(READ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_true_value OUTPUT_VALUE)
|
||||
MESSAGE(STATUS "Check Fortran value for .TRUE. logical type...${OUTPUT_VALUE}")
|
||||
SET(OMPI_FORTRAN_VALUE_TRUE ${OUTPUT_VALUE} CACHE INTERNAL "Fortran value true")
|
||||
SET(FORTRAN_VALUE_CHECK_DONE TRUE CACHE INTERNAL "Fortran value true check done")
|
||||
ELSE(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_true_value)
|
||||
UNSET(FORTRAN_VALUE_CHECK_DONE CACHE)
|
||||
MESSAGE(FATAL_ERROR "Could not determine value of Fortran .TRUE.. Aborting.")
|
||||
ENDIF(EXISTS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_true_value)
|
||||
ENDIF(RESULT)
|
||||
|
||||
ELSEIF(NOT OMPI_WANT_FORTRAN_BINDINGS)
|
||||
SET(OMPI_FORTRAN_VALUE_TRUE 0)
|
||||
UNSET(FORTRAN_VALUE_CHECK_DONE CACHE)
|
||||
ENDIF(OMPI_WANT_FORTRAN_BINDINGS AND NOT DEFINED FORTRAN_VALUE_CHECK_DONE)
|
||||
|
||||
OMPI_DEF_VAR(OMPI_FORTRAN_VALUE_TRUE "Fortran value for .TRUE. logical type" 0 1)
|
||||
|
||||
ENDMACRO(OMPI_FORTRAN_GET_VALUE_TRUE)
|
@ -1,152 +0,0 @@
|
||||
# Copyright (c) 2008-2010 High Performance Computing Center Stuttgart,
|
||||
# University of Stuttgart. All rights reserved.
|
||||
#
|
||||
# $COPYRIGHT$
|
||||
#
|
||||
# Additional copyrights may follow
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
|
||||
# first try to find a fortran compiler, will be checked when fortran support is enabled.
|
||||
|
||||
# There might be a bug in CMake, the CMAKE_GENERATOR_FC is set to "ifort" by default,
|
||||
# which causes CMake can't find the correct Fortran compiler.
|
||||
# We have to set CMAKE_GENERATOR_FC empty.
|
||||
SET(CMAKE_GENERATOR_FC "")
|
||||
include(CMakeDetermineFortranCompiler)
|
||||
include(CMakeFortranInformation)
|
||||
|
||||
IF(OMPI_WANT_FORTRAN_BINDINGS AND NOT FORTRAN_SETUP_DONE)
|
||||
|
||||
SET(OMPI_MPI_INTEGER_KIND 0 CACHE INTERNAL "MPI_INTEGER_KIND")
|
||||
SET(OMPI_MPI_ADDRESS_KIND 0 CACHE INTERNAL "MPI_ADDRESS_KIND")
|
||||
SET(OMPI_MPI_OFFSET_KIND 0 CACHE INTERNAL "MPI_OFFSET_KIND")
|
||||
SET(OMPI_FORTRAN_STATUS_SIZE 0 CACHE INTERNAL "MPI_STATUS_SIZE")
|
||||
|
||||
GET_FILENAME_COMPONENT(FORTRAN_NAME ${CMAKE_Fortran_COMPILER} NAME)
|
||||
GET_FILENAME_COMPONENT(FORTRAN_PATH ${CMAKE_Fortran_COMPILER} PATH)
|
||||
|
||||
SET(FORTRAN ${FORTRAN_NAME} CACHE INTERNAL "Name of the fortran compiler.")
|
||||
|
||||
# Default compiler settings.
|
||||
IF(${FORTRAN} STREQUAL "ifort.exe")
|
||||
#settings for Intel Fortran
|
||||
SET(FORTRAN_OPTION_COMPILE "/c" CACHE INTERNAL
|
||||
"Fortran compiler option for compiling without linking.")
|
||||
SET(FORTRAN_OUTPUT_OBJ "/Fo" CACHE INTERNAL
|
||||
"Fortran compiler option for setting object file name.")
|
||||
SET(FORTRAN_OUTPUT_EXE "/Fe" CACHE INTERNAL
|
||||
"Fortran compiler option for setting executable file name.")
|
||||
SET(FORTRAN_DYNAMIC_FLAG_DEBUG "/MDd" CACHE INTERNAL
|
||||
"Compile flag for using dynamically-loaded, multithread C runtime (Debug).")
|
||||
SET(FORTRAN_DYNAMIC_FLAG "/MD" CACHE INTERNAL
|
||||
"Compile flag for using dynamically-loaded, multithread C runtime.")
|
||||
|
||||
IF(NOT "$ENV{IFORT_COMPILER11}" STREQUAL "")
|
||||
SET(IFORT_LIB_PATH "$ENV{IFORT_COMPILER11}/lib/")
|
||||
ELSEIF(NOT "$ENV{IFORT_COMPILER12}" STREQUAL "")
|
||||
SET(IFORT_LIB_PATH "$ENV{IFORT_COMPILER12}/compiler/lib/")
|
||||
ENDIF(NOT "$ENV{IFORT_COMPILER11}" STREQUAL "")
|
||||
|
||||
IF(CMAKE_CL_64)
|
||||
SET(FORTRAN_LIB_PATH "${IFORT_LIB_PATH}/intel64")
|
||||
ELSE(CMAKE_CL_64)
|
||||
SET(FORTRAN_LIB_PATH "${IFORT_LIB_PATH}/ia32")
|
||||
ENDIF(CMAKE_CL_64)
|
||||
|
||||
IF(NOT FORTRAN_LIB_PATH)
|
||||
IF(CMAKE_CL_64)
|
||||
FIND_LIBRARY(FORTRAN_IFCONSOL_LIB ifconsol.lib PATHS ${FORTRAN_PATH}/../../intel64)
|
||||
ELSE(CMAKE_CL_64)
|
||||
FIND_LIBRARY(FORTRAN_IFCONSOL_LIB ifconsol.lib PATHS ${FORTRAN_PATH}/../../ia32)
|
||||
ENDIF(CMAKE_CL_64)
|
||||
GET_FILENAME_COMPONENT(FORTRAN_LIB_PATH ${FORTRAN_IFCONSOL_LIB} PATH)
|
||||
UNSET(FORTRAN_IFCONSOL_LIB CACHE)
|
||||
ELSE(NOT FORTRAN_LIB_PATH)
|
||||
STRING(REPLACE "\\" "/" FORTRAN_LIB_PATH ${FORTRAN_LIB_PATH})
|
||||
ENDIF(NOT FORTRAN_LIB_PATH)
|
||||
ELSEIF(${FORTRAN} STREQUAL "g95.exe")
|
||||
#settings for G95
|
||||
SET(FORTRAN_OPTION_COMPILE "-c" CACHE INTERNAL
|
||||
"Fortran compiler option for compiling without linking.")
|
||||
SET(FORTRAN_OUTPUT_OBJ "-o" CACHE INTERNAL
|
||||
"Fortran compiler option for setting object file name.")
|
||||
SET(FORTRAN_OUTPUT_EXE "-o" CACHE INTERNAL
|
||||
"Fortran compiler option for setting executable file name.")
|
||||
ELSE(${FORTRAN} STREQUAL "ifort.exe")
|
||||
# in other case, let user specify their fortran configrations.
|
||||
SET(FORTRAN_OPTION_COMPILE "-c" CACHE STRING
|
||||
"Fortran compiler option for compiling without linking.")
|
||||
SET(FORTRAN_OUTPUT_OBJ "-o" CACHE STRING
|
||||
"Fortran compiler option for setting object file name.")
|
||||
SET(FORTRAN_OUTPUT_EXE "-o" CACHE STRING
|
||||
"Fortran compiler option for setting executable file name.")
|
||||
SET(FORTRAN_LIB_PATH "" CACHE PATH
|
||||
"Library path for the fortran compiler")
|
||||
SET(FORTRAN_INCLUDE_PATH "" CACHE PATH
|
||||
"Include path for the fortran compiler")
|
||||
ENDIF(${FORTRAN} STREQUAL "ifort.exe")
|
||||
|
||||
# Export env variables for fortran compiler.
|
||||
SET(ENV{PATH} "${C_COMPILER_PATH};${FORTRAN_PATH};$ENV{PATH}")
|
||||
SET(ENV{LIB} "${C_COMPILER_LIB};${FORTRAN_LIB_PATH};$ENV{LIB}")
|
||||
SET(ENV{INCLUDE} "${C_COMPILER_INCLUDE};${FORTRAN_INCLUDE_PATH};$ENV{INCLUDE}")
|
||||
SET(ENV{LIBPATH} "${C_COMPILER_LIBPATH};$ENV{LIBPATH}")
|
||||
|
||||
# make sure the compiler actually works, if not cross-compiling
|
||||
MESSAGE(STATUS "Checking for working Fortran compiler...")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
|
||||
"\t PROGRAM TESTFortran \n"
|
||||
"\t PRINT *, 'Hello' \n"
|
||||
"\t END \n")
|
||||
|
||||
# lets use execute_process to run the compile test
|
||||
EXECUTE_PROCESS(COMMAND ${FORTRAN} testFortranCompiler.f
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
RESULT_VARIABLE RESULT
|
||||
ERROR_VARIABLE ERROR)
|
||||
|
||||
|
||||
IF(RESULT)
|
||||
SET(FORTRAN_SETUP_DONE FALSE CACHE INTERNAL "fortran setup done.")
|
||||
MESSAGE(STATUS "${OUTPUT}\n${ERROR}")
|
||||
MESSAGE(STATUS "Fortran compiler ${FORTRAN} can't compile a simple fortran program.")
|
||||
MESSAGE(FATAL_ERROR "Cannot continue. Please check Fortran compiler installation, or disable Fortran 77 support.")
|
||||
ELSE(RESULT)
|
||||
MESSAGE(STATUS "Checking for working Fortran compiler...${FORTRAN}")
|
||||
SET(FORTRAN_SETUP_DONE TRUE CACHE INTERNAL "fortran setup done.")
|
||||
ENDIF(RESULT)
|
||||
|
||||
INCLUDE(FORTRAN_find_ext_symbol_convention)
|
||||
# make sure we know the linking convention
|
||||
# this macro will also test linking with C code
|
||||
OMPI_FORTRAN_FIND_EXT_SYMBOL_CONVENTION()
|
||||
|
||||
ELSEIF(NOT OMPI_WANT_FORTRAN_BINDINGS)
|
||||
SET(OMPI_FORTRAN_DOUBLE_UNDERSCORE 0
|
||||
CACHE INTERNAL "external symbol convention - double underscore")
|
||||
SET(OMPI_FORTRAN_SINGLE_UNDERSCORE 0
|
||||
CACHE INTERNAL "external symbol convention - single underscore")
|
||||
SET(OMPI_FORTRAN_CAPS 0
|
||||
CACHE INTERNAL "external symbol convention - captital")
|
||||
SET(OMPI_FORTRAN_PLAIN 0
|
||||
CACHE INTERNAL "external symbol convention - plain")
|
||||
|
||||
UNSET(SYMBOL_CONVENTION_CHECK_DONE CACHE)
|
||||
UNSET(FORTRAN_OPTION_COMPILE CACHE)
|
||||
UNSET(FORTRAN_OUTPUT_OBJ CACHE)
|
||||
UNSET(FORTRAN_OUTPUT_EXE CACHE)
|
||||
UNSET(FORTRAN_LIB_PATH CACHE)
|
||||
UNSET(FORTRAN_INCLUDE_PATH CACHE)
|
||||
UNSET(FORTRAN_IFCONSOL_LIB CACHE)
|
||||
UNSET(FORTRAN_SETUP_DONE CACHE)
|
||||
ENDIF(OMPI_WANT_FORTRAN_BINDINGS AND NOT FORTRAN_SETUP_DONE)
|
||||
|
||||
# a few definitions needed by OMPI_FORTRAN_FIND_EXT_SYMBOL_CONVENTION check.
|
||||
OMPI_DEF_VAR(OMPI_FORTRAN_DOUBLE_UNDERSCORE "Whether fortran symbols have a trailing double underscore or not." 0 1)
|
||||
OMPI_DEF_VAR(OMPI_FORTRAN_SINGLE_UNDERSCORE "Whether fortran symbols have a trailing single underscore or not." 0 1)
|
||||
OMPI_DEF_VAR(OMPI_FORTRAN_CAPS "Whether fortran symbols are all caps or not." 0 1)
|
||||
OMPI_DEF_VAR(OMPI_FORTRAN_PLAIN "Whether fortran symbols have no trailing underscore or not." 0 1)
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user