1
1

Fix Windows build, add custom command to generate static libraries (opal and orte) for shared build.

This commit was SVN r24012.
Этот коммит содержится в:
Shiqing Fan 2010-11-09 08:32:45 +00:00
родитель f2f41d1ca9
Коммит 7bac326920
16 изменённых файлов: 82 добавлений и 22 удалений

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

@ -111,6 +111,10 @@ IF(NOT MICROSOFT_CHECK_DONE)
"C compiler option for C++ exceptions.")
SET(OMPI_C_INCLUDE_DIR "/I" CACHE INTERNAL
"C compiler option for including directory.")
SET(OMPI_LIB_CMD "lib" CACHE INTERNAL
"command line for making static libraries.")
SET(OMPI_LIB_CMD_OUTPUT "-OUT:" CACHE INTERNAL
"Output option for making static libraries.")
SET(DUMP_UTIL "${VC_BIN_PATH}/dumpbin.exe" CACHE INTERNAL "the dumpbin application.")

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

@ -119,6 +119,7 @@ INCLUDE (check_mca_subdirs)
SET (OMPI_SOURCE_FILES ${OMPI_SOURCE_FILES} ${MCA_FILES})
ADD_LIBRARY (libmpi ${OMPI_SOURCE_FILES})
ADD_DEPENDENCIES(libmpi libopen-rte libopen-pal)
SET_TARGET_PROPERTIES(libmpi PROPERTIES COMPILE_FLAGS
"${OMPI_C_DEF_PRE}OMPI_MPIHANDLES_DLL_PREFIX=libompi_dbg_mpihandles
@ -131,7 +132,10 @@ IF (BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(libmpi PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}HAVE_CONFIG_H
${OMPI_C_DEF_PRE}OMPI_EXPORTS ${OMPI_C_DEF_PRE}ORTE_IMPORTS ${OMPI_CXX_LAN_FLAG}")
TARGET_LINK_LIBRARIES (libmpi libopen-rte Ws2_32.lib shlwapi.lib ${EXTRA_LINK_LIBRARIES})
TARGET_LINK_LIBRARIES (libmpi
${OpenMPI_BINARY_DIR}/libopen-rte-lt${CMAKE_DEBUG_POSTFIX}.lib
${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib
Ws2_32.lib shlwapi.lib ${EXTRA_LINK_LIBRARIES})
ELSE (BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(libmpi PROPERTIES COMPILE_FLAGS "${OMPI_C_DEF_PRE}_LIB")
ENDIF(BUILD_SHARED_LIBS)

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

@ -28,7 +28,7 @@ SET_TARGET_PROPERTIES (libmpi_cxx PROPERTIES LINKER_LANGUAGE CXX)
# Set compile flags for this target
IF (BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES(libmpi_cxx libmpi libopen-pal)
TARGET_LINK_LIBRARIES(libmpi_cxx ${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib libmpi)
# Need OMPI_BUILDING_CXX_BINDINGS_LIBRARY so that we can get the path
# names correct inside the MPI C++ library. OMPI_SKIP_MPICXX is necessary
# so that mpi.h doesn't include mpicxx.h through the incorrect pathname

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

@ -14,14 +14,18 @@ FILE(GLOB_RECURSE OMPI_SERVER_SOURCE_FILES "*.h" "*.c" "*.cc" "*.cpp")
ADD_EXECUTABLE (ompi-server ${OMPI_SERVER_SOURCE_FILES})
ADD_DEPENDENCIES(ompi-server libmpi)
IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (ompi-server ${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib
libopen-rte libmpi Ws2_32.lib shlwapi.lib)
SET_TARGET_PROPERTIES(ompi-server PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}OPAL_IMPORTS
${OMPI_C_DEF_PRE}OMPI_IMPORTS ${OMPI_C_DEF_PRE}ORTE_IMPORTS
${OMPI_CXX_LAN_FLAG}")
ELSE(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (ompi-server libmpi libopen-pal libopen-rte Ws2_32.lib shlwapi.lib)
ENDIF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (ompi-server libmpi libopen-pal libopen-rte Ws2_32.lib shlwapi.lib)
INSTALL(TARGETS ompi-server
DESTINATION bin)

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

@ -11,14 +11,19 @@ FILE(GLOB_RECURSE OMPI_INFO_SOURCE_FILES "*.h" "*.c" "*.cc" "*.cpp")
ADD_EXECUTABLE (ompi_info ${OMPI_INFO_SOURCE_FILES})
ADD_DEPENDENCIES(ompi_info libmpi)
IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (ompi_info ${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib
${OpenMPI_BINARY_DIR}/libopen-rte-lt${CMAKE_DEBUG_POSTFIX}.lib
libmpi Ws2_32.lib shlwapi.lib)
SET_TARGET_PROPERTIES(ompi_info PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}OPAL_IMPORTS
${OMPI_C_DEF_PRE}OMPI_IMPORTS ${OMPI_C_DEF_PRE}ORTE_IMPORTS
${OMPI_CXX_LAN_FLAG}")
ELSE(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (ompi_info libmpi libopen-rte libopen-pal Ws2_32.lib shlwapi.lib)
ENDIF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (ompi_info libmpi libopen-rte libopen-pal Ws2_32.lib shlwapi.lib)
INSTALL(TARGETS ompi_info
DESTINATION bin)

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

@ -91,6 +91,12 @@ ADD_LIBRARY (libopen-pal ${OPAL_SOURCE_FILES})
# Set compile flags for this target
IF (BUILD_SHARED_LIBS)
ADD_CUSTOM_COMMAND(TARGET libopen-pal POST_BUILD
COMMAND ${OMPI_LIB_CMD} *.obj ${OMPI_LIB_CMD_OUTPUT}${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/libopen-pal.dir/${CMAKE_CFG_INTDIR}
COMMENT "Generating static library."
)
SET_TARGET_PROPERTIES(libopen-pal PROPERTIES COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}OPAL_EXPORTS")
IF(OPAL_WANT_LIBLTDL AND LIBLTDL_FOUND)
INCLUDE_DIRECTORIES(${LIBLTDL_INCLUDE_PATH})

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

@ -240,7 +240,7 @@
# define OPAL_DECLSPEC __declspec(dllexport)
# define OPAL_MODULE_DECLSPEC
# else
# define OPAL_DECLSPEC __declspec(dllimport)
# define OPAL_DECLSPEC
# if defined(OPAL_MODULE_EXPORTS)
# define OPAL_MODULE_DECLSPEC __declspec(dllexport)
# else

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

@ -11,14 +11,18 @@ FILE(GLOB_RECURSE OPAL_CHECKPOINT_SOURCE_FILES "*.h" "*.c" "*.cc" "*.cpp")
ADD_EXECUTABLE (opal-checkpoint ${OPAL_CHECKPOINT_SOURCE_FILES})
ADD_DEPENDENCIES(opal-checkpoint libopen-pal)
IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (opal-checkpoint Ws2_32.lib shlwapi.lib
${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib)
SET_TARGET_PROPERTIES(opal-checkpoint PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}OPAL_IMPORTS
${OMPI_C_DEF_PRE}OMPI_IMPORTS ${OMPI_C_DEF_PRE}ORTE_IMPORTS
${OMPI_CXX_LAN_FLAG}")
ELSE(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (opal-checkpoint libopen-pal Ws2_32.lib shlwapi.lib)
ENDIF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (opal-checkpoint libopen-pal Ws2_32.lib shlwapi.lib)
INSTALL(TARGETS opal-checkpoint
DESTINATION bin)

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

@ -11,15 +11,18 @@ FILE(GLOB_RECURSE OPAL_RESTART_SOURCE_FILES "*.h" "*.c" "*.cc" "*.cpp")
ADD_EXECUTABLE (opal-restart ${OPAL_RESTART_SOURCE_FILES})
ADD_DEPENDENCIES(opal-restart libopen-pal)
IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (opal-restart Ws2_32.lib shlwapi.lib
${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib)
SET_TARGET_PROPERTIES(opal-restart PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}OPAL_IMPORTS
${OMPI_C_DEF_PRE}OMPI_IMPORTS ${OMPI_C_DEF_PRE}ORTE_IMPORTS
${OMPI_CXX_LAN_FLAG}")
ELSE(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (opal-restart libopen-pal Ws2_32.lib shlwapi.lib)
ENDIF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (opal-restart libopen-pal Ws2_32.lib shlwapi.lib)
INSTALL(TARGETS opal-restart
DESTINATION bin)
INSTALL(FILES help-opal-restart.txt DESTINATION share/openmpi)

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

@ -11,13 +11,16 @@ FILE(GLOB_RECURSE OPAL_WRAPPER_SOURCE_FILES "*.h" "*.c" "*.cc" "*.cpp")
ADD_EXECUTABLE (opal-wrapper ${OPAL_WRAPPER_SOURCE_FILES})
TARGET_LINK_LIBRARIES (opal-wrapper libopen-pal Ws2_32.lib shlwapi.lib)
ADD_DEPENDENCIES(opal-wrapper libopen-pal)
IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (opal-wrapper Ws2_32.lib shlwapi.lib
${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib)
SET_TARGET_PROPERTIES(opal-wrapper PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}OPAL_IMPORTS
${OMPI_C_DEF_PRE}OMPI_IMPORTS ${OMPI_C_DEF_PRE}ORTE_IMPORTS
${OMPI_CXX_LAN_FLAG}")
ELSE(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (opal-wrapper libopen-pal Ws2_32.lib shlwapi.lib)
ENDIF(BUILD_SHARED_LIBS)
ADD_CUSTOM_COMMAND (TARGET opal-wrapper

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

@ -51,12 +51,19 @@ SET (ORTE_SOURCE_FILES ${ORTE_SOURCE_FILES} ${MCA_FILES})
ADD_LIBRARY (libopen-rte ${ORTE_SOURCE_FILES})
ADD_DEPENDENCIES(libopen-rte libopen-pal)
# Set compile flags for this target
IF (BUILD_SHARED_LIBS)
ADD_CUSTOM_COMMAND(TARGET libopen-rte POST_BUILD
COMMAND ${OMPI_LIB_CMD} *.obj ${OMPI_LIB_CMD_OUTPUT}${OpenMPI_BINARY_DIR}/libopen-rte-lt${CMAKE_DEBUG_POSTFIX}.lib
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/libopen-rte.dir/${CMAKE_CFG_INTDIR}
COMMENT "Generating static library."
)
SET_TARGET_PROPERTIES(libopen-rte PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}ORTE_EXPORTS ${OMPI_C_DEF_PRE}OPAL_IMPORTS ${OMPI_CXX_LAN_FLAG}")
TARGET_LINK_LIBRARIES (libopen-rte libopen-pal Ws2_32.lib shlwapi.lib)
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}ORTE_EXPORTS ${OMPI_CXX_LAN_FLAG}")
TARGET_LINK_LIBRARIES (libopen-rte ${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib Ws2_32.lib shlwapi.lib)
ELSE (BUILD_SHARED_LIBS)
SET_TARGET_PROPERTIES(libopen-rte PROPERTIES COMPILE_FLAGS "${OMPI_C_DEF_PRE}_LIB ${OMPI_CXX_LAN_FLAG}")
ENDIF(BUILD_SHARED_LIBS)

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

@ -11,15 +11,19 @@ FILE(GLOB_RECURSE ORTE_CHECKPOINT_SOURCE_FILES "*.h" "*.c" "*.cc" "*.cpp")
ADD_EXECUTABLE (orte-checkpoint ${ORTE_CHECKPOINT_SOURCE_FILES})
ADD_DEPENDENCIES(orte-checkpoint libopen-rte libopen-pal)
IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orte-checkpoint Ws2_32.lib shlwapi.lib
${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib
libopen-rte)
SET_TARGET_PROPERTIES(orte-checkpoint PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}OPAL_IMPORTS
${OMPI_C_DEF_PRE}OMPI_IMPORTS ${OMPI_C_DEF_PRE}ORTE_IMPORTS
${OMPI_CXX_LAN_FLAG}")
ELSE(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orte-checkpoint libopen-pal libopen-rte Ws2_32.lib shlwapi.lib)
ENDIF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orte-checkpoint libopen-pal libopen-rte Ws2_32.lib shlwapi.lib)
ADD_CUSTOM_COMMAND (TARGET orte-checkpoint
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy

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

@ -11,14 +11,18 @@ FILE(GLOB_RECURSE ORTE_CLEAN_SOURCE_FILES "*.h" "*.c" "*.cc" "*.cpp")
ADD_EXECUTABLE (orte-clean ${ORTE_CLEAN_SOURCE_FILES})
ADD_DEPENDENCIES(orte-clean libopen-rte libopen-pal)
IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orte-clean Ws2_32.lib shlwapi.lib
${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib
libopen-rte)
SET_TARGET_PROPERTIES(orte-clean PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}OPAL_IMPORTS
${OMPI_C_DEF_PRE}OMPI_IMPORTS ${OMPI_C_DEF_PRE}ORTE_IMPORTS
${OMPI_CXX_LAN_FLAG}")
ENDIF(BUILD_SHARED_LIBS)
ELSE(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orte-clean libopen-pal libopen-rte Ws2_32.lib shlwapi.lib)
ENDIF(BUILD_SHARED_LIBS)
ADD_CUSTOM_COMMAND (TARGET orte-clean
POST_BUILD

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

@ -11,15 +11,19 @@ FILE(GLOB_RECURSE ORTE_PS_SOURCE_FILES "*.h" "*.c" "*.cc" "*.cpp")
ADD_EXECUTABLE (orte-ps ${ORTE_PS_SOURCE_FILES})
ADD_DEPENDENCIES(orte-ps libopen-rte libopen-pal)
IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES(orte-ps Ws2_32.lib shlwapi.lib
${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib
libopen-rte)
SET_TARGET_PROPERTIES(orte-ps PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}OPAL_IMPORTS
${OMPI_C_DEF_PRE}OMPI_IMPORTS ${OMPI_C_DEF_PRE}ORTE_IMPORTS
${OMPI_CXX_LAN_FLAG}")
ELSE(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orte-ps libopen-pal libopen-rte Ws2_32.lib shlwapi.lib)
ENDIF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orte-ps libopen-pal libopen-rte Ws2_32.lib shlwapi.lib)
ADD_CUSTOM_COMMAND (TARGET orte-ps
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy

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

@ -11,14 +11,18 @@ FILE(GLOB_RECURSE ORTED_SOURCE_FILES "*.h" "*.c" "*.cc" "*.cpp")
ADD_EXECUTABLE (orted ${ORTED_SOURCE_FILES})
ADD_DEPENDENCIES(orted libopen-rte libopen-pal)
IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orted Ws2_32.lib shlwapi.lib
${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib
libopen-rte)
SET_TARGET_PROPERTIES(orted PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}OPAL_IMPORTS
${OMPI_C_DEF_PRE}OMPI_IMPORTS ${OMPI_C_DEF_PRE}ORTE_IMPORTS
${OMPI_CXX_LAN_FLAG}")
ELSE(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orted libopen-pal libopen-rte Ws2_32.lib shlwapi.lib)
ENDIF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orted libopen-pal libopen-rte Ws2_32.lib shlwapi.lib)
INSTALL(TARGETS orted
DESTINATION bin)

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

@ -11,15 +11,19 @@ FILE(GLOB_RECURSE ORTERUN_SOURCE_FILES "*.h" "*.c" "*.cc" "*.cpp")
ADD_EXECUTABLE (orterun ${ORTERUN_SOURCE_FILES})
ADD_DEPENDENCIES(orterun libopen-rte libopen-pal)
IF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orterun Ws2_32.lib shlwapi.lib
${OpenMPI_BINARY_DIR}/libopen-pal-lt${CMAKE_DEBUG_POSTFIX}.lib
libopen-rte)
SET_TARGET_PROPERTIES(orterun PROPERTIES
COMPILE_FLAGS "${OMPI_C_DEF_PRE}_USRDLL ${OMPI_C_DEF_PRE}OPAL_IMPORTS
${OMPI_C_DEF_PRE}OMPI_IMPORTS ${OMPI_C_DEF_PRE}ORTE_IMPORTS
${OMPI_CXX_LAN_FLAG}")
ELSE(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orterun libopen-pal libopen-rte Ws2_32.lib shlwapi.lib)
ENDIF(BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES (orterun libopen-pal libopen-rte Ws2_32.lib shlwapi.lib)
ADD_CUSTOM_COMMAND (TARGET orterun
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy