[mpi/msmpi] Add cmake wrapper to fix bug getting MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS when calling FindMPI.cmake on Windows (#24746)

* [mpi] Add cmake wrapper to fix bug getting MPI_${LANG}_ADDITIONAL_INCLUDE_DIRS when calling FindMPI.cmake

* version

* Move wrapper to msmpi, only copy the wrapper in the meta port installation

* version

* typo

* version

* Apply suggestion

* version

* move unset before _find_package

* version

* Add double quotes

* version

* Fix

* version

* Don't double quote list!

* version

* Apply suggestion

* version
This commit is contained in:
Jack·Boos·Yu 2022-05-26 20:05:01 +00:00 committed by GitHub
parent 90024c5770
commit 75536e7c61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 48 additions and 21 deletions

View File

@ -1 +1,5 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled) set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
if (VCPKG_TARGET_IS_WINDOWS)
file(INSTALL "${CURRENT_INSTALLED_DIR}/share/msmpi/mpi-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME vcpkg-cmake-wrapper.cmake)
endif()

View File

@ -1,8 +1,9 @@
{ {
"name": "mpi", "name": "mpi",
"version-string": "1", "version-string": "1",
"port-version": 2, "port-version": 3,
"description": "Message Passing Interface (MPI) is a standardized and portable message-passing standard designed by a group of researchers from academia and industry to function on a wide variety of parallel computing architectures. The standard defines the syntax and semantics of a core of library routines useful to a wide range of users writing portable message-passing programs in C, C++, and Fortran. There are several well-tested and efficient implementations of MPI, many of which are open-source or in the public domain.", "description": "Message Passing Interface (MPI) is a standardized and portable message-passing standard designed by a group of researchers from academia and industry to function on a wide variety of parallel computing architectures. The standard defines the syntax and semantics of a core of library routines useful to a wide range of users writing portable message-passing programs in C, C++, and Fortran. There are several well-tested and efficient implementations of MPI, many of which are open-source or in the public domain.",
"license": null,
"supports": "!uwp", "supports": "!uwp",
"dependencies": [ "dependencies": [
{ {

View File

@ -0,0 +1,9 @@
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
# Suitable for FindMPI.cmake line 937
set(ENV{MSMPI_INC} "${_IMPORT_PREFIX}/include")
unset(_IMPORT_PREFIX)
_find_package(${ARGS})

View File

@ -1,5 +1,5 @@
set(MSMPI_VERSION "10.1.12498") set(MSMPI_VERSION "10.1.12498")
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/msmpi-${MSMPI_VERSION}) set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/msmpi-${MSMPI_VERSION}")
vcpkg_download_distfile(SDK_ARCHIVE vcpkg_download_distfile(SDK_ARCHIVE
URLS "https://download.microsoft.com/download/a/5/2/a5207ca5-1203-491a-8fb8-906fd68ae623/msmpisdk.msi" URLS "https://download.microsoft.com/download/a/5/2/a5207ca5-1203-491a-8fb8-906fd68ae623/msmpisdk.msi"
@ -27,10 +27,10 @@ if(EXISTS "${SYSTEM_MPIEXEC_FILEPATH}")
set(MPIEXEC_VERSION_LOGNAME "mpiexec-version") set(MPIEXEC_VERSION_LOGNAME "mpiexec-version")
vcpkg_execute_required_process( vcpkg_execute_required_process(
COMMAND ${SYSTEM_MPIEXEC_FILEPATH} COMMAND ${SYSTEM_MPIEXEC_FILEPATH}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
LOGNAME ${MPIEXEC_VERSION_LOGNAME} LOGNAME ${MPIEXEC_VERSION_LOGNAME}
) )
file(READ ${CURRENT_BUILDTREES_DIR}/${MPIEXEC_VERSION_LOGNAME}-out.log MPIEXEC_OUTPUT) file(READ "${CURRENT_BUILDTREES_DIR}/${MPIEXEC_VERSION_LOGNAME}-out.log" MPIEXEC_OUTPUT)
if(MPIEXEC_OUTPUT MATCHES "\\[Version ([0-9]+\\.[0-9]+\\.[0-9]+)\\.[0-9]+\\]") if(MPIEXEC_OUTPUT MATCHES "\\[Version ([0-9]+\\.[0-9]+\\.[0-9]+)\\.[0-9]+\\]")
if(NOT CMAKE_MATCH_1 STREQUAL MSMPI_VERSION) if(NOT CMAKE_MATCH_1 STREQUAL MSMPI_VERSION)
@ -69,13 +69,13 @@ file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/msiexec-${TARGET_TRIPLET}.log" MS
set(PARAM_MSI "/a \"${SDK_ARCHIVE}\"") set(PARAM_MSI "/a \"${SDK_ARCHIVE}\"")
set(PARAM_LOG "/log \"${MSIEXEC_LOG_PATH}\"") set(PARAM_LOG "/log \"${MSIEXEC_LOG_PATH}\"")
set(PARAM_TARGET_DIR "TARGETDIR=\"${SDK_SOURCE_DIR}\"") set(PARAM_TARGET_DIR "TARGETDIR=\"${SDK_SOURCE_DIR}\"")
set(SCRIPT_FILE ${CURRENT_BUILDTREES_DIR}/msiextract-msmpi.bat) set(SCRIPT_FILE "${CURRENT_BUILDTREES_DIR}/msiextract-msmpi.bat")
# Write the command out to a script file and run that to avoid weird escaping behavior when spaces are present # 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}") file(WRITE ${SCRIPT_FILE} "msiexec ${PARAM_MSI} /qn ${PARAM_LOG} ${PARAM_TARGET_DIR}")
vcpkg_execute_required_process( vcpkg_execute_required_process(
COMMAND ${SCRIPT_FILE} COMMAND ${SCRIPT_FILE}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
LOGNAME extract-sdk LOGNAME extract-sdk
) )
@ -92,34 +92,37 @@ file(INSTALL
"${SOURCE_INCLUDE_PATH}/pmidbg.h" "${SOURCE_INCLUDE_PATH}/pmidbg.h"
"${SOURCE_INCLUDE_PATH}/${TRIPLET_SYSTEM_ARCH}/mpifptr.h" "${SOURCE_INCLUDE_PATH}/${TRIPLET_SYSTEM_ARCH}/mpifptr.h"
DESTINATION DESTINATION
${CURRENT_PACKAGES_DIR}/include "${CURRENT_PACKAGES_DIR}/include"
) )
# NOTE: since the binary distribution does not include any debug libraries we always install the release libraries # NOTE: since the binary distribution does not include any debug libraries we always install the release libraries
SET(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) SET(VCPKG_POLICY_ONLY_RELEASE_CRT enabled)
file(GLOB STATIC_LIBS file(GLOB STATIC_LIBS
${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifec.lib "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifec.lib"
${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifmc.lib "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifmc.lib"
${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifes.lib "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifes.lib"
${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifms.lib "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifms.lib"
) )
file(INSTALL file(INSTALL
"${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib" "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib"
DESTINATION ${CURRENT_PACKAGES_DIR}/lib DESTINATION "${CURRENT_PACKAGES_DIR}/lib"
) )
file(INSTALL file(INSTALL
"${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib" "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib"
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib"
) )
if(VCPKG_CRT_LINKAGE STREQUAL "static") if(VCPKG_CRT_LINKAGE STREQUAL "static")
file(INSTALL ${STATIC_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib) file(INSTALL ${STATIC_LIBS} DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(INSTALL ${STATIC_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) file(INSTALL ${STATIC_LIBS} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
endif() endif()
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/mpi-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
# Handle copyright # Handle copyright
file(COPY "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/License/MicrosoftMPI-SDK-EULA.rtf" DESTINATION ${CURRENT_PACKAGES_DIR}/share/msmpi) 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/msmpi) 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/msmpi/copyright "See the accompanying MicrosoftMPI-SDK-EULA.rtf and MPI-SDK-TPN.txt") file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "See the accompanying MicrosoftMPI-SDK-EULA.rtf and MPI-SDK-TPN.txt")

View File

@ -1,7 +1,7 @@
{ {
"name": "msmpi", "name": "msmpi",
"version": "10.1.12498", "version": "10.1.12498",
"port-version": 3, "port-version": 4,
"description": "Microsoft MPI (MS-MPI) is a Microsoft implementation of the Message Passing Interface standard for developing and running parallel applications on the Windows platform.", "description": "Microsoft MPI (MS-MPI) is a Microsoft implementation of the Message Passing Interface standard for developing and running parallel applications on the Windows platform.",
"homepage": "https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi", "homepage": "https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi",
"license": "MIT", "license": "MIT",

View File

@ -4658,7 +4658,7 @@
}, },
"mpi": { "mpi": {
"baseline": "1", "baseline": "1",
"port-version": 2 "port-version": 3
}, },
"mpir": { "mpir": {
"baseline": "2022-03-02", "baseline": "2022-03-02",
@ -4710,7 +4710,7 @@
}, },
"msmpi": { "msmpi": {
"baseline": "10.1.12498", "baseline": "10.1.12498",
"port-version": 3 "port-version": 4
}, },
"mstch": { "mstch": {
"baseline": "1.0.2", "baseline": "1.0.2",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "2eacb3d18a3407d1ceb6211ee7cad0b157249d22",
"version-string": "1",
"port-version": 3
},
{ {
"git-tree": "783aea281dc7cdf59ec0636bd60c2feaef6595b4", "git-tree": "783aea281dc7cdf59ec0636bd60c2feaef6595b4",
"version-string": "1", "version-string": "1",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "d3ccfae00ebdaac2c41fa2acfa59b862171be3ae",
"version": "10.1.12498",
"port-version": 4
},
{ {
"git-tree": "92f5e217faeaf4ec7e205a56bfff3a13b75e0393", "git-tree": "92f5e217faeaf4ec7e205a56bfff3a13b75e0393",
"version": "10.1.12498", "version": "10.1.12498",