Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 18 commits into from
May 26, 2022
4 changes: 4 additions & 0 deletions ports/mpi/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
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()
3 changes: 2 additions & 1 deletion ports/mpi/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "mpi",
"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.",
"license": null,
"supports": "!uwp",
"dependencies": [
{
Expand Down
9 changes: 9 additions & 0 deletions ports/msmpi/mpi-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -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})
37 changes: 20 additions & 17 deletions ports/msmpi/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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
URLS "https://download.microsoft.com/download/a/5/2/a5207ca5-1203-491a-8fb8-906fd68ae623/msmpisdk.msi"
Expand Down Expand Up @@ -27,10 +27,10 @@ if(EXISTS "${SYSTEM_MPIEXEC_FILEPATH}")
set(MPIEXEC_VERSION_LOGNAME "mpiexec-version")
vcpkg_execute_required_process(
COMMAND ${SYSTEM_MPIEXEC_FILEPATH}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
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(NOT CMAKE_MATCH_1 STREQUAL MSMPI_VERSION)
Expand Down Expand Up @@ -69,13 +69,13 @@ file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/msiexec-${TARGET_TRIPLET}.log" MS
set(PARAM_MSI "/a \"${SDK_ARCHIVE}\"")
set(PARAM_LOG "/log \"${MSIEXEC_LOG_PATH}\"")
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
file(WRITE ${SCRIPT_FILE} "msiexec ${PARAM_MSI} /qn ${PARAM_LOG} ${PARAM_TARGET_DIR}")

vcpkg_execute_required_process(
COMMAND ${SCRIPT_FILE}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}"
LOGNAME extract-sdk
)

Expand All @@ -92,34 +92,37 @@ file(INSTALL
"${SOURCE_INCLUDE_PATH}/pmidbg.h"
"${SOURCE_INCLUDE_PATH}/${TRIPLET_SYSTEM_ARCH}/mpifptr.h"
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
SET(VCPKG_POLICY_ONLY_RELEASE_CRT enabled)

file(GLOB STATIC_LIBS
${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
"${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"
)

file(INSTALL
"${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib"
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
DESTINATION "${CURRENT_PACKAGES_DIR}/lib"
)
file(INSTALL
"${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")
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}/lib")
file(INSTALL ${STATIC_LIBS} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
endif()


file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/mpi-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

# 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/MPI-SDK-TPN.txt" DESTINATION ${CURRENT_PACKAGES_DIR}/share/msmpi)
file(WRITE ${CURRENT_PACKAGES_DIR}/share/msmpi/copyright "See the accompanying MicrosoftMPI-SDK-EULA.rtf and MPI-SDK-TPN.txt")
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")
2 changes: 1 addition & 1 deletion ports/msmpi/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "msmpi",
"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.",
"homepage": "https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4654,7 +4654,7 @@
},
"mpi": {
"baseline": "1",
"port-version": 2
"port-version": 3
},
"mpir": {
"baseline": "2022-03-02",
Expand Down Expand Up @@ -4706,7 +4706,7 @@
},
"msmpi": {
"baseline": "10.1.12498",
"port-version": 3
"port-version": 4
},
"mstch": {
"baseline": "1.0.2",
Expand Down
5 changes: 5 additions & 0 deletions versions/m-/mpi.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "2eacb3d18a3407d1ceb6211ee7cad0b157249d22",
"version-string": "1",
"port-version": 3
},
{
"git-tree": "783aea281dc7cdf59ec0636bd60c2feaef6595b4",
"version-string": "1",
Expand Down
5 changes: 5 additions & 0 deletions versions/m-/msmpi.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d3ccfae00ebdaac2c41fa2acfa59b862171be3ae",
"version": "10.1.12498",
"port-version": 4
},
{
"git-tree": "92f5e217faeaf4ec7e205a56bfff3a13b75e0393",
"version": "10.1.12498",
Expand Down