diff options
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/cmake/vcpkg_build_msbuild.cmake | 50 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_configure_cmake.cmake | 8 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_get_windows_sdk.cmake | 3 | ||||
| -rw-r--r-- | scripts/templates/portfile.in.cmake | 14 |
4 files changed, 50 insertions, 25 deletions
diff --git a/scripts/cmake/vcpkg_build_msbuild.cmake b/scripts/cmake/vcpkg_build_msbuild.cmake index f4a809e7f..6fe3f5aa0 100644 --- a/scripts/cmake/vcpkg_build_msbuild.cmake +++ b/scripts/cmake/vcpkg_build_msbuild.cmake @@ -7,7 +7,9 @@ # 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}") +# [PLATFORM_TOOLSET <platform_toolset>] # (default = "${VCPKG_PLATFORM_TOOLSET}") # [OPTIONS arg1 [arg2 ...]] # [OPTIONS_RELEASE arg1 [arg2 ...]] # [OPTIONS_DEBUG arg1 [arg2 ...]] @@ -21,12 +23,16 @@ # ``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. +# ``PLATFORM_TOOLSET`` +# The platform toolset (``/p:PlatformToolset`` msbuild parameter) +# used for the build. # ``OPTIONS`` # The options passed to msbuild for all builds. # ``OPTIONS_RELEASE`` @@ -35,8 +41,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;PLATFORM_TOOLSET;TARGET_PLATFORM_VERSION;TARGET" "OPTIONS;OPTIONS_RELEASE;OPTIONS_DEBUG" ${ARGN}) if(NOT DEFINED _csc_RELEASE_CONFIGURATION) set(_csc_RELEASE_CONFIGURATION Release) @@ -47,16 +54,33 @@ function(vcpkg_build_msbuild) if(NOT DEFINED _csc_PLATFORM) set(_csc_PLATFORM ${TRIPLET_SYSTEM_ARCH}) endif() + if(NOT DEFINED _csc_PLATFORM_TOOLSET) + set(_csc_PLATFORM_TOOLSET ${VCPKG_PLATFORM_TOOLSET}) + 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:PlatformToolset=${_csc_PLATFORM_TOOLSET} + /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 +88,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 ) diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index daf9dfd6f..e3ca3adca 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -19,8 +19,8 @@ function(vcpkg_configure_cmake) set(GENERATOR "Visual Studio 14 2015") elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 Win64") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm") - set(GENERATOR "Visual Studio 14 2015 ARM" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + set(GENERATOR "Visual Studio 14 2015 ARM") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017") @@ -32,8 +32,8 @@ function(vcpkg_configure_cmake) set(GENERATOR "Visual Studio 15 2017") elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017 Win64") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm") - set(GENERATOR "Visual Studio 15 2017 ARM" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017 ARM") endif() # If we use Ninja, make sure it's on PATH diff --git a/scripts/cmake/vcpkg_get_windows_sdk.cmake b/scripts/cmake/vcpkg_get_windows_sdk.cmake index 7a8014eb2..cefe8cfd8 100644 --- a/scripts/cmake/vcpkg_get_windows_sdk.cmake +++ b/scripts/cmake/vcpkg_get_windows_sdk.cmake @@ -1,6 +1,6 @@ function(vcpkg_get_windows_sdk ret) execute_process( - COMMAND powershell.exe -ExecutionPolicy Bypass ${VCPKG_ROOT_DIR}/scripts/getWindowsSDK.ps1 + COMMAND powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& {& '${VCPKG_ROOT_DIR}/scripts/getWindowsSDK.ps1'}" 2>&1 OUTPUT_VARIABLE WINDOWS_SDK RESULT_VARIABLE error_code) @@ -10,6 +10,5 @@ function(vcpkg_get_windows_sdk ret) # Remove trailing newline string(REGEX REPLACE "\n$" "" WINDOWS_SDK "${WINDOWS_SDK}") - set(${ret} ${WINDOWS_SDK} PARENT_SCOPE) endfunction()
\ No newline at end of file diff --git a/scripts/templates/portfile.in.cmake b/scripts/templates/portfile.in.cmake index ef72431ff..2ea430453 100644 --- a/scripts/templates/portfile.in.cmake +++ b/scripts/templates/portfile.in.cmake @@ -1,9 +1,13 @@ # Common Ambient Variables: -# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> -# TARGET_TRIPLET is the current triplet (x86-windows, etc) -# PORT is the current port name (zlib, etc) -# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} -# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# CURRENT_PORT DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} +# PORT = current port name (zlib, etc) +# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) +# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) +# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) +# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> +# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) # include(vcpkg_common_functions) |
