1
1
openmpi/ompi/tools/CMakeLists.txt
Shiqing Fan 42dfbc7d2f Another CMake scripts update for:
correctly generate hwloc library
automatically define OMPI/OPAL/ORTE_OMPORTS for user applications
update the f77 bindings

This commit was SVN r26893.
2012-07-27 11:49:09 +00:00

146 строки
5.2 KiB
CMake

# Copyright (c) 2007-2011 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2008 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
ADD_SUBDIRECTORY(ompi_info)
ADD_SUBDIRECTORY(ompi-server)
MACRO(CONFIGURE_WRAPPER_DATA_FILE APP_NAME)
# mpic++ and mpicxx share the same input file
IF(${APP_NAME} STREQUAL "mpicxx")
SET(INPUT_PREFIX "mpic++")
ELSE(${APP_NAME} STREQUAL "mpicxx")
SET(INPUT_PREFIX ${APP_NAME})
ENDIF(${APP_NAME} STREQUAL "mpicxx")
FILE(READ ${OpenMPI_SOURCE_DIR}/ompi/tools/wrappers/${INPUT_PREFIX}-wrapper-data.txt.in DATA_FILE)
STRING(REGEX REPLACE "-l[-a-zA-Z0-9_]+ " "" DATA_FILE ${DATA_FILE})
# create a temporary input file, for "write file" command only
# replace the variables in the first level. :(
FILE(WRITE ${OMPI_BINARY_DIR}/tools/wrappers/${APP_NAME}-wrapper-data.txt.in "${DATA_FILE}")
CONFIGURE_FILE(${OMPI_BINARY_DIR}/tools/wrappers/${APP_NAME}-wrapper-data.txt.in
${OMPI_BINARY_DIR}/tools/wrappers/${APP_NAME}${OMPI_EXE_DEBUG_POSTFIX}-wrapper-data.txt @ONLY)
INSTALL(FILES ${OMPI_BINARY_DIR}/tools/wrappers/${APP_NAME}${OMPI_EXE_DEBUG_POSTFIX}-wrapper-data.txt
DESTINATION share/openmpi)
CONFIGURE_FILE(${OMPI_BINARY_DIR}/tools/wrappers/${APP_NAME}-wrapper-data.txt.in
${OMPI_BINARY_DIR}/tools/wrappers/${APP_NAME}${OMPI_EXE_DEBUG_POSTFIX}.exe-wrapper-data.txt @ONLY)
INSTALL(FILES ${OMPI_BINARY_DIR}/tools/wrappers/${APP_NAME}${OMPI_EXE_DEBUG_POSTFIX}.exe-wrapper-data.txt
DESTINATION share/openmpi)
ENDMACRO()
# select debug or release libraries at configure time
IF(WINDOWS_VS)
IF(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_BASE_LIBS
"libmpid.lib libopen-pald.lib libopen-rted.lib advapi32.lib Ws2_32.lib shlwapi.lib")
ELSE(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_BASE_LIBS
"libmpi.lib libopen-pal.lib libopen-rte.lib advapi32.lib Ws2_32.lib shlwapi.lib")
ENDIF(OMPI_DEBUG_BUILD)
ELSEIF(WINDOWS_MINGW)
IF(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_BASE_LIBS "-lmpid")
ELSE(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_BASE_LIBS "-lmpi")
ENDIF(OMPI_DEBUG_BUILD)
ENDIF(WINDOWS_VS)
IF(BUILD_SHARED_LIBS)
SET(OMPI_WRAPPER_EXTRA_CFLAGS
"${OMPI_C_LAN_FLAG}")
ELSE(BUILD_SHARED_LIBS)
IF(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_EXTRA_CFLAGS "${OMPI_C_LAN_FLAG} ${OMPI_C_MD_DEBUG}")
ELSE(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_EXTRA_CFLAGS "${OMPI_C_LAN_FLAG} ${OMPI_C_MD}")
ENDIF(OMPI_DEBUG_BUILD)
ENDIF(BUILD_SHARED_LIBS)
SET(OMPI_WRAPPER_EXTRA_LIBS ${OMPI_WRAPPER_BASE_LIBS})
CONFIGURE_WRAPPER_DATA_FILE(mpicc)
UNSET(OMPI_WRAPPER_EXTRA_LIBS)
IF(OMPI_BUILD_CXX_BINDINGS)
# select debug or release libraries at configure time
IF(WINDOWS_VS)
IF(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_CXX_LIB "libmpi_cxxd.lib ${OMPI_WRAPPER_BASE_LIBS}")
ELSE(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_CXX_LIB "libmpi_cxx.lib ${OMPI_WRAPPER_BASE_LIBS}")
ENDIF(OMPI_DEBUG_BUILD)
ELSEIF(WINDOWS_MINGW)
IF(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_CXX_LIB "-lmpi_cxxd ${OMPI_WRAPPER_BASE_LIBS}")
ELSE(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_CXX_LIB "-lmpi_cxx ${OMPI_WRAPPER_BASE_LIBS}")
ENDIF(OMPI_DEBUG_BUILD)
ENDIF(WINDOWS_VS)
IF(BUILD_SHARED_LIBS)
SET(OMPI_WRAPPER_EXTRA_CXXFLAGS
"${OMPI_CXX_LAN_FLAG} ${OMPI_CXX_EXCEPTION}")
ELSE(BUILD_SHARED_LIBS)
IF(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_EXTRA_CXXFLAGS "${OMPI_CXX_LAN_FLAG} ${OMPI_CXX_EXCEPTION} ${OMPI_C_MD_DEBUG}")
ELSE(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_EXTRA_CXXFLAGS "${OMPI_CXX_LAN_FLAG} ${OMPI_CXX_EXCEPTION} ${OMPI_C_MD}")
ENDIF(OMPI_DEBUG_BUILD)
ENDIF(BUILD_SHARED_LIBS)
CONFIGURE_WRAPPER_DATA_FILE(mpic++)
CONFIGURE_WRAPPER_DATA_FILE(mpicxx)
ENDIF(OMPI_BUILD_CXX_BINDINGS)
IF(OMPI_WANT_FORTRAN_BINDINGS)
# select debug or release libraries at configure time
IF(WINDOWS_VS)
IF(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_EXTRA_LIBS "libmpi_fortrand.lib ${OMPI_WRAPPER_BASE_LIBS}")
ELSE(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_EXTRA_LIBS "libmpi_fortran.lib ${OMPI_WRAPPER_BASE_LIBS}")
ENDIF(OMPI_DEBUG_BUILD)
ELSEIF(WINDOWS_MINGW)
IF(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_EXTRA_LIBS "-lmpi_fortrand ${OMPI_WRAPPER_BASE_LIBS}")
ELSE(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_EXTRA_LIBS "-lmpi_fortran ${OMPI_WRAPPER_BASE_LIBS}")
ENDIF(OMPI_DEBUG_BUILD)
ENDIF(WINDOWS_VS)
IF(BUILD_SHARED_LIBS)
SET(OMPI_WRAPPER_EXTRA_FFLAGS
"")
ELSE(BUILD_SHARED_LIBS)
IF(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_EXTRA_FFLAGS "${FORTRAN_DYNAMIC_FLAG_DEBUG}")
ELSE(OMPI_DEBUG_BUILD)
SET(OMPI_WRAPPER_EXTRA_FFLAGS "${FORTRAN_DYNAMIC_FLAG}")
ENDIF(OMPI_DEBUG_BUILD)
ENDIF(BUILD_SHARED_LIBS)
CONFIGURE_WRAPPER_DATA_FILE(mpifort)
UNSET(OMPI_WRAPPER_EXTRA_LIBS)
ENDIF(OMPI_WANT_FORTRAN_BINDINGS)
#IF(OMPI_WANT_F90_BINDINGS)
# CONFIGURE_WRAPPER_DATA_FILE(mpif90)
#ENDIF(OMPI_WANT_F90_BINDINGS)
IF(WANT_INSTALL_HEADERS)
CONFIGURE_WRAPPER_DATA_FILE(opal-wrapper)
ENDIF(WANT_INSTALL_HEADERS)