2017-01-11 18:54:00 +08:00
include ( vcpkg_common_functions )
2017-08-06 17:33:07 +08:00
set ( SOURCE_PATH ${ CURRENT_BUILDTREES_DIR } /src/msmpi-8.1 )
2017-01-11 18:54:00 +08:00
vcpkg_download_distfile ( SDK_ARCHIVE
2017-08-06 17:33:07 +08:00
U R L S " h t t p s : / / d o w n l o a d . m i c r o s o f t . c o m / d o w n l o a d / D / B / B / D B B 6 4 B A 1 - 7 B 5 1 - 4 3 D B - 8 B F 1 - D 1 F B 4 5 E A C F 7 A / m s m p i s d k . m s i "
F I L E N A M E " m s m p i s d k - 8 . 1 . m s i "
S H A 5 1 2 a 0 c f b 7 1 3 8 6 5 2 5 7 b 8 1 2 c 1 9 6 4 4 2 8 6 f c 0 d 0 2 e c 5 7 c e 2 a 0 b e a 0 6 6 f e a d 4 e 0 f f 1 8 b 5 4 5 a 0 7 8 7 0 6 5 a b 7 4 8 f 8 d d 3 3 5 b b 2 f a 4 8 6 9 1 1 a a b 5 4 c 1 b 8 4 2 9 9 3 b 7 b 6 8 5 c 5 8 3 2 c 0 1 4 a 6 3 b f
2017-01-11 18:54:00 +08:00
)
2017-08-06 17:33:07 +08:00
macro ( download_msmpi_redistributable_package )
vcpkg_download_distfile ( REDIST_ARCHIVE
U R L S " h t t p s : / / d o w n l o a d . m i c r o s o f t . c o m / d o w n l o a d / D / B / B / D B B 6 4 B A 1 - 7 B 5 1 - 4 3 D B - 8 B F 1 - D 1 F B 4 5 E A C F 7 A / M S M p i S e t u p . e x e "
F I L E N A M E " M S M p i S e t u p - 8 . 1 . e x e "
S H A 5 1 2 9 2 a e 6 5 f 3 d 5 2 e 7 8 6 e 3 9 d f f e d a b d f 4 8 2 5 5 b 4 9 8 5 a 0 7 5 9 9 3 e 6 2 6 f 5 f 5 9 6 7 4 e 9 f f a e d b f 3 3 a 4 7 2 5 e 8 f 1 4 2 b 2 1 4 6 8 e 2 4 c d 6 d 3 e 4 9 f 3 d 9 1 d a 0 f b d a 1 8 6 7 7 8 4 c c 9 3 3 0 0 c 1 2 c 9 6 b
)
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" )
2018-01-23 18:50:01 +08:00
set ( MSMPI_EXPECTED_FULL_VERSION "8.1.12438" )
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 (
C O M M A N D $ { S Y S T E M _ M P I E X E C _ F I L E P A T H }
W O R K I N G _ D I R E C T O R Y $ { C U R R E N T _ B U I L D T R E E S _ D I R }
L O G N A M E $ { M P I E X E C _ V E R S I O N _ L O G N A M E }
)
file ( READ ${ CURRENT_BUILDTREES_DIR } / ${ MPIEXEC_VERSION_LOGNAME } -out.log MPIEXEC_OUTPUT )
2018-01-23 18:50:01 +08:00
# Note: v8.1.1 was released with version 8.1.12438.1091. This is compatible with 8.1.12438.1084 (the version above), so ignore the fourth version number.
if ( MPIEXEC_OUTPUT MATCHES "\\[Version ([0-9]+\\.[0-9]+\\.[0-9]+)\\.[0-9]+\\]" )
2017-10-12 22:52:48 +08:00
if ( NOT CMAKE_MATCH_1 STREQUAL MSMPI_EXPECTED_FULL_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
" T h e v e r s i o n o f t h e i n s t a l l e d M S M P I r e d i s t r i b u t a b l e p a c k a g e s d o e s n o t m a t c h t h e v e r s i o n t o b e i n s t a l l e d \ n "
2017-08-06 17:33:07 +08:00
" E x p e c t e d v e r s i o n : $ { M S M P I _ E X P E C T E D _ F U L L _ V E R S I O N } \ n "
" F o u n d v e r s i o n : $ { C M A K E _ M A T C H _ 1 } \ n "
" P l e a s e u p g r a d e t h e i n s t a l l e d v e r s i o n o n y o u r s y s t e m . \ n "
" T h e a p p r o p r i a t e i n s t a l l e r f o r t h e e x p e c t e d v e r s i o n h a s b e e n d o w n l o a d e d t o : \ n "
" $ { R E D I S T _ A R C H I V E } \ n " )
2017-02-08 18:12:18 +08:00
endif ( )
else ( )
message ( FATAL_ERROR
" C o u l d n o t d e t e r m i n e i n s t a l l e d M S M P I r e d i s t r i b u t a b l e p a c k a g e v e r s i o n . \ n "
" S e e l o g s f o r m o r e i n f o r m a t i o n : \ n "
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } \ \ $ { M P I E X E C _ V E R S I O N _ L O G N A M E } - o u t . l o g \ n "
" $ { C U R R E N T _ B U I L D T R E E S _ D I R } \ \ $ { M P I E X E C _ V E R S I O N _ L O G N A M E } - e r r . l o g \ 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
" C o u l d n o t f i n d : \ n "
" $ { S Y S T E M _ M P I E X E C _ F I L E P A T H } \ n "
" P l e a s e i n s t a l l t h e M S M P I r e d i s t r i b u t a b l e p a c k a g e b e f o r e t r y i n g t o i n s t a l l t h i s p o r t . \ n "
" T h e a p p r o p r i a t e i n s t a l l e r h a s b e e n d o w n l o a d e d t o : \ n "
" $ { R E D I S T _ A R C H I V E } \ 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 } \"")
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}" )
2017-01-11 18:54:00 +08:00
vcpkg_execute_required_process (
2017-08-09 06:00:28 +08:00
C O M M A N D $ { S C R I P T _ F I L E }
2017-01-11 18:54:00 +08:00
W O R K I N G _ D I R E C T O R Y $ { C U R R E N T _ B U I L D T R E E S _ D I R }
L O G N A M E e x t r a c t - s d k
)
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
" $ { S O U R C E _ I N C L U D E _ P A T H } / m p i . h "
" $ { S O U R C E _ I N C L U D E _ P A T H } / m p i f . h "
" $ { S O U R C E _ I N C L U D E _ P A T H } / m p i . f 9 0 "
2017-02-08 18:12:18 +08:00
" $ { S O U R C E _ I N C L U D E _ P A T H } / m p i o . h "
" $ { S O U R C E _ I N C L U D E _ P A T H } / m s p m s . h "
" $ { S O U R C E _ I N C L U D E _ P A T H } / p m i d b g . h "
2017-01-11 18:54:00 +08:00
" $ { S O U R C E _ I N C L U D E _ P A T H } / $ { T R I P L E T _ S Y S T E M _ A R C H } / m p i f p t r . h "
D E S T I N A T I O N
$ { C U R R E N T _ P A C K A G E S _ D I R } / i n c l u d e
)
2017-02-08 18:12:18 +08:00
# Install release libraries
2017-01-11 18:54:00 +08:00
file ( INSTALL
" $ { S O U R C E _ L I B _ P A T H } / $ { T R I P L E T _ S Y S T E M _ A R C H } / m s m p i . l i b "
" $ { S O U R C E _ L I B _ P A T H } / $ { T R I P L E T _ S Y S T E M _ A R C H } / m s m p i f e c . l i b "
" $ { S O U R C E _ L I B _ P A T H } / $ { T R I P L E T _ S Y S T E M _ A R C H } / m s m p i f m c . l i b "
D E S T I N A T I O N
$ { C U R R E N T _ P A C K A G E S _ D I R } / l i b
)
2017-10-12 22:52:48 +08:00
if ( TRIPLET_SYSTEM_ARCH STREQUAL "x86" )
2017-02-08 18:12:18 +08:00
file ( INSTALL
" $ { S O U R C E _ L I B _ P A T H } / $ { T R I P L E T _ S Y S T E M _ A R C H } / m s m p i f e s . l i b "
" $ { S O U R C E _ L I B _ P A T H } / $ { T R I P L E T _ S Y S T E M _ A R C H } / m s m p i f m s . l i b "
D E S T I N A T I O N
$ { C U R R E N T _ P A C K A G E S _ D I R } / l i b
)
endif ( )
2017-01-11 18:54:00 +08:00
# Install debug libraries
# NOTE: since the binary distribution does not include any debug libraries we simply install the release libraries
2017-03-04 11:09:24 +08:00
SET ( VCPKG_POLICY_ONLY_RELEASE_CRT enabled )
2017-01-11 18:54:00 +08:00
file ( INSTALL
" $ { S O U R C E _ L I B _ P A T H } / $ { T R I P L E T _ S Y S T E M _ A R C H } / m s m p i . l i b "
" $ { S O U R C E _ L I B _ P A T H } / $ { T R I P L E T _ S Y S T E M _ A R C H } / m s m p i f e c . l i b "
" $ { S O U R C E _ L I B _ P A T H } / $ { T R I P L E T _ S Y S T E M _ A R C H } / m s m p i f m c . l i b "
D E S T I N A T I O N
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / l i b
)
2017-10-12 22:52:48 +08:00
if ( TRIPLET_SYSTEM_ARCH STREQUAL "x86" )
2017-02-08 18:12:18 +08:00
file ( INSTALL
" $ { S O U R C E _ L I B _ P A T H } / $ { T R I P L E T _ S Y S T E M _ A R C H } / m s m p i f e s . l i b "
" $ { S O U R C E _ L I B _ P A T H } / $ { T R I P L E T _ S Y S T E M _ A R C H } / m s m p i f m s . l i b "
D E S T I N A T I O N
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / l i b
)
endif ( )
2017-01-11 18:54:00 +08:00
# Handle copyright
file ( COPY "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/License/license_sdk.rtf" DESTINATION ${ CURRENT_PACKAGES_DIR } /share/msmpi )
2017-01-19 13:31:42 +08:00
file ( WRITE ${ CURRENT_PACKAGES_DIR } /share/msmpi/copyright "See the accompanying license_sdk.rtf" )