2020-06-12 02:13:09 +08:00
|
|
|
set(MSMPI_VERSION "10.1.12498")
|
2022-05-27 04:05:01 +08:00
|
|
|
set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/msmpi-${MSMPI_VERSION}")
|
2017-01-11 18:54:00 +08:00
|
|
|
|
|
|
|
vcpkg_download_distfile(SDK_ARCHIVE
|
2020-06-12 02:13:09 +08:00
|
|
|
URLS "https://download.microsoft.com/download/a/5/2/a5207ca5-1203-491a-8fb8-906fd68ae623/msmpisdk.msi"
|
2021-05-07 04:45:57 +08:00
|
|
|
FILENAME "msmpisdk-${MSMPI_VERSION}-b0087dfd.msi"
|
2022-01-26 02:31:15 +08:00
|
|
|
SHA512 b0087dfd21423bf87b94b17d7cb03576838585371bbf8b03cca95c3ad73670108c7bc6517b0de852ef595072cc4143be2011636e7242bcb080394d94294848a7
|
2017-01-11 18:54:00 +08:00
|
|
|
)
|
|
|
|
|
2020-06-12 02:13:09 +08:00
|
|
|
|
|
|
|
#to enable CI, you should modify the following URL also in ${VCPKG_ROOT}/scripts/azure-pipelines/windows/provision-image.ps1
|
2017-08-06 17:33:07 +08:00
|
|
|
macro(download_msmpi_redistributable_package)
|
|
|
|
vcpkg_download_distfile(REDIST_ARCHIVE
|
2020-06-12 02:13:09 +08:00
|
|
|
URLS "https://download.microsoft.com/download/a/5/2/a5207ca5-1203-491a-8fb8-906fd68ae623/msmpisetup.exe"
|
2019-01-17 07:50:46 +08:00
|
|
|
FILENAME "msmpisetup-${MSMPI_VERSION}.exe"
|
2020-06-12 02:13:09 +08:00
|
|
|
SHA512 1ee463e7dfc3e55a7ac048fdfde13fef09a5eea4b74d8fd7c22a7aad667a025b467ce939e5de308e25bbc186c3fe66e0e24ac03a3741656fc7558f2af2fa132a
|
2017-08-06 17:33:07 +08:00
|
|
|
)
|
|
|
|
endmacro()
|
|
|
|
|
2017-02-15 05:03:51 +08:00
|
|
|
### Check for correct version of installed redistributable package
|
|
|
|
|
|
|
|
# We always want the ProgramFiles folder even on a 64-bit machine (not the ProgramFilesx86 folder)
|
2017-02-15 09:29:47 +08:00
|
|
|
vcpkg_get_program_files_platform_bitness(PROGRAM_FILES_PLATFORM_BITNESS)
|
|
|
|
set(SYSTEM_MPIEXEC_FILEPATH "${PROGRAM_FILES_PLATFORM_BITNESS}/Microsoft MPI/Bin/mpiexec.exe")
|
2017-02-08 18:12:18 +08:00
|
|
|
|
2017-10-12 22:52:48 +08:00
|
|
|
if(EXISTS "${SYSTEM_MPIEXEC_FILEPATH}")
|
2017-02-08 18:12:18 +08:00
|
|
|
set(MPIEXEC_VERSION_LOGNAME "mpiexec-version")
|
|
|
|
vcpkg_execute_required_process(
|
|
|
|
COMMAND ${SYSTEM_MPIEXEC_FILEPATH}
|
2022-05-27 04:05:01 +08:00
|
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
|
2017-02-08 18:12:18 +08:00
|
|
|
LOGNAME ${MPIEXEC_VERSION_LOGNAME}
|
|
|
|
)
|
2022-05-27 04:05:01 +08:00
|
|
|
file(READ "${CURRENT_BUILDTREES_DIR}/${MPIEXEC_VERSION_LOGNAME}-out.log" MPIEXEC_OUTPUT)
|
2017-02-08 18:12:18 +08:00
|
|
|
|
2018-01-23 18:50:01 +08:00
|
|
|
if(MPIEXEC_OUTPUT MATCHES "\\[Version ([0-9]+\\.[0-9]+\\.[0-9]+)\\.[0-9]+\\]")
|
2019-01-17 07:50:46 +08:00
|
|
|
if(NOT CMAKE_MATCH_1 STREQUAL MSMPI_VERSION)
|
2017-08-06 17:33:07 +08:00
|
|
|
download_msmpi_redistributable_package()
|
2017-08-09 06:00:28 +08:00
|
|
|
|
2017-02-08 18:12:18 +08:00
|
|
|
message(FATAL_ERROR
|
|
|
|
" The version of the installed MSMPI redistributable packages does not match the version to be installed\n"
|
2019-01-17 07:50:46 +08:00
|
|
|
" Expected version: ${MSMPI_VERSION}\n"
|
2017-08-06 17:33:07 +08:00
|
|
|
" Found version: ${CMAKE_MATCH_1}\n"
|
|
|
|
" Please upgrade the installed version on your system.\n"
|
|
|
|
" The appropriate installer for the expected version has been downloaded to:\n"
|
|
|
|
" ${REDIST_ARCHIVE}\n")
|
2017-02-08 18:12:18 +08:00
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR
|
|
|
|
" Could not determine installed MSMPI redistributable package version.\n"
|
|
|
|
" See logs for more information:\n"
|
|
|
|
" ${CURRENT_BUILDTREES_DIR}\\${MPIEXEC_VERSION_LOGNAME}-out.log\n"
|
|
|
|
" ${CURRENT_BUILDTREES_DIR}\\${MPIEXEC_VERSION_LOGNAME}-err.log\n")
|
|
|
|
endif()
|
|
|
|
else()
|
2017-08-06 17:33:07 +08:00
|
|
|
download_msmpi_redistributable_package()
|
2017-02-08 18:12:18 +08:00
|
|
|
|
|
|
|
message(FATAL_ERROR
|
|
|
|
" Could not find:\n"
|
|
|
|
" ${SYSTEM_MPIEXEC_FILEPATH}\n"
|
|
|
|
" Please install the MSMPI redistributable package before trying to install this port.\n"
|
|
|
|
" The appropriate installer has been downloaded to:\n"
|
|
|
|
" ${REDIST_ARCHIVE}\n")
|
|
|
|
endif()
|
|
|
|
|
2017-01-11 18:54:00 +08:00
|
|
|
file(TO_NATIVE_PATH "${SDK_ARCHIVE}" SDK_ARCHIVE)
|
|
|
|
file(TO_NATIVE_PATH "${SOURCE_PATH}/sdk" SDK_SOURCE_DIR)
|
2017-03-05 17:33:27 +08:00
|
|
|
file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/msiexec-${TARGET_TRIPLET}.log" MSIEXEC_LOG_PATH)
|
2017-01-11 18:54:00 +08:00
|
|
|
|
2017-08-09 06:00:28 +08:00
|
|
|
set(PARAM_MSI "/a \"${SDK_ARCHIVE}\"")
|
|
|
|
set(PARAM_LOG "/log \"${MSIEXEC_LOG_PATH}\"")
|
|
|
|
set(PARAM_TARGET_DIR "TARGETDIR=\"${SDK_SOURCE_DIR}\"")
|
2022-05-27 04:05:01 +08:00
|
|
|
set(SCRIPT_FILE "${CURRENT_BUILDTREES_DIR}/msiextract-msmpi.bat")
|
2017-08-09 06:00:28 +08:00
|
|
|
# Write the command out to a script file and run that to avoid weird escaping behavior when spaces are present
|
|
|
|
file(WRITE ${SCRIPT_FILE} "msiexec ${PARAM_MSI} /qn ${PARAM_LOG} ${PARAM_TARGET_DIR}")
|
|
|
|
|
2017-01-11 18:54:00 +08:00
|
|
|
vcpkg_execute_required_process(
|
2017-08-09 06:00:28 +08:00
|
|
|
COMMAND ${SCRIPT_FILE}
|
2022-05-27 04:05:01 +08:00
|
|
|
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
|
2017-01-11 18:54:00 +08:00
|
|
|
LOGNAME extract-sdk
|
|
|
|
)
|
|
|
|
|
|
|
|
set(SOURCE_INCLUDE_PATH "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/Include")
|
|
|
|
set(SOURCE_LIB_PATH "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/Lib")
|
|
|
|
|
|
|
|
# Install include files
|
|
|
|
file(INSTALL
|
|
|
|
"${SOURCE_INCLUDE_PATH}/mpi.h"
|
|
|
|
"${SOURCE_INCLUDE_PATH}/mpif.h"
|
|
|
|
"${SOURCE_INCLUDE_PATH}/mpi.f90"
|
2017-02-08 18:12:18 +08:00
|
|
|
"${SOURCE_INCLUDE_PATH}/mpio.h"
|
|
|
|
"${SOURCE_INCLUDE_PATH}/mspms.h"
|
|
|
|
"${SOURCE_INCLUDE_PATH}/pmidbg.h"
|
2017-01-11 18:54:00 +08:00
|
|
|
"${SOURCE_INCLUDE_PATH}/${TRIPLET_SYSTEM_ARCH}/mpifptr.h"
|
|
|
|
DESTINATION
|
2022-05-27 04:05:01 +08:00
|
|
|
"${CURRENT_PACKAGES_DIR}/include"
|
2017-01-11 18:54:00 +08:00
|
|
|
)
|
|
|
|
|
2019-06-20 04:28:41 +08:00
|
|
|
# NOTE: since the binary distribution does not include any debug libraries we always install the release libraries
|
|
|
|
SET(VCPKG_POLICY_ONLY_RELEASE_CRT enabled)
|
|
|
|
|
|
|
|
file(GLOB STATIC_LIBS
|
2022-05-27 04:05:01 +08:00
|
|
|
"${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifec.lib"
|
|
|
|
"${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifmc.lib"
|
|
|
|
"${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifes.lib"
|
|
|
|
"${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifms.lib"
|
2019-06-20 04:28:41 +08:00
|
|
|
)
|
|
|
|
|
2017-01-11 18:54:00 +08:00
|
|
|
file(INSTALL
|
|
|
|
"${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib"
|
2022-05-27 04:05:01 +08:00
|
|
|
DESTINATION "${CURRENT_PACKAGES_DIR}/lib"
|
2017-01-11 18:54:00 +08:00
|
|
|
)
|
|
|
|
file(INSTALL
|
|
|
|
"${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib"
|
2022-05-27 04:05:01 +08:00
|
|
|
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib"
|
2017-01-11 18:54:00 +08:00
|
|
|
)
|
2019-06-20 04:28:41 +08:00
|
|
|
|
|
|
|
if(VCPKG_CRT_LINKAGE STREQUAL "static")
|
2022-05-27 04:05:01 +08:00
|
|
|
file(INSTALL ${STATIC_LIBS} DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
|
|
|
file(INSTALL ${STATIC_LIBS} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
2017-02-08 18:12:18 +08:00
|
|
|
endif()
|
2017-01-11 18:54:00 +08:00
|
|
|
|
2022-05-27 04:05:01 +08:00
|
|
|
|
|
|
|
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/mpi-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
|
|
|
|
2017-01-11 18:54:00 +08:00
|
|
|
# Handle copyright
|
2022-05-27 04:05:01 +08:00
|
|
|
file(COPY "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/License/MicrosoftMPI-SDK-EULA.rtf" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
|
|
|
file(COPY "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/License/MPI-SDK-TPN.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
|
|
|
file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "See the accompanying MicrosoftMPI-SDK-EULA.rtf and MPI-SDK-TPN.txt")
|