From 725d5f3d7752e81ba920fc62a20ff511a7501fa8 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Sat, 29 Aug 2020 12:51:49 +0200 Subject: [PATCH 01/13] [vcpkg] Add option for binary subpath to vcpkg_install_msbuild Some projects might have *.lib/*.dll files in their directories that are not actually build artifacts of the projects themselves. This change allows to specify a sub-directory for vcpkg_install_msbuild, so that only binaries from that directory get installed. This behaves similar to the already present `INCLUDES_SUBPATH`. --- scripts/cmake/vcpkg_install_msbuild.cmake | 26 +++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/scripts/cmake/vcpkg_install_msbuild.cmake b/scripts/cmake/vcpkg_install_msbuild.cmake index 1a0d9513df190b..a08245fb851ae6 100644 --- a/scripts/cmake/vcpkg_install_msbuild.cmake +++ b/scripts/cmake/vcpkg_install_msbuild.cmake @@ -9,6 +9,7 @@ ## PROJECT_SUBPATH ## [INCLUDES_SUBPATH ] ## [LICENSE_SUBPATH ] +## [OUTPUT_SUBPATH ] ## [RELEASE_CONFIGURATION ] ## [DEBUG_CONFIGURATION ] ## [TARGET ] @@ -46,6 +47,11 @@ ## ## This parameter should be a directory and should not end in a trailing slash. ## +## ### BINARIES_SUBPATH +## The subpath to the binaries directory relative to `SOURCE_PATH`. +## +## This parameter should be a directory and should not end in a trailing slash. +## ## ### ALLOW_ROOT_INCLUDES ## Indicates that top-level include files (e.g. `include/zlib.h`) should be allowed. ## @@ -95,7 +101,7 @@ function(vcpkg_install_msbuild) cmake_parse_arguments( _csc "USE_VCPKG_INTEGRATION;ALLOW_ROOT_INCLUDES;REMOVE_ROOT_INCLUDES;SKIP_CLEAN" - "SOURCE_PATH;PROJECT_SUBPATH;INCLUDES_SUBPATH;LICENSE_SUBPATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION;PLATFORM;PLATFORM_TOOLSET;TARGET_PLATFORM_VERSION;TARGET" + "SOURCE_PATH;PROJECT_SUBPATH;INCLUDES_SUBPATH;BINARIES_SUBPATH;LICENSE_SUBPATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION;PLATFORM;PLATFORM_TOOLSET;TARGET_PLATFORM_VERSION;TARGET" "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG" ${ARGN} ) @@ -167,9 +173,13 @@ function(vcpkg_install_msbuild) WORKING_DIRECTORY ${SOURCE_COPY_PATH} LOGNAME build-${TARGET_TRIPLET}-rel ) - file(GLOB_RECURSE LIBS ${SOURCE_COPY_PATH}/*.lib) - file(GLOB_RECURSE DLLS ${SOURCE_COPY_PATH}/*.dll) - file(GLOB_RECURSE EXES ${SOURCE_COPY_PATH}/*.exe) + set(BINARIES_PATH ${SOURCE_COPY_PATH}) + if(DEFINED _csc_BINARIES_SUBPATH) + set(BINARIES_PATH ${BINARIES_PATH}/${_csc_BINARIES_SUBPATH}) + endif() + file(GLOB_RECURSE LIBS ${BINARIES_PATH}/*.lib) + file(GLOB_RECURSE DLLS ${BINARIES_PATH}/*.dll) + file(GLOB_RECURSE EXES ${BINARIES_PATH}/*.exe) if(LIBS) file(COPY ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib) endif() @@ -196,8 +206,12 @@ function(vcpkg_install_msbuild) WORKING_DIRECTORY ${SOURCE_COPY_PATH} LOGNAME build-${TARGET_TRIPLET}-dbg ) - file(GLOB_RECURSE LIBS ${SOURCE_COPY_PATH}/*.lib) - file(GLOB_RECURSE DLLS ${SOURCE_COPY_PATH}/*.dll) + set(BINARIES_PATH ${SOURCE_COPY_PATH}) + if(DEFINED _csc_BINARIES_SUBPATH) + set(BINARIES_PATH ${BINARIES_PATH}/${_csc_BINARIES_SUBPATH}) + endif() + file(GLOB_RECURSE LIBS ${BINARIES_PATH}/*.lib) + file(GLOB_RECURSE DLLS ${BINARIES_PATH}/*.dll) if(LIBS) file(COPY ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) endif() From 75012ccec14c2872f5a73c9e8b3056ebe6543e36 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Sat, 29 Aug 2020 12:52:35 +0200 Subject: [PATCH 02/13] [msmpi] build from source --- ports/msmpi/CONTROL | 1 + ports/msmpi/disable-control-flow-guard.patch | 26 +++ ports/msmpi/fix-external-symbols.patch | 20 ++ ports/msmpi/fix-invalid-boz-literals.patch | 190 +++++++++++++++++ ports/msmpi/no-toolsversion.patch | 17 ++ ports/msmpi/packages.config | 6 + ports/msmpi/portfile.cmake | 206 +++++++++---------- 7 files changed, 357 insertions(+), 109 deletions(-) create mode 100644 ports/msmpi/disable-control-flow-guard.patch create mode 100644 ports/msmpi/fix-external-symbols.patch create mode 100644 ports/msmpi/fix-invalid-boz-literals.patch create mode 100644 ports/msmpi/no-toolsversion.patch create mode 100644 ports/msmpi/packages.config diff --git a/ports/msmpi/CONTROL b/ports/msmpi/CONTROL index 9640f564b459bf..7a9ccfd84328a2 100644 --- a/ports/msmpi/CONTROL +++ b/ports/msmpi/CONTROL @@ -1,5 +1,6 @@ Source: msmpi Version: 10.1 +Port-Version: 1 Homepage: https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi Description: Microsoft MPI Supports: windows diff --git a/ports/msmpi/disable-control-flow-guard.patch b/ports/msmpi/disable-control-flow-guard.patch new file mode 100644 index 00000000000000..f77ba6d0e47e7a --- /dev/null +++ b/ports/msmpi/disable-control-flow-guard.patch @@ -0,0 +1,26 @@ +diff --git a/src/mpi.props b/src/mpi.props +index 8339a89..ba33015 100644 +--- a/src/mpi.props ++++ b/src/mpi.props +@@ -96,7 +96,7 @@ + Full + true + NDEBUG=1;%(PreprocessorDefinitions) +- Guard ++ + + + +diff --git a/src/mpi/msmpi/msmpi.props b/src/mpi/msmpi/msmpi.props +index 878a36a..7e3c4a6 100644 +--- a/src/mpi/msmpi/msmpi.props ++++ b/src/mpi/msmpi/msmpi.props +@@ -13,7 +13,7 @@ + MaxSpeed + true + NDEBUG=1;%(PreprocessorDefinitions) +- Guard ++ + + + diff --git a/ports/msmpi/fix-external-symbols.patch b/ports/msmpi/fix-external-symbols.patch new file mode 100644 index 00000000000000..0f8fa3939516e1 --- /dev/null +++ b/ports/msmpi/fix-external-symbols.patch @@ -0,0 +1,20 @@ +diff --git a/src/mpi/common/mpidef.h b/src/mpi/common/mpidef.h +index bb1d146..8535d19 100644 +--- a/src/mpi/common/mpidef.h ++++ b/src/mpi/common/mpidef.h +@@ -135,13 +135,13 @@ typedef MPIU_Bsize_t MPIDI_msg_sz_t; + */ + + /* PtrToInt converts a pointer to a int type, truncating bits if necessary */ +-#define MPIU_PtrToInt PtrToInt ++#define MPIU_PtrToInt(p) ((INT)(INT_PTR) (p) ) + + /* PtrToAint converts a pointer to an MPI_Aint type, truncating bits if necessary */ + #define MPIU_PtrToAint(a) ((MPI_Aint)(INT_PTR) (a) ) + + /* IntToPtr converts a int to a pointer type, extending bits if necessary */ +-#define MPIU_IntToPtr IntToPtr ++#define MPIU_IntToPtr(i) ((VOID *)(INT_PTR)((int)i)) + + + // diff --git a/ports/msmpi/fix-invalid-boz-literals.patch b/ports/msmpi/fix-invalid-boz-literals.patch new file mode 100644 index 00000000000000..51c5ac75e6b8bb --- /dev/null +++ b/ports/msmpi/fix-invalid-boz-literals.patch @@ -0,0 +1,190 @@ +diff --git a/src/include/mpif.h b/src/include/mpif.h +index f531a15..aaac5d1 100644 +--- a/src/include/mpif.h ++++ b/src/include/mpif.h +@@ -224,7 +224,7 @@ + INTEGER MPI_OP_NULL + PARAMETER (MPI_OP_NULL=402653184) + INTEGER MPI_DATATYPE_NULL +- PARAMETER (MPI_DATATYPE_NULL=z'0c000000') ++ PARAMETER (MPI_DATATYPE_NULL=201326592) + INTEGER MPI_REQUEST_NULL + PARAMETER (MPI_REQUEST_NULL=738197504) + INTEGER MPI_ERRHANDLER_NULL +@@ -300,104 +300,104 @@ + INTEGER MPI_LOCK_SHARED + PARAMETER (MPI_LOCK_SHARED=235) + INTEGER MPI_CHAR +- PARAMETER (MPI_CHAR=z'4c000101') ++ PARAMETER (MPI_CHAR=1275068673) + INTEGER MPI_UNSIGNED_CHAR +- PARAMETER (MPI_UNSIGNED_CHAR=z'4c000102') ++ PARAMETER (MPI_UNSIGNED_CHAR=1275068674) + INTEGER MPI_SHORT +- PARAMETER (MPI_SHORT=z'4c000203') ++ PARAMETER (MPI_SHORT=1275068931) + INTEGER MPI_UNSIGNED_SHORT +- PARAMETER (MPI_UNSIGNED_SHORT=z'4c000204') ++ PARAMETER (MPI_UNSIGNED_SHORT=1275068932) + INTEGER MPI_INT +- PARAMETER (MPI_INT=z'4c000405') ++ PARAMETER (MPI_INT=1275069445) + INTEGER MPI_UNSIGNED +- PARAMETER (MPI_UNSIGNED=z'4c000406') ++ PARAMETER (MPI_UNSIGNED=1275069446) + INTEGER MPI_LONG +- PARAMETER (MPI_LONG=z'4c000407') ++ PARAMETER (MPI_LONG=1275069447) + INTEGER MPI_UNSIGNED_LONG +- PARAMETER (MPI_UNSIGNED_LONG=z'4c000408') ++ PARAMETER (MPI_UNSIGNED_LONG=1275069448) + INTEGER MPI_LONG_LONG +- PARAMETER (MPI_LONG_LONG=z'4c000809') ++ PARAMETER (MPI_LONG_LONG=1275070473) + INTEGER MPI_LONG_LONG_INT +- PARAMETER (MPI_LONG_LONG_INT=z'4c000809') ++ PARAMETER (MPI_LONG_LONG_INT=1275070473) + INTEGER MPI_FLOAT +- PARAMETER (MPI_FLOAT=z'4c00040a') ++ PARAMETER (MPI_FLOAT=1275069450) + INTEGER MPI_DOUBLE +- PARAMETER (MPI_DOUBLE=z'4c00080b') ++ PARAMETER (MPI_DOUBLE=1275070475) + INTEGER MPI_LONG_DOUBLE +- PARAMETER (MPI_LONG_DOUBLE=z'4c00080c') ++ PARAMETER (MPI_LONG_DOUBLE=1275070476) + INTEGER MPI_BYTE +- PARAMETER (MPI_BYTE=z'4c00010d') ++ PARAMETER (MPI_BYTE=1275068685) + INTEGER MPI_WCHAR +- PARAMETER (MPI_WCHAR=z'4c00020e') ++ PARAMETER (MPI_WCHAR=1275068942) + INTEGER MPI_PACKED +- PARAMETER (MPI_PACKED=z'4c00010f') ++ PARAMETER (MPI_PACKED=1275068687) + INTEGER MPI_LB +- PARAMETER (MPI_LB=z'4c000010') ++ PARAMETER (MPI_LB=1275068432) + INTEGER MPI_UB +- PARAMETER (MPI_UB=z'4c000011') ++ PARAMETER (MPI_UB=1275068433) + INTEGER MPI_2INT +- PARAMETER (MPI_2INT=z'4c000816') ++ PARAMETER (MPI_2INT=1275070486) + INTEGER MPI_SIGNED_CHAR +- PARAMETER (MPI_SIGNED_CHAR=z'4c000118') ++ PARAMETER (MPI_SIGNED_CHAR=1275068696) + INTEGER MPI_UNSIGNED_LONG_LONG +- PARAMETER (MPI_UNSIGNED_LONG_LONG=z'4c000819') ++ PARAMETER (MPI_UNSIGNED_LONG_LONG=1275070489) + INTEGER MPI_CHARACTER +- PARAMETER (MPI_CHARACTER=z'4c00011a') ++ PARAMETER (MPI_CHARACTER=1275068698) + INTEGER MPI_INTEGER +- PARAMETER (MPI_INTEGER=z'4c00041b') ++ PARAMETER (MPI_INTEGER=1275069467) + INTEGER MPI_REAL +- PARAMETER (MPI_REAL=z'4c00041c') ++ PARAMETER (MPI_REAL=1275069468) + INTEGER MPI_LOGICAL +- PARAMETER (MPI_LOGICAL=z'4c00041d') ++ PARAMETER (MPI_LOGICAL=1275069469) + INTEGER MPI_COMPLEX +- PARAMETER (MPI_COMPLEX=z'4c00081e') ++ PARAMETER (MPI_COMPLEX=1275070494) + INTEGER MPI_DOUBLE_PRECISION +- PARAMETER (MPI_DOUBLE_PRECISION=z'4c00081f') ++ PARAMETER (MPI_DOUBLE_PRECISION=1275070495) + INTEGER MPI_2INTEGER +- PARAMETER (MPI_2INTEGER=z'4c000820') ++ PARAMETER (MPI_2INTEGER=1275070496) + INTEGER MPI_2REAL +- PARAMETER (MPI_2REAL=z'4c000821') ++ PARAMETER (MPI_2REAL=1275070497) + INTEGER MPI_DOUBLE_COMPLEX +- PARAMETER (MPI_DOUBLE_COMPLEX=z'4c001022') ++ PARAMETER (MPI_DOUBLE_COMPLEX=1275072546) + INTEGER MPI_2DOUBLE_PRECISION +- PARAMETER (MPI_2DOUBLE_PRECISION=z'4c001023') ++ PARAMETER (MPI_2DOUBLE_PRECISION=1275072547) + INTEGER MPI_2COMPLEX +- PARAMETER (MPI_2COMPLEX=z'4c001024') ++ PARAMETER (MPI_2COMPLEX=1275072548) + INTEGER MPI_2DOUBLE_COMPLEX +- PARAMETER (MPI_2DOUBLE_COMPLEX=z'4c002025') ++ PARAMETER (MPI_2DOUBLE_COMPLEX=1275076645) + INTEGER MPI_REAL2 +- PARAMETER (MPI_REAL2=z'0c000000') ++ PARAMETER (MPI_REAL2=201326592) + INTEGER MPI_REAL4 +- PARAMETER (MPI_REAL4=z'4c000427') ++ PARAMETER (MPI_REAL4=1275069479) + INTEGER MPI_COMPLEX8 +- PARAMETER (MPI_COMPLEX8=z'4c000828') ++ PARAMETER (MPI_COMPLEX8=1275070504) + INTEGER MPI_REAL8 +- PARAMETER (MPI_REAL8=z'4c000829') ++ PARAMETER (MPI_REAL8=1275070505) + INTEGER MPI_COMPLEX16 +- PARAMETER (MPI_COMPLEX16=z'4c00102a') ++ PARAMETER (MPI_COMPLEX16=1275072554) + INTEGER MPI_REAL16 +- PARAMETER (MPI_REAL16=z'0c000000') ++ PARAMETER (MPI_REAL16=201326592) + INTEGER MPI_COMPLEX32 +- PARAMETER (MPI_COMPLEX32=z'0c000000') ++ PARAMETER (MPI_COMPLEX32=201326592) + INTEGER MPI_INTEGER1 +- PARAMETER (MPI_INTEGER1=z'4c00012d') ++ PARAMETER (MPI_INTEGER1=1275068717) + INTEGER MPI_COMPLEX4 +- PARAMETER (MPI_COMPLEX4=z'0c000000') ++ PARAMETER (MPI_COMPLEX4=201326592) + INTEGER MPI_INTEGER2 +- PARAMETER (MPI_INTEGER2=z'4c00022f') ++ PARAMETER (MPI_INTEGER2=1275068975) + INTEGER MPI_INTEGER4 +- PARAMETER (MPI_INTEGER4=z'4c000430') ++ PARAMETER (MPI_INTEGER4=1275069488) + INTEGER MPI_INTEGER8 +- PARAMETER (MPI_INTEGER8=z'4c000831') ++ PARAMETER (MPI_INTEGER8=1275070513) + INTEGER MPI_INTEGER16 +- PARAMETER (MPI_INTEGER16=z'0c000000') ++ PARAMETER (MPI_INTEGER16=201326592) + + INCLUDE 'mpifptr.h' + + INTEGER MPI_OFFSET +- PARAMETER (MPI_OFFSET=z'4c00083c') ++ PARAMETER (MPI_OFFSET=1275070524) + INTEGER MPI_COUNT +- PARAMETER (MPI_COUNT=z'4c00083d') ++ PARAMETER (MPI_COUNT=1275070525) + INTEGER MPI_FLOAT_INT + PARAMETER (MPI_FLOAT_INT=-1946157056) + INTEGER MPI_DOUBLE_INT +diff --git a/src/include/x64/mpifptr.h b/src/include/x64/mpifptr.h +index 1d4a288..58d9b62 100644 +--- a/src/include/x64/mpifptr.h ++++ b/src/include/x64/mpifptr.h +@@ -4,6 +4,6 @@ + ! Licensed under the MIT License. + ! + INTEGER MPI_AINT +- PARAMETER (MPI_AINT=z'4c00083b') ++ PARAMETER (MPI_AINT=1275070523) + INTEGER MPI_ADDRESS_KIND + PARAMETER(MPI_ADDRESS_KIND = 8) +diff --git a/src/include/x86/mpifptr.h b/src/include/x86/mpifptr.h +index 1028a1d..ff28c14 100644 +--- a/src/include/x86/mpifptr.h ++++ b/src/include/x86/mpifptr.h +@@ -4,6 +4,6 @@ + ! Licensed under the MIT License. + ! + INTEGER MPI_AINT +- PARAMETER (MPI_AINT=z'4c00043b') ++ PARAMETER (MPI_AINT=1275069499) + INTEGER MPI_ADDRESS_KIND + PARAMETER(MPI_ADDRESS_KIND = 4) diff --git a/ports/msmpi/no-toolsversion.patch b/ports/msmpi/no-toolsversion.patch new file mode 100644 index 00000000000000..bc2880f94a7e28 --- /dev/null +++ b/ports/msmpi/no-toolsversion.patch @@ -0,0 +1,17 @@ +diff --git a/Directory.Build.props b/Directory.Build.props +index 3177de8..208b4b2 100644 +--- a/Directory.Build.props ++++ b/Directory.Build.props +@@ -114,9 +114,9 @@ + + + $(StagingOutputRootPath)$(MSBuildProjectName)\ +- 14.15.26726 +- 10.0.16299.0 +- v141 ++ ++ ++ + $(OutputPath) + $(Platform)\$(Configuration) + $(Configuration) diff --git a/ports/msmpi/packages.config b/ports/msmpi/packages.config new file mode 100644 index 00000000000000..1b9f53b0d55d55 --- /dev/null +++ b/ports/msmpi/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index 58c3661c79d04d..a8cf7b81bc0d28 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -1,127 +1,115 @@ vcpkg_fail_port_install(ON_TARGET "Linux" "OSX" "UWP") -set(MSMPI_VERSION "10.1.12498") -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" - FILENAME "msmpisdk-${MSMPI_VERSION}.msi" - SHA512 330fad53c1979dfae786abed228d82c82207f0d61148e2efc1f37c8931838b806eb50554e7f006a56962f748a21f7017c540bd70444b7a93a72c313a64e9254c +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO microsoft/Microsoft-MPI + REF v10.1.1 + SHA512 c5aef7c15e815dab22a46bdc7ad14fea20e6ed4324f560c3d9df2dd236338b282ec2d4a45522eb04801e3733a0d3db8017ce0ed9f18c3844a452c182296b9e59 + HEAD_REF master + PATCHES + # PlatformToolset and WindowsTargetPlatformVersion are explicitly set by `vcpkg_install_msbuild` + # and VCToolsVersion is automatically selected + no-toolsversion.patch + + # Some symbols referenced from Basestd.h end up unresolved, so we just use the macro version + # of them directly. + fix-external-symbols.patch + + # Disable building with CFG enabled to make it usable from gfortran. + # See https://github.com/microsoft/Microsoft-MPI/issues/7 + disable-control-flow-guard.patch + + # mpif.h uses invalid BOZ integer constants, which will not be accepted without `-fallow-invalid-boz` + # by gfortran >= 10.0, so we convert them to regular integer constants. + fix-invalid-boz-literals.patch ) - -#to enable CI, you should modify the following URL also in ${VCPKG_ROOT}/scripts/azure-pipelines/windows/provision-image.ps1 -macro(download_msmpi_redistributable_package) - vcpkg_download_distfile(REDIST_ARCHIVE - URLS "https://download.microsoft.com/download/a/5/2/a5207ca5-1203-491a-8fb8-906fd68ae623/msmpisetup.exe" - FILENAME "msmpisetup-${MSMPI_VERSION}.exe" - SHA512 1ee463e7dfc3e55a7ac048fdfde13fef09a5eea4b74d8fd7c22a7aad667a025b467ce939e5de308e25bbc186c3fe66e0e24ac03a3741656fc7558f2af2fa132a - ) -endmacro() - -### Check for correct version of installed redistributable package - -# We always want the ProgramFiles folder even on a 64-bit machine (not the ProgramFilesx86 folder) -vcpkg_get_program_files_platform_bitness(PROGRAM_FILES_PLATFORM_BITNESS) -set(SYSTEM_MPIEXEC_FILEPATH "${PROGRAM_FILES_PLATFORM_BITNESS}/Microsoft MPI/Bin/mpiexec.exe") - -if(EXISTS "${SYSTEM_MPIEXEC_FILEPATH}") - set(MPIEXEC_VERSION_LOGNAME "mpiexec-version") - vcpkg_execute_required_process( - COMMAND ${SYSTEM_MPIEXEC_FILEPATH} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} - LOGNAME ${MPIEXEC_VERSION_LOGNAME} - ) - 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) - download_msmpi_redistributable_package() - - message(FATAL_ERROR - " The version of the installed MSMPI redistributable packages does not match the version to be installed\n" - " Expected version: ${MSMPI_VERSION}\n" - " 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") - 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() +# Replace CBT project by packages.config +# See https://github.com/CommonBuildToolset/CBT.Modules/issues/292 +file(REMOVE "${SOURCE_PATH}/.build/Local/CBTModules/CBTModules.proj") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/packages.config" DESTINATION "${SOURCE_PATH}/.build/Local/CBTModules/") + +# Acquire gfortran +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + set(MINGW_PATH mingw32) + set(MSYS_TARGET i686) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(MINGW_PATH mingw64) + set(MSYS_TARGET x86_64) else() - download_msmpi_redistributable_package() - - 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") + message(FATAL_ERROR "Unknown architecture '${VCPKG_TARGET_ARCHITECTURE}' for MinGW Fortran build!") endif() -file(TO_NATIVE_PATH "${SDK_ARCHIVE}" SDK_ARCHIVE) -file(TO_NATIVE_PATH "${SOURCE_PATH}/sdk" SDK_SOURCE_DIR) -file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/msiexec-${TARGET_TRIPLET}.log" MSIEXEC_LOG_PATH) +vcpkg_acquire_msys(MSYS_ROOT PACKAGES "mingw-w64-${MSYS_TARGET}-gcc-fortran") +set(MINGW_BIN "${MSYS_ROOT}/${MINGW_PATH}/bin") +vcpkg_add_to_path(PREPEND "${MINGW_BIN}") -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) -# 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}") +# Acquire Perl +vcpkg_find_acquire_program(PERL) +get_filename_component(PERL_PATH ${PERL} DIRECTORY) +vcpkg_add_to_path(${PERL_PATH}) +# Force a NuGet restore +message(STATUS "Performing nuget restore") vcpkg_execute_required_process( - COMMAND ${SCRIPT_FILE} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} - 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" - "${SOURCE_INCLUDE_PATH}/mpio.h" - "${SOURCE_INCLUDE_PATH}/mspms.h" - "${SOURCE_INCLUDE_PATH}/pmidbg.h" - "${SOURCE_INCLUDE_PATH}/${TRIPLET_SYSTEM_ARCH}/mpifptr.h" - DESTINATION - ${CURRENT_PACKAGES_DIR}/include + COMMAND msbuild "/t:Clean" "/restore" # We use the "Clean" target to make sure nothing gets build here + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME nuget-restore ) -# NOTE: since the binary distribution does not include any debug libraries we always install the release libraries -SET(VCPKG_POLICY_ONLY_RELEASE_CRT enabled) +# Build driver projects by devenv instead of msbuild in advance. +# This makes sure that the message compiler (mc.exe) tasks get executed correctly +if(TRIPLET_SYSTEM_ARCH MATCHES "x86") + set(MSBUILD_PLATFORM "Win32") +else () + set(MSBUILD_PLATFORM ${TRIPLET_SYSTEM_ARCH}) +endif() -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 -) +set(CONFIGURATIONS) +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + list(APPEND CONFIGURATIONS Release) +endif() +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + list(APPEND CONFIGURATIONS Debug) +endif() -file(INSTALL - "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib" - DESTINATION ${CURRENT_PACKAGES_DIR}/lib -) -file(INSTALL - "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib" - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib +set(DRIVER_PROJECTS traceManifest msmpiLaunchSvcMc) + +foreach(PROJECT IN LISTS DRIVER_PROJECTS) + foreach(CONFIGURATION IN LISTS CONFIGURATIONS) + message(STATUS "Building ${PROJECT} for ${CONFIGURATION}") + vcpkg_execute_required_process( + COMMAND devenv "./src/msmpi.sln" /Build "${CONFIGURATION}|${MSBUILD_PLATFORM}" /Project "${PROJECT}" + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME build-driver-project-${PROJECT}-${CONFIGURATION}-${TARGET_TRIPLET} + ) + endforeach() +endforeach() + +# Build the project +list(GET CONFIGURATIONS 0 HEADER_CONFIGURATION) +vcpkg_install_msbuild( + SOURCE_PATH "${SOURCE_PATH}" + PROJECT_SUBPATH . + BINARIES_SUBPATH out/*/bin + LICENSE_SUBPATH LICENSE.txt + SKIP_CLEAN + OPTIONS + "/p:GFORTRAN_BIN=${MINGW_BIN}" ) -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) +# The headers to install are located in the build directories +get_filename_component(SOURCE_PATH_SUFFIX "${SOURCE_PATH}" NAME) +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + set(INCLUDES_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${SOURCE_PATH_SUFFIX}/out/Release-${MSBUILD_PLATFORM}/bin/sdk/inc) +elseif(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + set(INCLUDES_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-deb/${SOURCE_PATH_SUFFIX}/out/Debug-${MSBUILD_PLATFORM}/bin/sdk/inc) endif() -# 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 ${INCLUDES_DIR}/${TRIPLET_SYSTEM_ARCH}/mpifptr.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/) +file(REMOVE_RECURSE ${INCLUDES_DIR}/x64) +file(REMOVE_RECURSE ${INCLUDES_DIR}/x86) + +file(COPY ${INCLUDES_DIR}/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/) + +vcpkg_clean_msbuild() From 8dd2ee42740995a1111fb9a7261e312cf414e70d Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Sat, 29 Aug 2020 22:47:12 +0200 Subject: [PATCH 03/13] [msmpi] apply fixes for NuGet restore as patch instead of manual commanda --- ports/msmpi/fix-nuget-restore.patch | 80 +++++++++++++++++++++++++++++ ports/msmpi/packages.config | 6 --- ports/msmpi/portfile.cmake | 9 ++-- 3 files changed, 84 insertions(+), 11 deletions(-) create mode 100644 ports/msmpi/fix-nuget-restore.patch delete mode 100644 ports/msmpi/packages.config diff --git a/ports/msmpi/fix-nuget-restore.patch b/ports/msmpi/fix-nuget-restore.patch new file mode 100644 index 00000000000000..17006ebe5f9431 --- /dev/null +++ b/ports/msmpi/fix-nuget-restore.patch @@ -0,0 +1,80 @@ +diff --git a/.build/Local/CBTModules/CBTModules.proj b/.build/Local/CBTModules/CBTModules.proj +deleted file mode 100644 +index 8a8d130..0000000 +--- a/.build/Local/CBTModules/CBTModules.proj ++++ /dev/null +@@ -1,60 +0,0 @@ +- +- +- +- net46 +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +\ No newline at end of file +diff --git a/.build/Local/CBTModules/packages.config b/.build/Local/CBTModules/packages.config +new file mode 100644 +index 0000000..80dbe71 +--- /dev/null ++++ b/.build/Local/CBTModules/packages.config +@@ -0,0 +1,6 @@ ++ ++ ++ ++ ++ ++ +\ No newline at end of file diff --git a/ports/msmpi/packages.config b/ports/msmpi/packages.config deleted file mode 100644 index 1b9f53b0d55d55..00000000000000 --- a/ports/msmpi/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index a8cf7b81bc0d28..2a69cf4c913db6 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -22,12 +22,11 @@ vcpkg_from_github( # mpif.h uses invalid BOZ integer constants, which will not be accepted without `-fallow-invalid-boz` # by gfortran >= 10.0, so we convert them to regular integer constants. fix-invalid-boz-literals.patch -) -# Replace CBT project by packages.config -# See https://github.com/CommonBuildToolset/CBT.Modules/issues/292 -file(REMOVE "${SOURCE_PATH}/.build/Local/CBTModules/CBTModules.proj") -file(COPY "${CMAKE_CURRENT_LIST_DIR}/packages.config" DESTINATION "${SOURCE_PATH}/.build/Local/CBTModules/") + # Replace CBT project by packages.config + # See https://github.com/CommonBuildToolset/CBT.Modules/issues/292 + fix-nuget-restore.patch +) # Acquire gfortran if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") From a9dc12c107be0a0628366549747b63a0485bc0e2 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Sat, 29 Aug 2020 19:26:36 +0200 Subject: [PATCH 04/13] [msmpi] Add patch to remove WDK dependency --- ports/msmpi/no-wdk.patch | 59 ++++++++++++++++++++++++++++++++++++++ ports/msmpi/portfile.cmake | 47 +++++++----------------------- 2 files changed, 69 insertions(+), 37 deletions(-) create mode 100644 ports/msmpi/no-wdk.patch diff --git a/ports/msmpi/no-wdk.patch b/ports/msmpi/no-wdk.patch new file mode 100644 index 00000000000000..85fe58cfa506df --- /dev/null +++ b/ports/msmpi/no-wdk.patch @@ -0,0 +1,59 @@ +diff --git a/src/launchSvc/msmpiLaunchSvcMc.vcxproj b/src/launchSvc/msmpiLaunchSvcMc.vcxproj +index 2a6952b..e901dcc 100644 +--- a/src/launchSvc/msmpiLaunchSvcMc.vcxproj ++++ b/src/launchSvc/msmpiLaunchSvcMc.vcxproj +@@ -11,16 +11,13 @@ + + None + false +- WindowsUserModeDriver10.0 + + + +- +- true +- $(SrcRoot)\launchsvc\$(O) +- true +- $(SrcRoot)\launchsvc\$(O) +- ++ ++ mc.exe -h $(SrcRoot)\launchsvc\$(O) -r $(SrcRoot)\launchsvc\$(O) launchsvcmsg.mc ++ $(SrcRoot)\launchsvc\$(O)\launchsvcmsg.h;$(SrcRoot)\launchsvc\$(O)\launchsvcmsg.rc ++ + + + +\ No newline at end of file +diff --git a/src/mpi/common/traceManifest.vcxproj b/src/mpi/common/traceManifest.vcxproj +index f80e80b..736ef65 100644 +--- a/src/mpi/common/traceManifest.vcxproj ++++ b/src/mpi/common/traceManifest.vcxproj +@@ -8,23 +8,16 @@ + + false + None +- WindowsUserModeDriver10.0 + None + + + + + +- +- true +- $(MPI_SRC_ROOT)\common\$(O) +- true +- $(MPI_SRC_ROOT)\common\$(O) +- MpiTraceEvents +- true +- Trace +- EVENT_ +- ++ ++ mc.exe -um -p Trace -P EVENT_ -h $(MPI_SRC_ROOT)\common\$(O) -r $(MPI_SRC_ROOT)\common\$(O) -z MpiTraceEvents $(MPI_SRC_ROOT)\common\mpitrace.man ++ $(MPI_SRC_ROOT)\common\$(O)\MpiTraceEvents.h;$(MPI_SRC_ROOT)\common\$(O)\MpiTraceEvents.rc ++ + + + +\ No newline at end of file diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index 2a69cf4c913db6..f458f474fc88ba 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -26,6 +26,10 @@ vcpkg_from_github( # Replace CBT project by packages.config # See https://github.com/CommonBuildToolset/CBT.Modules/issues/292 fix-nuget-restore.patch + + # Replace usage of the `MessageCompile` target by a custom build step. + # This removes the dependency to the Windows Driver Kit + no-wdk.patch ) # Acquire gfortran @@ -48,43 +52,6 @@ vcpkg_find_acquire_program(PERL) get_filename_component(PERL_PATH ${PERL} DIRECTORY) vcpkg_add_to_path(${PERL_PATH}) -# Force a NuGet restore -message(STATUS "Performing nuget restore") -vcpkg_execute_required_process( - COMMAND msbuild "/t:Clean" "/restore" # We use the "Clean" target to make sure nothing gets build here - WORKING_DIRECTORY ${SOURCE_PATH} - LOGNAME nuget-restore -) - -# Build driver projects by devenv instead of msbuild in advance. -# This makes sure that the message compiler (mc.exe) tasks get executed correctly -if(TRIPLET_SYSTEM_ARCH MATCHES "x86") - set(MSBUILD_PLATFORM "Win32") -else () - set(MSBUILD_PLATFORM ${TRIPLET_SYSTEM_ARCH}) -endif() - -set(CONFIGURATIONS) -if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - list(APPEND CONFIGURATIONS Release) -endif() -if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - list(APPEND CONFIGURATIONS Debug) -endif() - -set(DRIVER_PROJECTS traceManifest msmpiLaunchSvcMc) - -foreach(PROJECT IN LISTS DRIVER_PROJECTS) - foreach(CONFIGURATION IN LISTS CONFIGURATIONS) - message(STATUS "Building ${PROJECT} for ${CONFIGURATION}") - vcpkg_execute_required_process( - COMMAND devenv "./src/msmpi.sln" /Build "${CONFIGURATION}|${MSBUILD_PLATFORM}" /Project "${PROJECT}" - WORKING_DIRECTORY ${SOURCE_PATH} - LOGNAME build-driver-project-${PROJECT}-${CONFIGURATION}-${TARGET_TRIPLET} - ) - endforeach() -endforeach() - # Build the project list(GET CONFIGURATIONS 0 HEADER_CONFIGURATION) vcpkg_install_msbuild( @@ -97,6 +64,12 @@ vcpkg_install_msbuild( "/p:GFORTRAN_BIN=${MINGW_BIN}" ) +if(TRIPLET_SYSTEM_ARCH MATCHES "x86") + set(MSBUILD_PLATFORM "Win32") +else () + set(MSBUILD_PLATFORM ${TRIPLET_SYSTEM_ARCH}) +endif() + # The headers to install are located in the build directories get_filename_component(SOURCE_PATH_SUFFIX "${SOURCE_PATH}" NAME) if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") From 01f629022e42812fc072c032d8140df5c24fdf5e Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Sun, 30 Aug 2020 14:38:59 +0200 Subject: [PATCH 05/13] [msmpi] fix building for x86 --- ports/msmpi/disable-x86-safeseh.patch | 12 ++++++++++++ ports/msmpi/portfile.cmake | 17 +++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 ports/msmpi/disable-x86-safeseh.patch diff --git a/ports/msmpi/disable-x86-safeseh.patch b/ports/msmpi/disable-x86-safeseh.patch new file mode 100644 index 00000000000000..2a82f1cee24682 --- /dev/null +++ b/ports/msmpi/disable-x86-safeseh.patch @@ -0,0 +1,12 @@ +diff --git a/src/mpi/msmpi/dll/msmpi.vcxproj b/src/mpi/msmpi/dll/msmpi.vcxproj +index 255b9f5..020a0cc 100644 +--- a/src/mpi/msmpi/dll/msmpi.vcxproj ++++ b/src/mpi/msmpi/dll/msmpi.vcxproj +@@ -31,6 +31,7 @@ + true + _DllMainCRTStartup + _DllMainCRTStartup@12 ++ false + + %(AdditionalDependencies); + $(PUBLIC_SDK_LIB)\kernel32.lib; diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index f458f474fc88ba..010c5d1b496126 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -30,6 +30,12 @@ vcpkg_from_github( # Replace usage of the `MessageCompile` target by a custom build step. # This removes the dependency to the Windows Driver Kit no-wdk.patch + + # Linking msmpi for x86 failes with "Unable to generate SAFESEH image", probably + # because the one object file generated by gfortran does not include the necessary data. + # The easiest workaround seemed to simply disable the linker to generate + # the safe exception handler tables. + disable-x86-safeseh.patch ) # Acquire gfortran @@ -60,22 +66,17 @@ vcpkg_install_msbuild( BINARIES_SUBPATH out/*/bin LICENSE_SUBPATH LICENSE.txt SKIP_CLEAN + PLATFORM ${VCPKG_TARGET_ARCHITECTURE} OPTIONS "/p:GFORTRAN_BIN=${MINGW_BIN}" ) -if(TRIPLET_SYSTEM_ARCH MATCHES "x86") - set(MSBUILD_PLATFORM "Win32") -else () - set(MSBUILD_PLATFORM ${TRIPLET_SYSTEM_ARCH}) -endif() - # The headers to install are located in the build directories get_filename_component(SOURCE_PATH_SUFFIX "${SOURCE_PATH}" NAME) if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - set(INCLUDES_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${SOURCE_PATH_SUFFIX}/out/Release-${MSBUILD_PLATFORM}/bin/sdk/inc) + set(INCLUDES_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${SOURCE_PATH_SUFFIX}/out/Release-${VCPKG_TARGET_ARCHITECTURE}/bin/sdk/inc) elseif(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - set(INCLUDES_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-deb/${SOURCE_PATH_SUFFIX}/out/Debug-${MSBUILD_PLATFORM}/bin/sdk/inc) + set(INCLUDES_DIR ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-deb/${SOURCE_PATH_SUFFIX}/out/Debug-${VCPKG_TARGET_ARCHITECTURE}/bin/sdk/inc) endif() file(COPY ${INCLUDES_DIR}/${TRIPLET_SYSTEM_ARCH}/mpifptr.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/) From 3bf854ec2d4343cd167a479f554f27c36000ded7 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Sun, 30 Aug 2020 15:09:21 +0200 Subject: [PATCH 06/13] [msmpi] support dynamic CRT --- ports/msmpi/portfile.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index 010c5d1b496126..87e8b130ef5619 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -38,6 +38,16 @@ vcpkg_from_github( disable-x86-safeseh.patch ) +if(VCPKG_CRT_LINKAGE STREQUAL dynamic) + set(PROPERTY_FILE_PATHS "${SOURCE_PATH}/Directory.Build.props" "${SOURCE_PATH}/src/mpi.props" ) + foreach(PROPERTY_FILE_PATH IN LISTS PROPERTY_FILE_PATHS) + file(READ ${PROPERTY_FILE_PATH} _contents) + string(REPLACE "MultiThreaded" "MultiThreadedDLL" _contents "${_contents}") + string(REPLACE "MultiThreadedDebug" "MultiThreadedDebugDLL" _contents "${_contents}") + file(WRITE ${PROPERTY_FILE_PATH} "${_contents}") + endforeach() +endif() + # Acquire gfortran if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") set(MINGW_PATH mingw32) From 94aa80000a5e8770a1442990b2682d53156641a6 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Sun, 30 Aug 2020 15:11:40 +0200 Subject: [PATCH 07/13] [msmpi] Mark to support only dynamic library --- ports/msmpi/portfile.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index 87e8b130ef5619..3088ce8593e16a 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -1,5 +1,7 @@ vcpkg_fail_port_install(ON_TARGET "Linux" "OSX" "UWP") +vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO microsoft/Microsoft-MPI From 76e436465c6bef8edbaa32c9a4dd62ee6950093a Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Sun, 30 Aug 2020 18:50:41 +0200 Subject: [PATCH 08/13] [msmpi] Use NetworkDirect provided by vcpkg --- ports/msmpi/CONTROL | 1 + ports/msmpi/networkdirect-no-nuget.patch | 44 ++++++++++++++++++++++++ ports/msmpi/portfile.cmake | 5 +++ 3 files changed, 50 insertions(+) create mode 100644 ports/msmpi/networkdirect-no-nuget.patch diff --git a/ports/msmpi/CONTROL b/ports/msmpi/CONTROL index 7a9ccfd84328a2..c7fcec34df55ea 100644 --- a/ports/msmpi/CONTROL +++ b/ports/msmpi/CONTROL @@ -4,3 +4,4 @@ Port-Version: 1 Homepage: https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi Description: Microsoft MPI Supports: windows +Build-Depends: networkdirect-sdk diff --git a/ports/msmpi/networkdirect-no-nuget.patch b/ports/msmpi/networkdirect-no-nuget.patch new file mode 100644 index 00000000000000..a0b267beb712d2 --- /dev/null +++ b/ports/msmpi/networkdirect-no-nuget.patch @@ -0,0 +1,44 @@ +diff --git a/src/mpi/msmpi/channels/mpichannels.vcxproj b/src/mpi/msmpi/channels/mpichannels.vcxproj +index 2093a96..094500c 100644 +--- a/src/mpi/msmpi/channels/mpichannels.vcxproj ++++ b/src/mpi/msmpi/channels/mpichannels.vcxproj +@@ -65,10 +65,6 @@ + + + +- +- +- +- + + + +diff --git a/src/mpi/msmpi/dll/msmpi.vcxproj b/src/mpi/msmpi/dll/msmpi.vcxproj +index 255b9f5..e2a6455 100644 +--- a/src/mpi/msmpi/dll/msmpi.vcxproj ++++ b/src/mpi/msmpi/dll/msmpi.vcxproj +@@ -119,9 +119,5 @@ if not %rc%==1 exit %rce% else exit 0 + + + +- +- +- +- + + +diff --git a/src/mpi/msmpi/mpid/mpid.vcxproj b/src/mpi/msmpi/mpid/mpid.vcxproj +index de9cebf..ac83ff3 100644 +--- a/src/mpi/msmpi/mpid/mpid.vcxproj ++++ b/src/mpi/msmpi/mpid/mpid.vcxproj +@@ -95,10 +95,6 @@ + + + +- +- +- +- + + + diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index 3088ce8593e16a..5ffb6df729f592 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -38,6 +38,10 @@ vcpkg_from_github( # The easiest workaround seemed to simply disable the linker to generate # the safe exception handler tables. disable-x86-safeseh.patch + + # Remove the NetworkDirect NuGet dependency because we want to use the library provided by vcpkg. + # It will be picked up because of USE_VCPKG_INTEGRATION used below. + networkdirect-no-nuget.patch ) if(VCPKG_CRT_LINKAGE STREQUAL dynamic) @@ -79,6 +83,7 @@ vcpkg_install_msbuild( LICENSE_SUBPATH LICENSE.txt SKIP_CLEAN PLATFORM ${VCPKG_TARGET_ARCHITECTURE} + USE_VCPKG_INTEGRATION OPTIONS "/p:GFORTRAN_BIN=${MINGW_BIN}" ) From eaf80fbb2a9b43f1e90f0378d9f9db73017033f8 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Sun, 30 Aug 2020 18:51:23 +0200 Subject: [PATCH 09/13] [networkdirect-sdk] Fix check for valid architectures --- ports/networkdirect-sdk/portfile.cmake | 2 +- scripts/ci.baseline.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/networkdirect-sdk/portfile.cmake b/ports/networkdirect-sdk/portfile.cmake index bb893ed9065117..d7cf0ffc4590b8 100644 --- a/ports/networkdirect-sdk/portfile.cmake +++ b/ports/networkdirect-sdk/portfile.cmake @@ -5,7 +5,7 @@ if (VCPKG_CMAKE_SYSTEM_NAME) message(FATAL_ERROR "networkDirect-sdk only supports windows") endif() -if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") +if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" AND NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") message(FATAL_ERROR "networkDirect-sdk only supports x64 and x86") endif() diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index b8a17988f2569a..375b843e3c6916 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1135,7 +1135,6 @@ networkdirect-sdk:arm-uwp=fail networkdirect-sdk:x64-linux=fail networkdirect-sdk:x64-osx=fail networkdirect-sdk:x64-uwp=fail -networkdirect-sdk:x86-windows=fail ngspice:x64-windows-static=fail nmslib:arm64-windows=fail nmslib:arm-uwp=fail From f343ad78fd3205aca09cbc2dec83456b593e10f9 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Mon, 31 Aug 2020 09:40:32 +0200 Subject: [PATCH 10/13] [networkdirect-sdk] increase port version --- ports/networkdirect-sdk/CONTROL | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/networkdirect-sdk/CONTROL b/ports/networkdirect-sdk/CONTROL index 158183800d5d31..f608272728911c 100644 --- a/ports/networkdirect-sdk/CONTROL +++ b/ports/networkdirect-sdk/CONTROL @@ -1,5 +1,6 @@ Source: networkdirect-sdk Version: 2.0.1 +Port-Version: 1 Description: The Network Direct architecture allows hardware vendors to expose the advanced capabilities of their networking devices. Homepage: https://www.nuget.org/packages/NetworkDirect Supports: windows&(x64|x86) \ No newline at end of file From 6e226b3718391109658b5f0b09bf918fba6d69bf Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Mon, 31 Aug 2020 10:05:52 +0200 Subject: [PATCH 11/13] [msmpi] Mark static build as failed in ci baseline --- scripts/ci.baseline.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 375b843e3c6916..dde994e0bc36d0 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1096,6 +1096,7 @@ msmpi:arm-uwp=fail msmpi:x64-linux=fail msmpi:x64-osx=fail msmpi:x64-uwp=fail +msmpi:x64-windows-static=fail munit:arm-uwp=fail munit:arm64-windows=fail munit:x64-uwp=fail From 84954e1713cbbbdd14aaf4289b121571be7569f2 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Tue, 1 Sep 2020 10:59:09 +0200 Subject: [PATCH 12/13] [msmpi] do not disable CFG --- ports/msmpi/disable-control-flow-guard.patch | 26 -------------------- ports/msmpi/portfile.cmake | 4 --- 2 files changed, 30 deletions(-) delete mode 100644 ports/msmpi/disable-control-flow-guard.patch diff --git a/ports/msmpi/disable-control-flow-guard.patch b/ports/msmpi/disable-control-flow-guard.patch deleted file mode 100644 index f77ba6d0e47e7a..00000000000000 --- a/ports/msmpi/disable-control-flow-guard.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/src/mpi.props b/src/mpi.props -index 8339a89..ba33015 100644 ---- a/src/mpi.props -+++ b/src/mpi.props -@@ -96,7 +96,7 @@ - Full - true - NDEBUG=1;%(PreprocessorDefinitions) -- Guard -+ - - - -diff --git a/src/mpi/msmpi/msmpi.props b/src/mpi/msmpi/msmpi.props -index 878a36a..7e3c4a6 100644 ---- a/src/mpi/msmpi/msmpi.props -+++ b/src/mpi/msmpi/msmpi.props -@@ -13,7 +13,7 @@ - MaxSpeed - true - NDEBUG=1;%(PreprocessorDefinitions) -- Guard -+ - - - diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index 5ffb6df729f592..b4d9e73d1a502a 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -17,10 +17,6 @@ vcpkg_from_github( # of them directly. fix-external-symbols.patch - # Disable building with CFG enabled to make it usable from gfortran. - # See https://github.com/microsoft/Microsoft-MPI/issues/7 - disable-control-flow-guard.patch - # mpif.h uses invalid BOZ integer constants, which will not be accepted without `-fallow-invalid-boz` # by gfortran >= 10.0, so we convert them to regular integer constants. fix-invalid-boz-literals.patch From 1c6c03e9bf7193c7a07566b7e9dd89987106a0a1 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Tue, 1 Sep 2020 10:59:45 +0200 Subject: [PATCH 13/13] [msmpi] do not disable SAFESEH --- ports/msmpi/disable-x86-safeseh.patch | 12 ------------ ports/msmpi/portfile.cmake | 6 ------ 2 files changed, 18 deletions(-) delete mode 100644 ports/msmpi/disable-x86-safeseh.patch diff --git a/ports/msmpi/disable-x86-safeseh.patch b/ports/msmpi/disable-x86-safeseh.patch deleted file mode 100644 index 2a82f1cee24682..00000000000000 --- a/ports/msmpi/disable-x86-safeseh.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/src/mpi/msmpi/dll/msmpi.vcxproj b/src/mpi/msmpi/dll/msmpi.vcxproj -index 255b9f5..020a0cc 100644 ---- a/src/mpi/msmpi/dll/msmpi.vcxproj -+++ b/src/mpi/msmpi/dll/msmpi.vcxproj -@@ -31,6 +31,7 @@ - true - _DllMainCRTStartup - _DllMainCRTStartup@12 -+ false - - %(AdditionalDependencies); - $(PUBLIC_SDK_LIB)\kernel32.lib; diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index b4d9e73d1a502a..3abbb831ba5867 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -29,12 +29,6 @@ vcpkg_from_github( # This removes the dependency to the Windows Driver Kit no-wdk.patch - # Linking msmpi for x86 failes with "Unable to generate SAFESEH image", probably - # because the one object file generated by gfortran does not include the necessary data. - # The easiest workaround seemed to simply disable the linker to generate - # the safe exception handler tables. - disable-x86-safeseh.patch - # Remove the NetworkDirect NuGet dependency because we want to use the library provided by vcpkg. # It will be picked up because of USE_VCPKG_INTEGRATION used below. networkdirect-no-nuget.patch