1
1

Check the Fortran compiler base on the build type (32 or 64 bit build), and set corresponding VC environment.

This commit was SVN r22568.
Этот коммит содержится в:
Shiqing Fan 2010-02-07 23:16:06 +00:00
родитель 924bc10ceb
Коммит fe39e3a993
4 изменённых файлов: 85 добавлений и 29 удалений

Просмотреть файл

@ -81,6 +81,10 @@ ELSE(CMAKE_CL_64)
SET(COMPILER_TYPE "win32")
ENDIF(CMAKE_CL_64)
#store current environment variables
SET(PATH_OLD "$ENV{PATH}")
SET(LIB_OLD "$ENV{LIB}")
SET(INCLUDE_OLD "$ENV{INCLUDE}")
INCLUDE(ompi_configure)
@ -92,6 +96,11 @@ ADD_SUBDIRECTORY(opal)
ADD_SUBDIRECTORY(ompi)
ADD_SUBDIRECTORY(orte)
#restore environment variables
SET(ENV{PATH} "${PATH_OLD}")
SET(ENV{LIB} "${LIB_OLD}")
SET(ENV{INCLUDE} "${INCLUDE_OLD}")
INCLUDE(InstallRequiredSystemLibraries)
# CPACK settings

Просмотреть файл

@ -118,9 +118,10 @@ MACRO(OMPI_F77_FIND_EXT_SYMBOL_CONVENTION)
SET(SYMBOL_CONVENTION_CHECK_DONE TRUE CACHE INTERNAL "Symbol convention check done.")
IF(NOT TEST_OK)
MESSAGE(FATAL_ERROR "C and Fortran 77 compilers are not link compatible. Can not continue.")
MESSAGE(STATUS "*** Probably you have to setup the library path of the Fortran compiler.")
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. Can not continue.")
ENDIF(NOT TEST_OK)
ENDIF(NOT SYMBOL_CONVENTION_CHECK_DONE)

Просмотреть файл

