Merge pull request #775 from Mixaill/msvs2017-mpir-winsdk

[mpir] detect Windows SDK version (was: retarget MSVS2017 to Windows 10 SDK)
This commit is contained in:
Robert Schumacher 2017-03-13 14:15:56 -07:00 committed by GitHub
commit e387f314a8
3 changed files with 33 additions and 21 deletions

View File

@ -1,3 +1,3 @@
Source: mpir
Version: 3.0.0-1
Version: 3.0.0-2
Description: Multiple Precision Integers and Rationals.

View File

@ -11,7 +11,7 @@ vcpkg_download_distfile(ARCHIVE_FILE
)
vcpkg_extract_source_archive(${ARCHIVE_FILE})
if(VCPKG_PLATFORM_TOOLSET MATCHES "v141*")
if(VCPKG_PLATFORM_TOOLSET MATCHES "v141")
set(MSVC_VERSION 15)
else()
set(MSVC_VERSION 14)
@ -27,10 +27,10 @@ else()
)
endif()
IF (TRIPLET_SYSTEM_ARCH MATCHES "x86")
IF (VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
SET(BUILD_ARCH "Win32")
ELSE()
SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
SET(BUILD_ARCH ${VCPKG_TARGET_ARCHITECTURE})
ENDIF()
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
@ -43,12 +43,10 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
)
file(INSTALL
${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.dll
${SOURCE_PATH}/dll/${BUILD_ARCH}/Debug/mpir.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
)
file(INSTALL
${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.dll
${SOURCE_PATH}/dll/${BUILD_ARCH}/Release/mpir.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/bin
)
file(INSTALL
@ -77,7 +75,7 @@ else()
${SOURCE_PATH}/lib/${BUILD_ARCH}/Release/mpir.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpir RENAME copyright)
file(INSTALL ${SOURCE_PATH}/COPYING.lib DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpir RENAME copyright)
endif()
message(STATUS "Installing done")

View File

@ -7,6 +7,7 @@
# vcpkg_build_msbuild(PROJECT_PATH <sln_project_path>
# [RELEASE_CONFIGURATION <release_configuration>] # (default = "Release")
# [DEBUG_CONFIGURATION <debug_configuration>] @ (default = "Debug")
# [TARGET_PLATFORM_VERSION <windows_target_platform_version>]
# [PLATFORM <platform>] # (default = "${TRIPLET_SYSTEM_ARCH}")
# [OPTIONS arg1 [arg2 ...]]
# [OPTIONS_RELEASE arg1 [arg2 ...]]
@ -21,9 +22,10 @@
# ``DEBUG_CONFIGURATION``
# The configuration (``/p:Configuration`` msbuild parameter)
# used for Debug builds.
# ``DEBUG_CONFIGURATION``
# The configuration (``/p:Configuration`` msbuild parameter)
# used for Debug builds.
# ``TARGET_PLATFORM_VERSION``
# The WindowsTargetPlatformVersion (``/p:WindowsTargetPlatformVersion`` msbuild parameter)
# ``TARGET``
# The MSBuild target to build. (``/t:<TARGET>``)
# ``PLATFORM``
# The platform (``/p:Platform`` msbuild parameter)
# used for the build.
@ -35,8 +37,9 @@
# The options passed to msbuild for Debug builds.
#
function(vcpkg_build_msbuild)
cmake_parse_arguments(_csc "" "PROJECT_PATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION;PLATFORM" "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG" ${ARGN})
cmake_parse_arguments(_csc "" "PROJECT_PATH;RELEASE_CONFIGURATION;DEBUG_CONFIGURATION;PLATFORM;TARGET_PLATFORM_VERSION;TARGET" "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG" ${ARGN})
if(NOT DEFINED _csc_RELEASE_CONFIGURATION)
set(_csc_RELEASE_CONFIGURATION Release)
@ -47,16 +50,29 @@ function(vcpkg_build_msbuild)
if(NOT DEFINED _csc_PLATFORM)
set(_csc_PLATFORM ${TRIPLET_SYSTEM_ARCH})
endif()
if(NOT DEFINED _csc_TARGET_PLATFORM_VERSION)
vcpkg_get_windows_sdk(_csc_TARGET_PLATFORM_VERSION)
endif()
if(NOT DEFINED _csc_TARGET)
set(_csc_TARGET Rebuild)
endif()
list(APPEND _csc_OPTIONS
/t:${_csc_TARGET}
/p:Platform=${_csc_PLATFORM}
/p:VCPkgLocalAppDataDisabled=true
/p:UseIntelMKL=No
/p:WindowsTargetPlatformVersion=${_csc_TARGET_PLATFORM_VERSION}
/m
)
message(STATUS "Building ${_csc_PROJECT_PATH} for Release")
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)
vcpkg_execute_required_process(
COMMAND msbuild ${_csc_PROJECT_PATH} ${_csc_OPTIONS} ${_csc_OPTIONS_RELEASE}
COMMAND msbuild ${_csc_PROJECT_PATH}
/p:Configuration=${_csc_RELEASE_CONFIGURATION}
/p:Platform=${_csc_PLATFORM}
/p:VCPkgLocalAppDataDisabled=true
/p:UseIntelMKL=No
/m
${_csc_OPTIONS}
${_csc_OPTIONS_RELEASE}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME build-${TARGET_TRIPLET}-rel
)
@ -64,12 +80,10 @@ function(vcpkg_build_msbuild)
message(STATUS "Building ${_csc_PROJECT_PATH} for Debug")
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
vcpkg_execute_required_process(
COMMAND msbuild ${_csc_PROJECT_PATH} ${_csc_OPTIONS} ${_csc_OPTIONS_DEBUG}
COMMAND msbuild ${_csc_PROJECT_PATH}
/p:Configuration=${_csc_DEBUG_CONFIGURATION}
/p:Platform=${_csc_PLATFORM}
/p:VCPkgLocalAppDataDisabled=true
/p:UseIntelMKL=No
/m
${_csc_OPTIONS}
${_csc_OPTIONS_DEBUG}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME build-${TARGET_TRIPLET}-dbg
)