From a24ccdfc01aba83b833af528b8f1a6ec6db020a4 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 19 Oct 2017 17:19:11 -0700 Subject: [vcpkg-build-cmake] Build at IDLE priority. Try to detect out-of-memory issues in the linker, and restart the build once. --- scripts/cmake/vcpkg_build_cmake.cmake | 99 +++++++++++++++++----- scripts/cmake/vcpkg_execute_required_process.cmake | 28 ++++-- 2 files changed, 99 insertions(+), 28 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 0b4bbd211..548e6cf46 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -33,10 +33,13 @@ function(vcpkg_build_cmake) set(_bc_LOGFILE_ROOT "build") endif() + set(PARALLEL_ARG) + set(NO_PARALLEL_ARG) + if(_VCPKG_CMAKE_GENERATOR MATCHES "Ninja") set(BUILD_ARGS "-v") # verbose output if (_bc_DISABLE_PARALLEL) - list(APPEND BUILD_ARGS "-j1") + set(NO_PARALLEL_ARG "-j1") endif() elseif(_VCPKG_CMAKE_GENERATOR MATCHES "Visual Studio") set(BUILD_ARGS @@ -44,7 +47,7 @@ function(vcpkg_build_cmake) "/p:UseIntelMKL=No" ) if (NOT _bc_DISABLE_PARALLEL) - list(APPEND BUILD_ARGS "/m") + set(PARALLEL_ARG "/m") endif() elseif(_VCPKG_CMAKE_GENERATOR MATCHES "NMake") # No options are currently added for nmake builds @@ -58,23 +61,79 @@ function(vcpkg_build_cmake) set(TARGET_PARAM) endif() - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - message(STATUS "Build ${TARGET_TRIPLET}-rel") - vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release ${TARGET_PARAM} -- ${BUILD_ARGS} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel - LOGNAME ${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-rel - ) - message(STATUS "Build ${TARGET_TRIPLET}-rel done") - endif() + foreach(BUILDTYPE "release" "debug") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE) + if(BUILDTYPE STREQUAL "debug") + set(SHORT_BUILDTYPE "dbg") + else() + set(SHORT_BUILDTYPE "rel") + endif() - if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - message(STATUS "Build ${TARGET_TRIPLET}-dbg") - vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Debug ${TARGET_PARAM} -- ${BUILD_ARGS} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg - LOGNAME ${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-dbg - ) - message(STATUS "Build ${TARGET_TRIPLET}-dbg done") - endif() + message(STATUS "Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE}") + set(LOGPREFIX "${CURRENT_BUILDTREES_DIR}/${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-${SHORT_BUILDTYPE}") + set(LOGS) + + if(BUILDTYPE STREQUAL "release") + set(CONFIG "Release") + else() + set(CONFIG "Debug") + endif() + + execute_process( + COMMAND ${CMAKE_COMMAND} --build . --config Release ${TARGET_PARAM} -- ${BUILD_ARGS} ${PARALLEL_ARG} + OUTPUT_FILE "${LOGPREFIX}-out.log" + ERROR_FILE "${LOGPREFIX}-err.log" + RESULT_VARIABLE error_code + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE}) + if(error_code) + file(READ "${LOGPREFIX}-out.log" out_contents) + file(READ "${LOGPREFIX}-err.log" err_contents) + + if(out_contents) + list(APPEND LOGS "${LOGPREFIX}-out.log") + endif() + if(err_contents) + list(APPEND LOGS "${LOGPREFIX}-err.log") + endif() + + if(out_contents MATCHES "LINK : fatal error LNK1102:" OR out_contents MATCHES " fatal error C1060: ") + # The linker ran out of memory during execution. We will try continuing once more, with parallelism disabled. + execute_process( + COMMAND ${CMAKE_COMMAND} --build . --config Release ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG} + OUTPUT_FILE "${LOGPREFIX}-out-1.log" + ERROR_FILE "${LOGPREFIX}-err-1.log" + RESULT_VARIABLE error_code + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE}) + + if(error_code) + file(READ "${LOGPREFIX}-out-1.log" out_contents) + file(READ "${LOGPREFIX}-err-1.log" err_contents) + + if(out_contents) + list(APPEND LOGS "${LOGPREFIX}-out-1.log") + endif() + if(err_contents) + list(APPEND LOGS "${LOGPREFIX}-err-1.log") + endif() + endif() + endif() + + if(error_code) + set(STRINGIFIED_LOGS) + foreach(LOG ${LOGS}) + file(TO_NATIVE_PATH "${LOG}" NATIVE_LOG) + list(APPEND STRINGIFIED_LOGS " ${NATIVE_LOG}\n") + endforeach() + set(_eb_COMMAND ${CMAKE_COMMAND} --build . --config Release ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG}) + set(_eb_WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE}) + message(FATAL_ERROR + " Command failed: ${_eb_COMMAND}\n" + " Working Directory: ${_eb_WORKING_DIRECTORY}\n" + " See logs for more information:\n" + ${STRINGIFIED_LOGS}) + endif() + endif() + message(STATUS "Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} done") + endif() + endforeach() endfunction() diff --git a/scripts/cmake/vcpkg_execute_required_process.cmake b/scripts/cmake/vcpkg_execute_required_process.cmake index 7c4907016..5b8922c14 100644 --- a/scripts/cmake/vcpkg_execute_required_process.cmake +++ b/scripts/cmake/vcpkg_execute_required_process.cmake @@ -30,22 +30,34 @@ ## * [qt5](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5/portfile.cmake) function(vcpkg_execute_required_process) cmake_parse_arguments(vcpkg_execute_required_process "" "WORKING_DIRECTORY;LOGNAME" "COMMAND" ${ARGN}) - #debug_message("vcpkg_execute_required_process(${vcpkg_execute_required_process_COMMAND})") + set(LOG_OUT "${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-out.log") + set(LOG_ERR "${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-err.log") execute_process( COMMAND ${vcpkg_execute_required_process_COMMAND} - OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-out.log - ERROR_FILE ${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-err.log + OUTPUT_FILE ${LOG_OUT} + ERROR_FILE ${LOG_ERR} RESULT_VARIABLE error_code WORKING_DIRECTORY ${vcpkg_execute_required_process_WORKING_DIRECTORY}) - #debug_message("error_code=${error_code}") if(error_code) - file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-out.log" NATIVE_LOG_OUT) - file(TO_NATIVE_PATH "${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-err.log" NATIVE_LOG_ERR) + set(LOGS) + file(READ "${LOG_OUT}" out_contents) + file(READ "${LOG_ERR}" err_contents) + if(out_contents) + list(APPEND LOGS "${LOG_OUT}") + endif() + if(err_contents) + list(APPEND LOGS "${LOG_ERR}") + endif() + set(STRINGIFIED_LOGS) + foreach(LOG ${LOGS}) + file(TO_NATIVE_PATH "${LOG}" NATIVE_LOG) + list(APPEND STRINGIFIED_LOGS " ${NATIVE_LOG}\n") + endforeach() message(FATAL_ERROR " Command failed: ${vcpkg_execute_required_process_COMMAND}\n" " Working Directory: ${vcpkg_execute_required_process_WORKING_DIRECTORY}\n" " See logs for more information:\n" - " ${NATIVE_LOG_OUT}\n" - " ${NATIVE_LOG_ERR}\n") + ${STRINGIFIED_LOGS} + ) endif() endfunction() -- cgit v1.2.3 From be5e529bb3e8483e5675488232d936e7d7d29ceb Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Wed, 3 Jan 2018 10:57:46 +0100 Subject: Update cmake to 3.10.1 --- scripts/fetchDependency.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index f62fe450c..168c2359e 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -20,12 +20,12 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if($Dependency -eq "cmake") { - $requiredVersion = "3.10.0" - $downloadVersion = "3.10.0" - $url = "https://cmake.org/files/v3.10/cmake-3.10.0-win32-x86.zip" - $downloadPath = "$downloadsDir\cmake-3.10.0-win32-x86.zip" - $expectedDownloadedFileHash = "dce666e897f95a88d3eed6cddd1faa3f44179d519b33ca6065b385bbc7072419" - $executableFromDownload = "$downloadsDir\cmake-3.10.0-win32-x86\bin\cmake.exe" + $requiredVersion = "3.10.1" + $downloadVersion = "3.10.1" + $url = "https://cmake.org/files/v3.10/cmake-3.10.1-win32-x86.zip" + $downloadPath = "$downloadsDir\cmake-3.10.1-win32-x86.zip" + $expectedDownloadedFileHash = "6fe010cce1201d884cd7a9535db8a1f16d98b8965341251fde8f1c5069ee58c0" + $executableFromDownload = "$downloadsDir\cmake-3.10.1-win32-x86\bin\cmake.exe" $extractionType = $ExtractionType_ZIP } elseif($Dependency -eq "nuget") -- cgit v1.2.3 From 43aec468a14993044b9d6fd89d124c1371edba64 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Wed, 3 Jan 2018 10:58:59 +0100 Subject: Remove workaround for a bug in FindMPI.cmake that was introduced in cmake 3.10.0 and fixed in 3.10.1 --- scripts/buildsystems/vcpkg.cmake | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index b8d3fbdbb..7ebe695fb 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -207,17 +207,6 @@ macro(find_package name) add_library(tinyxml2 INTERFACE IMPORTED) set_target_properties(tinyxml2 PROPERTIES INTERFACE_LINK_LIBRARIES "tinyxml2_static") endif() - elseif("${name}" STREQUAL "MPI") - if(MPI_C_LIB_NAMES) - set(MPI_C_WORKS TRUE) - set(MPI_C_WRAPPER_FOUND TRUE) - endif() - if(MPI_CXX_LIB_NAMES) - set(MPI_CXX_WORKS TRUE) - set(MPI_CXX_WRAPPER_FOUND TRUE) - set(MPI_CXX_VALIDATE_SKIP_MPICXX TRUE) - endif() - _find_package(${ARGV}) else() _find_package(${ARGV}) endif() -- cgit v1.2.3 From 7f9ca12c4c66a0e4043c5999b098fe9f721f9d1b Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 3 Jan 2018 14:30:30 -0800 Subject: [vcpkg-download-distfile] Fix #2426 --- scripts/cmake/vcpkg_download_distfile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index 24503338a..2055139f5 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -45,7 +45,7 @@ function(vcpkg_download_distfile VAR) if(NOT DEFINED vcpkg_download_distfile_FILENAME) message(FATAL_ERROR "vcpkg_download_distfile requires a FILENAME argument.") endif() - if(NOT DEFINED vcpkg_download_distfile_SHA512) + if(NOT _VCPKG_INTERNAL_NO_HASH_CHECK AND NOT DEFINED vcpkg_download_distfile_SHA512) message(FATAL_ERROR "vcpkg_download_distfile requires a SHA512 argument.") endif() -- cgit v1.2.3 From a28138eb9ef8d2986227b7cd784be9ffa8492a46 Mon Sep 17 00:00:00 2001 From: Jacek Blaszczynski Date: Thu, 4 Jan 2018 00:19:52 +0100 Subject: Add preliminary support for arm-windows and arm64-windows triplets (#2371) * Add preliminary support for arm-windows and arm64-windows triplets Visual Studio 15.4 shipped with new VC tools targeting arm and arm64 for desktop. This change allows for recognition and usage of new triplets supporting arm and arm64 Windows desktop and server targets. * Remove unnecessary changes * Part 2 * Part 3 * Make detection of Arm64 _VCPKG_TARGET_ARCHITECTURE precise * Enforce usage of Visual Studio CMake generatorfor arm and temporarily arm64 targets * Address code review feedback, clean libjpeg-turbo port.cmake * [libjpeg-turbo][tiff] Reduce changes to existing libraries. * [vcpkg-cmake] Simplify toolchain selection logic and improve comments --- scripts/buildsystems/msbuild/vcpkg.targets | 15 ++++++++++++ scripts/buildsystems/vcpkg.cmake | 5 ++++ scripts/cmake/vcpkg_configure_cmake.cmake | 37 +++++++++++++++--------------- 3 files changed, 38 insertions(+), 19 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets index 092e013b5..499052e4d 100644 --- a/scripts/buildsystems/msbuild/vcpkg.targets +++ b/scripts/buildsystems/msbuild/vcpkg.targets @@ -24,6 +24,16 @@ x64-windows + + true + arm-windows + + + + true + arm64-windows + + true x64-uwp @@ -34,6 +44,11 @@ arm-uwp + + true + arm64-uwp + + $(Configuration) Debug diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 7ebe695fb..f157d3236 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -22,6 +22,8 @@ elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$") set(_VCPKG_TARGET_TRIPLET_ARCH x64) elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$") set(_VCPKG_TARGET_TRIPLET_ARCH arm) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm64) else() if(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 Win64$") set(_VCPKG_TARGET_TRIPLET_ARCH x64) @@ -41,6 +43,8 @@ else() set(_VCPKG_TARGET_TRIPLET_ARCH x64) elseif(_VCPKG_CL MATCHES "arm/cl.exe$") set(_VCPKG_TARGET_TRIPLET_ARCH arm) + elseif(_VCPKG_CL MATCHES "arm64/cl.exe$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm64) elseif(_VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") @@ -105,6 +109,7 @@ if (NOT DEFINED CMAKE_SYSTEM_VERSION AND _VCPKG_TARGET_TRIPLET_PLAT MATCHES "win vcpkg_get_windows_sdk(WINDOWS_SDK_VERSION) unset(VCPKG_ROOT_DIR) set(CMAKE_SYSTEM_VERSION ${WINDOWS_SDK_VERSION} CACHE STRING "Windows SDK version") + message(STATUS "Found Windows SDK ${WINDOWS_SDK_VERSION}") endif() file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 4bcf3d2c9..6e2ec4ef5 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -57,40 +57,39 @@ function(vcpkg_configure_cmake) set(_csc_HOST_ARCHITECTURE $ENV{PROCESSOR_ARCHITECTURE}) endif() + set(NINJA_CAN_BE_USED ON) + if(_csc_HOST_ARCHITECTURE STREQUAL "x86") + # Prebuilt ninja binaries are only provided for x64 hosts + set(NINJA_CAN_BE_USED OFF) + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + # Ninja and MSBuild have many differences when targetting UWP, so use MSBuild to maximize existing compatibility + set(NINJA_CAN_BE_USED OFF) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + # Arm64 usage should be allowed once github issue #2375 is resolved + set(NINJA_CAN_BE_USED OFF) + endif() + if(_csc_GENERATOR) set(GENERATOR ${_csc_GENERATOR}) - elseif(_csc_PREFER_NINJA AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT _csc_HOST_ARCHITECTURE STREQUAL "x86") + elseif(_csc_PREFER_NINJA AND NINJA_CAN_BE_USED) + set(GENERATOR "Ninja") + elseif(VCPKG_CHAINLOAD_TOOLCHAIN_FILE) set(GENERATOR "Ninja") + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") set(GENERATOR "Visual Studio 12 2013") elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") set(GENERATOR "Visual Studio 12 2013 Win64") elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v120") set(GENERATOR "Visual Studio 12 2013 ARM") - elseif(VCPKG_CHAINLOAD_TOOLCHAIN_FILE) - set(GENERATOR "Ninja") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") - set(GENERATOR "Visual Studio 14 2015") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") - set(GENERATOR "Visual Studio 14 2015 Win64") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") - set(GENERATOR "Visual Studio 14 2015 ARM") + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 Win64") - elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 ARM") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") - set(GENERATOR "Visual Studio 15 2017") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") - set(GENERATOR "Visual Studio 15 2017 Win64") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") - set(GENERATOR "Visual Studio 15 2017 ARM") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") - set(GENERATOR "Visual Studio 15 2017") - set(ARCH "ARM64") elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017") elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") -- cgit v1.2.3 From 0cf5bd657ef401319fa3ef60846189546a5c7a87 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 3 Jan 2018 20:11:35 -0800 Subject: [vcpkg-fixup-cmake-targets] Add TARGET_PATH option --- scripts/cmake/vcpkg_build_cmake.cmake | 12 ++++++------ scripts/cmake/vcpkg_fixup_cmake_targets.cmake | 14 +++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 548e6cf46..66503f4b8 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -38,17 +38,13 @@ function(vcpkg_build_cmake) if(_VCPKG_CMAKE_GENERATOR MATCHES "Ninja") set(BUILD_ARGS "-v") # verbose output - if (_bc_DISABLE_PARALLEL) - set(NO_PARALLEL_ARG "-j1") - endif() + set(NO_PARALLEL_ARG "-j1") elseif(_VCPKG_CMAKE_GENERATOR MATCHES "Visual Studio") set(BUILD_ARGS "/p:VCPkgLocalAppDataDisabled=true" "/p:UseIntelMKL=No" ) - if (NOT _bc_DISABLE_PARALLEL) - set(PARALLEL_ARG "/m") - endif() + set(PARALLEL_ARG "/m") elseif(_VCPKG_CMAKE_GENERATOR MATCHES "NMake") # No options are currently added for nmake builds else() @@ -61,6 +57,10 @@ function(vcpkg_build_cmake) set(TARGET_PARAM) endif() + if(_bc_DISABLE_PARALLEL) + set(PARALLEL_ARG ${NO_PARALLEL_ARG}) + endif() + foreach(BUILDTYPE "release" "debug") if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE) if(BUILDTYPE STREQUAL "debug") diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index f86ad0661..fead64d15 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -14,14 +14,18 @@ # function(vcpkg_fixup_cmake_targets) - cmake_parse_arguments(_vfct "" "CONFIG_PATH" "" ${ARGN}) + cmake_parse_arguments(_vfct "" "CONFIG_PATH;TARGET_PATH" "" ${ARGN}) if(_vfct_UNPARSED_ARGUMENTS) message(FATAL_ERROR "vcpkg_fixup_cmake_targets was passed extra arguments: ${_vfct_UNPARSED_ARGUMENTS}") endif() - set(DEBUG_SHARE ${CURRENT_PACKAGES_DIR}/debug/share/${PORT}) - set(RELEASE_SHARE ${CURRENT_PACKAGES_DIR}/share/${PORT}) + if(NOT _vfct_TARGET_PATH) + set(_vfct_TARGET_PATH share/${PORT}) + endif() + + set(DEBUG_SHARE ${CURRENT_PACKAGES_DIR}/debug/${_vfct_TARGET_PATH}) + set(RELEASE_SHARE ${CURRENT_PACKAGES_DIR}/${_vfct_TARGET_PATH}) if(_vfct_CONFIG_PATH AND NOT RELEASE_SHARE STREQUAL "${CURRENT_PACKAGES_DIR}/${_vfct_CONFIG_PATH}") set(DEBUG_CONFIG ${CURRENT_PACKAGES_DIR}/debug/${_vfct_CONFIG_PATH}) @@ -114,7 +118,7 @@ function(vcpkg_fixup_cmake_targets) string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+\\.exe)" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}") string(REPLACE "\${_IMPORT_PREFIX}/lib" "\${_IMPORT_PREFIX}/debug/lib" _contents "${_contents}") string(REPLACE "\${_IMPORT_PREFIX}/bin" "\${_IMPORT_PREFIX}/debug/bin" _contents "${_contents}") - file(WRITE ${CURRENT_PACKAGES_DIR}/share/${PORT}/${DEBUG_TARGET_NAME} "${_contents}") + file(WRITE ${CURRENT_PACKAGES_DIR}/${_vfct_TARGET_PATH}/${DEBUG_TARGET_NAME} "${_contents}") file(REMOVE ${DEBUG_TARGET}) endforeach() @@ -148,7 +152,7 @@ function(vcpkg_fixup_cmake_targets) file(WRITE ${MAIN_CONFIG} "${_contents}") endforeach() - # Remove /debug/share// if it's empty. + # Remove /debug// if it's empty. file(GLOB_RECURSE REMAINING_FILES "${DEBUG_SHARE}/*") if(NOT REMAINING_FILES) file(REMOVE_RECURSE ${DEBUG_SHARE}) -- cgit v1.2.3 From 42c0cfc8705c71c3c9dcc4df4804ab342dc89988 Mon Sep 17 00:00:00 2001 From: Mikhail Paulyshka Date: Sat, 30 Dec 2017 01:21:18 +0300 Subject: [vcpkg] fix --head flag for github-based ports --- scripts/cmake/vcpkg_download_distfile.cmake | 16 ++++++++++++---- scripts/cmake/vcpkg_from_github.cmake | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index 2055139f5..2c20cc1b8 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -26,6 +26,9 @@ ## ## If this doesn't match the downloaded version, the build will be terminated with a message describing the mismatch. ## +## ### SKIP_SHA512 +## Skip SHA512 hash check for file. +## ## ## Notes ## The command [`vcpkg_from_github`](vcpkg_from_github.md) should be used instead of this for downloading the main archive for GitHub projects. ## @@ -35,9 +38,10 @@ ## * [fontconfig](https://github.com/Microsoft/vcpkg/blob/master/ports/fontconfig/portfile.cmake) ## * [openssl](https://github.com/Microsoft/vcpkg/blob/master/ports/openssl/portfile.cmake) function(vcpkg_download_distfile VAR) + set(options SKIP_SHA512) set(oneValueArgs FILENAME SHA512) set(multipleValuesArgs URLS) - cmake_parse_arguments(vcpkg_download_distfile "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN}) + cmake_parse_arguments(vcpkg_download_distfile "${options}" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN}) if(NOT DEFINED vcpkg_download_distfile_URLS) message(FATAL_ERROR "vcpkg_download_distfile requires a URLS argument.") @@ -45,7 +49,7 @@ function(vcpkg_download_distfile VAR) if(NOT DEFINED vcpkg_download_distfile_FILENAME) message(FATAL_ERROR "vcpkg_download_distfile requires a FILENAME argument.") endif() - if(NOT _VCPKG_INTERNAL_NO_HASH_CHECK AND NOT DEFINED vcpkg_download_distfile_SHA512) + if(NOT DEFINED vcpkg_download_distfile_SKIP_SHA512 AND NOT _VCPKG_INTERNAL_NO_HASH_CHECK AND NOT DEFINED vcpkg_download_distfile_SHA512) message(FATAL_ERROR "vcpkg_download_distfile requires a SHA512 argument.") endif() @@ -75,7 +79,9 @@ function(vcpkg_download_distfile VAR) if(EXISTS ${downloaded_file_path}) message(STATUS "Using cached ${downloaded_file_path}") - test_hash("cached file" "Please delete the file and retry if this file should be downloaded again.") + if(NOT DEFINED vcpkg_download_distfile_SKIP_SHA512) + test_hash("cached file" "Please delete the file and retry if this file should be downloaded again.") + endif() else() if(_VCPKG_NO_DOWNLOADS) message(FATAL_ERROR "Downloads are disabled, but '${downloaded_file_path}' does not exist.") @@ -103,7 +109,9 @@ function(vcpkg_download_distfile VAR) " Failed to download file.\n" " Add mirrors or submit an issue at https://github.com/Microsoft/vcpkg/issues\n") else() - test_hash("downloaded file" "The file may be corrupted.") + if(NOT DEFINED vcpkg_download_distfile_SKIP_SHA512) + test_hash("downloaded file" "The file may be corrupted.") + endif() endif() endif() set(${VAR} ${downloaded_file_path} PARENT_SCOPE) diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake index b71ab3838..545be3b4d 100644 --- a/scripts/cmake/vcpkg_from_github.cmake +++ b/scripts/cmake/vcpkg_from_github.cmake @@ -141,11 +141,13 @@ function(vcpkg_from_github) vcpkg_download_distfile(ARCHIVE_VERSION URLS "https://api.github.com/repos/${ORG_NAME}/${REPO_NAME}/git/refs/heads/${_vdud_HEAD_REF}" FILENAME ${downloaded_file_name}.version + SKIP_SHA512 ) vcpkg_download_distfile(ARCHIVE URLS ${URL} FILENAME ${downloaded_file_name} + SKIP_SHA512 ) set(_VCPKG_INTERNAL_NO_HASH_CHECK "FALSE") endif() -- cgit v1.2.3 From 2b30280c222a6970fa74d05b6f7e106b4776318a Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 5 Jan 2018 16:16:08 -0800 Subject: [vcpkg-download-distfile] Regenerate docs and enable SKIP_SHA512 only in unstable (head) mode --- scripts/cmake/vcpkg_download_distfile.cmake | 33 +++++++++++++++++++---------- scripts/cmake/vcpkg_from_github.cmake | 7 +++--- 2 files changed, 26 insertions(+), 14 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index 2c20cc1b8..7a1c95461 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -2,6 +2,8 @@ ## ## Download and cache a file needed for this port. ## +## This helper should always be used instead of CMake's built-in `file(DOWNLOAD)` command. +## ## ## Usage ## ```cmake ## vcpkg_download_distfile( @@ -29,12 +31,14 @@ ## ### SKIP_SHA512 ## Skip SHA512 hash check for file. ## +## This switch is only valid when building with the `--head` command line flag. +## ## ## Notes -## The command [`vcpkg_from_github`](vcpkg_from_github.md) should be used instead of this for downloading the main archive for GitHub projects. +## The helper [`vcpkg_from_github`](vcpkg_from_github.md) should be used for downloading from GitHub projects. ## ## ## Examples ## -## * [boost](https://github.com/Microsoft/vcpkg/blob/master/ports/boost/portfile.cmake) +## * [apr](https://github.com/Microsoft/vcpkg/blob/master/ports/apr/portfile.cmake) ## * [fontconfig](https://github.com/Microsoft/vcpkg/blob/master/ports/fontconfig/portfile.cmake) ## * [openssl](https://github.com/Microsoft/vcpkg/blob/master/ports/openssl/portfile.cmake) function(vcpkg_download_distfile VAR) @@ -49,8 +53,14 @@ function(vcpkg_download_distfile VAR) if(NOT DEFINED vcpkg_download_distfile_FILENAME) message(FATAL_ERROR "vcpkg_download_distfile requires a FILENAME argument.") endif() - if(NOT DEFINED vcpkg_download_distfile_SKIP_SHA512 AND NOT _VCPKG_INTERNAL_NO_HASH_CHECK AND NOT DEFINED vcpkg_download_distfile_SHA512) - message(FATAL_ERROR "vcpkg_download_distfile requires a SHA512 argument.") + if(vcpkg_download_distfile_SKIP_SHA512 AND NOT VCPKG_USE_HEAD_VERSION) + message(FATAL_ERROR "vcpkg_download_distfile only allows SKIP_SHA512 when building with --head") + endif() + if(NOT vcpkg_download_distfile_SKIP_SHA512 AND NOT DEFINED vcpkg_download_distfile_SHA512) + message(FATAL_ERROR "vcpkg_download_distfile requires a SHA512 argument. If you do not know the SHA512, add it as 'SHA512 0' and re-run this command.") + endif() + if(vcpkg_download_distfile_SKIP_SHA512 AND DEFINED vcpkg_download_distfile_SHA512) + message(FATAL_ERROR "vcpkg_download_distfile must not be passed both SHA512 and SKIP_SHA512.") endif() set(downloaded_file_path ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME}) @@ -60,7 +70,12 @@ function(vcpkg_download_distfile VAR) file(MAKE_DIRECTORY "${DOWNLOADS}/temp") function(test_hash FILE_KIND CUSTOM_ERROR_ADVICE) - if (_VCPKG_INTERNAL_NO_HASH_CHECK) + if(_VCPKG_INTERNAL_NO_HASH_CHECK) + # When using the internal hash skip, do not output an explicit message. + return() + endif() + if(vcpkg_download_distfile_SKIP_SHA512) + message(STATUS "Skipping hash check for ${downloaded_file_path}.") return() endif() @@ -79,9 +94,7 @@ function(vcpkg_download_distfile VAR) if(EXISTS ${downloaded_file_path}) message(STATUS "Using cached ${downloaded_file_path}") - if(NOT DEFINED vcpkg_download_distfile_SKIP_SHA512) - test_hash("cached file" "Please delete the file and retry if this file should be downloaded again.") - endif() + test_hash("cached file" "Please delete the file and retry if this file should be downloaded again.") else() if(_VCPKG_NO_DOWNLOADS) message(FATAL_ERROR "Downloads are disabled, but '${downloaded_file_path}' does not exist.") @@ -109,9 +122,7 @@ function(vcpkg_download_distfile VAR) " Failed to download file.\n" " Add mirrors or submit an issue at https://github.com/Microsoft/vcpkg/issues\n") else() - if(NOT DEFINED vcpkg_download_distfile_SKIP_SHA512) - test_hash("downloaded file" "The file may be corrupted.") - endif() + test_hash("downloaded file" "The file may have been corrupted in transit.") endif() endif() set(${VAR} ${downloaded_file_path} PARENT_SCOPE) diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake index 545be3b4d..c6a23cff6 100644 --- a/scripts/cmake/vcpkg_from_github.cmake +++ b/scripts/cmake/vcpkg_from_github.cmake @@ -137,7 +137,6 @@ function(vcpkg_from_github) endif() # Try to download the file and version information from github. - set(_VCPKG_INTERNAL_NO_HASH_CHECK "TRUE") vcpkg_download_distfile(ARCHIVE_VERSION URLS "https://api.github.com/repos/${ORG_NAME}/${REPO_NAME}/git/refs/heads/${_vdud_HEAD_REF}" FILENAME ${downloaded_file_name}.version @@ -149,7 +148,6 @@ function(vcpkg_from_github) FILENAME ${downloaded_file_name} SKIP_SHA512 ) - set(_VCPKG_INTERNAL_NO_HASH_CHECK "FALSE") endif() vcpkg_extract_source_archive_ex( @@ -164,7 +162,10 @@ function(vcpkg_from_github) string(REGEX REPLACE "\"sha\": \"([a-f0-9]+)\"" "\\1" _version ${x}) # exports VCPKG_HEAD_VERSION to the caller. This will get picked up by ports.cmake after the build. - set(VCPKG_HEAD_VERSION ${_version} PARENT_SCOPE) + # When multiple vcpkg_from_github's are used after each other, only use the version from the first (hopefully the primary one). + if(NOT DEFINED VCPKG_HEAD_VERSION) + set(VCPKG_HEAD_VERSION ${_version} PARENT_SCOPE) + endif() set_SOURCE_PATH(${CURRENT_BUILDTREES_DIR}/src/head ${SANITIZED_HEAD_REF}) endfunction() -- cgit v1.2.3 From bc70053ab7764d3d59c428c507aa25ccea773458 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Sat, 6 Jan 2018 18:54:59 +0100 Subject: use proper symbol to build correct configuration --- scripts/cmake/vcpkg_build_cmake.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 66503f4b8..8bafee4d4 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -80,7 +80,7 @@ function(vcpkg_build_cmake) endif() execute_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release ${TARGET_PARAM} -- ${BUILD_ARGS} ${PARALLEL_ARG} + COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${PARALLEL_ARG} OUTPUT_FILE "${LOGPREFIX}-out.log" ERROR_FILE "${LOGPREFIX}-err.log" RESULT_VARIABLE error_code @@ -99,7 +99,7 @@ function(vcpkg_build_cmake) if(out_contents MATCHES "LINK : fatal error LNK1102:" OR out_contents MATCHES " fatal error C1060: ") # The linker ran out of memory during execution. We will try continuing once more, with parallelism disabled. execute_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG} + COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG} OUTPUT_FILE "${LOGPREFIX}-out-1.log" ERROR_FILE "${LOGPREFIX}-err-1.log" RESULT_VARIABLE error_code @@ -124,7 +124,7 @@ function(vcpkg_build_cmake) file(TO_NATIVE_PATH "${LOG}" NATIVE_LOG) list(APPEND STRINGIFIED_LOGS " ${NATIVE_LOG}\n") endforeach() - set(_eb_COMMAND ${CMAKE_COMMAND} --build . --config Release ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG}) + set(_eb_COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG}) set(_eb_WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE}) message(FATAL_ERROR " Command failed: ${_eb_COMMAND}\n" -- cgit v1.2.3 From 3b3bff1824c09a9c3accc9e737af96e4f89228fd Mon Sep 17 00:00:00 2001 From: Cdec Date: Sun, 14 Jan 2018 12:49:04 +0900 Subject: [vcpkg_download_distfile] Change to refer _VCPKG_INTERNAL_NO_HASH_CHECK in parameter check --- scripts/cmake/vcpkg_download_distfile.cmake | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index 7a1c95461..28276f47c 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -53,14 +53,16 @@ function(vcpkg_download_distfile VAR) if(NOT DEFINED vcpkg_download_distfile_FILENAME) message(FATAL_ERROR "vcpkg_download_distfile requires a FILENAME argument.") endif() - if(vcpkg_download_distfile_SKIP_SHA512 AND NOT VCPKG_USE_HEAD_VERSION) - message(FATAL_ERROR "vcpkg_download_distfile only allows SKIP_SHA512 when building with --head") - endif() - if(NOT vcpkg_download_distfile_SKIP_SHA512 AND NOT DEFINED vcpkg_download_distfile_SHA512) - message(FATAL_ERROR "vcpkg_download_distfile requires a SHA512 argument. If you do not know the SHA512, add it as 'SHA512 0' and re-run this command.") - endif() - if(vcpkg_download_distfile_SKIP_SHA512 AND DEFINED vcpkg_download_distfile_SHA512) - message(FATAL_ERROR "vcpkg_download_distfile must not be passed both SHA512 and SKIP_SHA512.") + if(NOT _VCPKG_INTERNAL_NO_HASH_CHECK) + if(vcpkg_download_distfile_SKIP_SHA512 AND NOT VCPKG_USE_HEAD_VERSION) + message(FATAL_ERROR "vcpkg_download_distfile only allows SKIP_SHA512 when building with --head") + endif() + if(NOT vcpkg_download_distfile_SKIP_SHA512 AND NOT DEFINED vcpkg_download_distfile_SHA512) + message(FATAL_ERROR "vcpkg_download_distfile requires a SHA512 argument. If you do not know the SHA512, add it as 'SHA512 0' and re-run this command.") + endif() + if(vcpkg_download_distfile_SKIP_SHA512 AND DEFINED vcpkg_download_distfile_SHA512) + message(FATAL_ERROR "vcpkg_download_distfile must not be passed both SHA512 and SKIP_SHA512.") + endif() endif() set(downloaded_file_path ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME}) -- cgit v1.2.3