@ -25,16 +25,30 @@ MACRO(OMPI_MICROSOFT_COMPILER)
MESSAGE( STATUS "Start Microsoft specific detection....")
# search for Microsoft VC tools
SET(CHECK_PATHS ${CHECK_PATHS}
"C:/Program Files/Microsoft Visual Studio 9.0/VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
"C:/Program Files/Microsoft Visual Studio 8/VC/BIN"
"C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN"
"C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN"
"C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN"
"$ENV{VS90COMNTOOLS}../../VC/bin"
"$ENV{VS80COMNTOOLS}../../VC/bin")
# search for Microsoft VC tools
IF(CMAKE_CL_64)
SET(CHECK_PATHS ${CHECK_PATHS}
"C:/Program Files/Microsoft Visual Studio 9.0/VC/bin/amd64"
"C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin/amd64"
"C:/Program Files/Microsoft Visual Studio 8/VC/bin/amd64"
"C:/Program Files (x86)/Microsoft Visual Studio 8/VC/bin/amd64"
"C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/bin/amd64"
"C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/bin/amd64"
"$ENV{VS90COMNTOOLS}../../VC/bin/amd64"
"$ENV{VS80COMNTOOLS}../../VC/bin//amd64"
"$ENV{VS90COMNTOOLS}../../VC/bin/ia64"
"$ENV{VS80COMNTOOLS}../../VC/bin//ia64")
ELSE(CMAKE_CL_64)
SET(CHECK_PATHS ${CHECK_PATHS}
"C:/Program Files/Microsoft Visual Studio 9.0/VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
"C:/Program Files/Microsoft Visual Studio 8/VC/bin"
"C:/Program Files (x86)/Microsoft Visual Studio 8/VC/bin"
"C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/bin"
"C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/bin"
"$ENV{VS90COMNTOOLS}../../VC/bin"
"$ENV{VS80COMNTOOLS}../../VC/bin")
ENDIF(CMAKE_CL_64)
FIND_PROGRAM(CL_EXE cl PATHS ${CHECK_PATHS})
@ -44,17 +58,31 @@ MACRO(OMPI_MICROSOFT_COMPILER)
SET(CC ${COMPILER_NAME} CACHE INTERNAL "C compiler executable")
SET(CXX ${COMPILER_NAME} CACHE INTERNAL "CXX compiler executable")
GET_FILENAME_COMPONENT(SDK_ROOT_PATH
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
SET(VS_ROOT_DIR ${VC_BIN_PATH}/../../)
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE)
IF(CMAKE_CL_64)
SET(VS_ROOT_DIR ${VC_BIN_PATH}/../../..)
SET(VC_LIB_DIR ${VS_ROOT_DIR}/VC/lib/amd64)
SET(SDK_LIB_DIR ${SDK_ROOT_PATH}/lib/x64)
ELSE(CMAKE_CL_64)
SET(VS_ROOT_DIR ${VC_BIN_PATH}/../..)
SET(VC_LIB_DIR ${VS_ROOT_DIR}/VC/lib)
SET(SDK_LIB_DIR ${SDK_ROOT_PATH}/lib)
ENDIF(CMAKE_CL_64)
SET(VS_COMMON_TOOLS_DIR ${VS_ROOT_DIR}/Common7/Tools)
SET(VS_IDE_DIR ${VS_ROOT_DIR}/Common7/IDE)
SET(VC_INCLUDE_DIR ${VS_ROOT_DIR}/VC/INCLUDE)
SET(VC_LIB_DIR ${VS_ROOT_DIR}/VC/LIB)
SET(VC_INCLUDE_DIR ${VS_ROOT_DIR}/VC/include)
SET(ENV{PATH} "${VC_BIN_PATH};${SDK_ROOT_PATH}/bin;${VS_IDE_DIR};$ENV{PATH}")
SET(ENV{INCLUDE} "${VC_INCLUDE_DIR};$ENV{INCLUDE}")
SET(ENV{LIB} "${VC_LIB_DIR};${SDK_ROOT_PATH}/lib;$ENV{LIB}")
SET(ENV{LIBPATH} "${VC_LIB_DIR};${SDK_ROOT_PATH}/lib;$ENV{LIBPATH}")
# Cache the compilers paths that could be used later.
SET(C_COMPILER_PATH ${VC_BIN_PATH} ${SDK_ROOT_PATH}/bin ${VS_IDE_DIR} CACHE INTERNAL "Compiler binary paths.")
SET(C_COMPILER_INCLUDE ${VC_INCLUDE_DIR} CACHE INTERNAL "Compiler include paths.")
SET(C_COMPILER_LIB ${VC_LIB_DIR} ${SDK_LIB_DIR} CACHE INTERNAL "Compiler libraries.")
SET(C_COMPILER_LIBPATH ${VC_LIB_DIR} ${SDK_LIB_DIR} CACHE INTERNAL "Compiler libraries path.")
SET(ENV{PATH} "${C_COMPILER_PATH};$ENV{PATH}")
SET(ENV{INCLUDE} "${C_COMPILER_INCLUDE};$ENV{INCLUDE}")
SET(ENV{LIB} "${C_COMPILER_LIB};$ENV{LIB}")
SET(ENV{LIBPATH} "${C_COMPILER_LIBPATH};$ENV{LIBPATH}")
# Default compiler settings.
SET(OMPI_C_OPTION_COMPILE "/c" CACHE INTERNAL

Просмотреть файл

@ -31,9 +31,24 @@ IF(OMPI_WANT_F77_BINDINGS AND NOT F77_SETUP_DONE)
"Fortran compiler option for setting object file name.")
SET(F77_OUTPUT_EXE "/Fe" CACHE INTERNAL
"Fortran compiler option for setting executable file name.")
FIND_LIBRARY(F77_IFCONSOL_LIB ifconsol.lib PATHS ${F77_PATH}/../../)
GET_FILENAME_COMPONENT(F77_LIB_PATH ${F77_IFCONSOL_LIB} PATH)
UNSET(F77_IFCONSOL_LIB CACHE)
IF(CMAKE_CL_64)
SET(F77_LIB_PATH "$ENV{IFORT_COMPILER11}/lib/intel64")
ELSE(CMAKE_CL_64)
SET(F77_LIB_PATH "$ENV{IFORT_COMPILER11}/lib/ia32")
ENDIF(CMAKE_CL_64)
IF(NOT F77_LIB_PATH)
IF(CMAKE_CL_64)
FIND_LIBRARY(F77_IFCONSOL_LIB ifconsol.lib PATHS ${F77_PATH}/../../intel64)
ELSE(CMAKE_CL_64)
FIND_LIBRARY(F77_IFCONSOL_LIB ifconsol.lib PATHS ${F77_PATH}/../../ia32)
ENDIF(CMAKE_CL_64)
GET_FILENAME_COMPONENT(F77_LIB_PATH ${F77_IFCONSOL_LIB} PATH)
UNSET(F77_IFCONSOL_LIB CACHE)
ELSE(NOT F77_LIB_PATH)
STRING(REPLACE "\\" "/" F77_LIB_PATH ${F77_LIB_PATH})
ENDIF(NOT F77_LIB_PATH)
ELSEIF(${F77} STREQUAL "g95.exe")
#settings for G95
SET(F77_OPTION_COMPILE "-c" CACHE INTERNAL
@ -57,9 +72,10 @@ IF(OMPI_WANT_F77_BINDINGS AND NOT F77_SETUP_DONE)
ENDIF(${F77} STREQUAL "ifort.exe")
# Export env variables for fortran compiler.
SET(ENV{PATH} "${F77_PATH};$ENV{PATH}")
SET(ENV{LIB} "${F77_LIB_PATH};$ENV{LIB}")
SET(ENV{INCLUDE} "${F77_INCLUDE_PATH};$ENV{INCLUDE}")
SET(ENV{PATH} "${C_COMPILER_PATH};${F77_PATH};$ENV{PATH}")
SET(ENV{LIB} "${C_COMPILER_LIB};${F77_LIB_PATH};$ENV{LIB}")
SET(ENV{INCLUDE} "${C_COMPILER_INCLUDE};${F77_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...")
@ -69,16 +85,18 @@ IF(OMPI_WANT_F77_BINDINGS AND NOT F77_SETUP_DONE)
"\t END \n")
# lets use execute_process to run the compile test
EXECUTE_PROCESS(COMMAND ${CMAKE_Fortran_COMPILER} testFortranCompiler.f
EXECUTE_PROCESS(COMMAND ${F77} testFortranCompiler.f
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
OUTPUT_VARIABLE OUTPUT
RESULT_VARIABLE RESULT
ERROR_VARIABLE ERROR)
IF(RESULT)
MESSAGE("Fortran compiler ${F77} can't compile a simple fortran program.")
MESSAGE(FATAL_ERROR "Cannot continue. Please check Fortran compiler installation, or disable Fortran 77 support.")
SET(F77_SETUP_DONE FALSE CACHE INTERNAL "f77 setup done.")
MESSAGE(STATUS "${OUTPUT}\n${ERROR}")
MESSAGE(STATUS "Fortran compiler ${F77} 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...${F77}")
SET(F77_SETUP_DONE TRUE CACHE INTERNAL "f77 setup done.")