From b7d6160b80f417137bc480137b946c91f3272bf5 Mon Sep 17 00:00:00 2001 From: Curtis J Bezault Date: Wed, 12 Jun 2019 14:18:43 -0700 Subject: [icu] Enable parallel builds (#6695) * Add VCPKG_NUM_LOGICAL_CORES * break out logic that retries running a command several times into its own function * Parallelize icu --- scripts/cmake/vcpkg_build_cmake.cmake | 133 +++-------------------- scripts/cmake/vcpkg_common_functions.cmake | 1 + scripts/cmake/vcpkg_execute_build_process.cmake | 138 ++++++++++++++++++++++++ 3 files changed, 153 insertions(+), 119 deletions(-) create mode 100644 scripts/cmake/vcpkg_execute_build_process.cmake (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 3db6597b4..b110d2cc9 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -60,10 +60,6 @@ function(vcpkg_build_cmake) set(TARGET_PARAM) endif() - if(_bc_DISABLE_PARALLEL) - set(PARALLEL_ARG ${NO_PARALLEL_ARG}) - endif() - foreach(BUILDTYPE "debug" "release") if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL BUILDTYPE) if(BUILDTYPE STREQUAL "debug") @@ -75,8 +71,6 @@ function(vcpkg_build_cmake) endif() message(STATUS "Building ${TARGET_TRIPLET}-${SHORT_BUILDTYPE}") - set(LOGPREFIX "${CURRENT_BUILDTREES_DIR}/${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-${SHORT_BUILDTYPE}") - set(LOGS) if(_bc_ADD_BIN_TO_PATH) set(_BACKUP_ENV_PATH "$ENV{PATH}") @@ -91,121 +85,22 @@ function(vcpkg_build_cmake) set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin${_PATHSEP}$ENV{PATH}") endif() endif() - execute_process( - 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 - 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. - message(STATUS "Restarting Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} without parallelism because memory exceeded") - execute_process( - 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 - 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() - elseif(out_contents MATCHES ": No such file or directory") - # WSL workaround - WSL occassionally fails with no such file or directory. Detect if we are running in WSL and restart. - execute_process(COMMAND "uname" "-r" - OUTPUT_VARIABLE UNAME_R ERROR_VARIABLE UNAME_R - OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) - - if (UNAME_R MATCHES "Microsoft") - set(ITERATION 0) - while (ITERATION LESS 10 AND out_contents MATCHES ": No such file or directory") - MATH(EXPR ITERATION "${ITERATION}+1") - message(STATUS "Restarting Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} because of wsl subsystem issue. Iteration: ${ITERATION}") - execute_process( - COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} - OUTPUT_FILE "${LOGPREFIX}-out-${ITERATION}.log" - ERROR_FILE "${LOGPREFIX}-err-${ITERATION}.log" - RESULT_VARIABLE error_code - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE}) - if(error_code) - file(READ "${LOGPREFIX}-out-${ITERATION}.log" out_contents) - file(READ "${LOGPREFIX}-err-${ITERATION}.log" err_contents) - - if(out_contents) - list(APPEND LOGS "${LOGPREFIX}-out-${ITERATION}.log") - endif() - if(err_contents) - list(APPEND LOGS "${LOGPREFIX}-err-${ITERATION}.log") - endif() - else() - break() - endif() - endwhile() - endif() - elseif(out_contents MATCHES "mt : general error c101008d: " OR out_contents MATCHES "mt.exe : general error c101008d: ") - # Antivirus workaround - occasionally files are locked and cause mt.exe to fail - set(ITERATION 0) - while (ITERATION LESS 3 AND (out_contents MATCHES "mt : general error c101008d: " OR out_contents MATCHES "mt.exe : general error c101008d: ")) - MATH(EXPR ITERATION "${ITERATION}+1") - message(STATUS "Restarting Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} because of mt.exe file locking issue. Iteration: ${ITERATION}") - execute_process( - COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${PARALLEL_ARG} - OUTPUT_FILE "${LOGPREFIX}-out-${ITERATION}.log" - ERROR_FILE "${LOGPREFIX}-err-${ITERATION}.log" - RESULT_VARIABLE error_code - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE}) - - if(error_code) - file(READ "${LOGPREFIX}-out-${ITERATION}.log" out_contents) - file(READ "${LOGPREFIX}-err-${ITERATION}.log" err_contents) - - if(out_contents) - list(APPEND LOGS "${LOGPREFIX}-out-${ITERATION}.log") - endif() - if(err_contents) - list(APPEND LOGS "${LOGPREFIX}-err-${ITERATION}.log") - endif() - else() - break() - endif() - endwhile() - 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 ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${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() + if (_bc_DISABLE_PARALLEL) + vcpkg_execute_build_process( + COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE} + LOGNAME "${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-${SHORT_BUILDTYPE}" + ) + else() + vcpkg_execute_build_process( + COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${PARALLEL_ARG} + NO_PARALLEL_COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE} + LOGNAME "${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-${SHORT_BUILDTYPE}" + ) endif() + if(_bc_ADD_BIN_TO_PATH) set(ENV{PATH} "${_BACKUP_ENV_PATH}") endif() diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index d66fc5eff..b99f8bee8 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -7,6 +7,7 @@ include(vcpkg_extract_source_archive) include(vcpkg_extract_source_archive_ex) include(vcpkg_execute_required_process) include(vcpkg_execute_required_process_repeat) +include(vcpkg_execute_build_process) include(vcpkg_find_acquire_program) include(vcpkg_fixup_cmake_targets) include(vcpkg_from_github) diff --git a/scripts/cmake/vcpkg_execute_build_process.cmake b/scripts/cmake/vcpkg_execute_build_process.cmake new file mode 100644 index 000000000..f02aa296d --- /dev/null +++ b/scripts/cmake/vcpkg_execute_build_process.cmake @@ -0,0 +1,138 @@ +## # vcpkg_execute_build_process +## +## Execute a required build process +## +## ## Usage +## ```cmake +## vcpkg_execute_build_process( +## COMMAND [...] +## [NO_PARALLEL_COMMAND [...]] +## WORKING_DIRECTORY +## LOGNAME ) +## ) +## ``` +## ## Parameters +## ### COMMAND +## The command to be executed, along with its arguments. +## +## ### NO_PARALLEL_COMMAND +## Optional parameter which specifies a non-parallel command to attempt if a +## failure potentially due to parallelism is detected. +## +## ### WORKING_DIRECTORY +## The directory to execute the command in. +## +## ### LOGNAME +## The prefix to use for the log files. +## +## This should be a unique name for different triplets so that the logs don't +## conflict when building multiple at once. +## +## ## Examples +## +## * [icu](https://github.com/Microsoft/vcpkg/blob/master/ports/icu/portfile.cmake) +function(vcpkg_execute_build_process) + cmake_parse_arguments(_ebp "" "WORKING_DIRECTORY;LOGNAME" "COMMAND;NO_PARALLEL_COMMAND" ${ARGN}) + + set(LOG_OUT "${CURRENT_BUILDTREES_DIR}/${_ebp_LOGNAME}-out.log") + set(LOG_ERR "${CURRENT_BUILDTREES_DIR}/${_ebp_LOGNAME}-err.log") + + execute_process( + COMMAND ${_ebp_COMMAND} + WORKING_DIRECTORY ${_ebp_WORKING_DIRECTORY} + OUTPUT_FILE ${LOG_OUT} + ERROR_FILE ${LOG_ERR} + RESULT_VARIABLE error_code + ) + + if(error_code) + 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() + + if(out_contents MATCHES "LINK : fatal error LNK1102:" OR out_contents MATCHES " fatal error C1060: " + OR err_contents MATCHES "LINK : fatal error LNK1102:" OR err_contents MATCHES " fatal error C1060: ") + # The linker ran out of memory during execution. We will try continuing once more, with parallelism disabled. + message(STATUS "Restarting Build without parallelism because memory exceeded") + set(LOG_OUT "${CURRENT_BUILDTREES_DIR}/${_ebp_LOGNAME}-out-1.log") + set(LOG_ERR "${CURRENT_BUILDTREES_DIR}/${_ebp_LOGNAME}-err-1.log") + + if(${_ebp_NO_PARALLEL_COMMAND}) + execute_process( + COMMAND ${_ebp_NO_PARALLEL_COMMAND} + WORKING_DIRECTORY ${_ebp_WORKING_DIRECTORY} + OUTPUT_FILE ${LOG_OUT} + ERROR_FILE ${LOG_ERR} + RESULT_VARIABLE error_code + ) + else() + execute_process( + COMMAND ${_ebp_COMMAND} + WORKING_DIRECTORY ${_ebp_WORKING_DIRECTORY} + OUTPUT_FILE ${LOG_OUT} + ERROR_FILE ${LOG_ERR} + RESULT_VARIABLE error_code + ) + endif() + + if(error_code) + 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() + endif() + elseif(out_contents MATCHES "mt : general error c101008d: " OR out_contents MATCHES "mt.exe : general error c101008d: ") + # Antivirus workaround - occasionally files are locked and cause mt.exe to fail + message(STATUS "mt.exe has failed. This may be the result of anti-virus. Disabling anti-virus on the buildtree folder may improve build speed") + set(ITERATION 0) + while (ITERATION LESS 3 AND (out_contents MATCHES "mt : general error c101008d: " OR out_contents MATCHES "mt.exe : general error c101008d: ")) + MATH(EXPR ITERATION "${ITERATION}+1") + message(STATUS "Restarting Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} because of mt.exe file locking issue. Iteration: ${ITERATION}") + execute_process( + COMMAND ${_ebp_COMMAND} + OUTPUT_FILE "${LOGPREFIX}-out-${ITERATION}.log" + ERROR_FILE "${LOGPREFIX}-err-${ITERATION}.log" + RESULT_VARIABLE error_code + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE}) + + if(error_code) + file(READ "${LOGPREFIX}-out-${ITERATION}.log" out_contents) + file(READ "${LOGPREFIX}-err-${ITERATION}.log" err_contents) + + if(out_contents) + list(APPEND LOGS "${LOGPREFIX}-out-${ITERATION}.log") + endif() + if(err_contents) + list(APPEND LOGS "${LOGPREFIX}-err-${ITERATION}.log") + endif() + else() + break() + endif() + endwhile() + 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() + message(FATAL_ERROR + " Command failed: ${_ebp_COMMAND}\n" + " Working Directory: ${_ebp_WORKING_DIRECTORY}\n" + " See logs for more information:\n" + ${STRINGIFIED_LOGS}) + endif(error_code) + endif(error_code) +endfunction(vcpkg_execute_build_process) -- cgit v1.2.3 From 555b760c67fcadea334c109b219c41b12b063413 Mon Sep 17 00:00:00 2001 From: shadowxiali <276404541@qq.com> Date: Thu, 13 Jun 2019 08:41:28 +0800 Subject: Update applocal.ps1 (#4942) * Update applocal.ps1 * Update applocal.ps1 Fix Microsoft#2801, prev modify mistake UTF8 to UTF * Update applocal.ps1 in win7 chinese path, must utf8 to avoid copy dll fail --- scripts/buildsystems/msbuild/applocal.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/buildsystems/msbuild/applocal.ps1 b/scripts/buildsystems/msbuild/applocal.ps1 index cf363f12e..2fdd9fdb4 100644 --- a/scripts/buildsystems/msbuild/applocal.ps1 +++ b/scripts/buildsystems/msbuild/applocal.ps1 @@ -9,7 +9,7 @@ $g_is_debug = $g_install_root -match '(.*\\)?debug(\\)?$' # Ensure we create the copied files log, even if we don't end up copying any files if ($copiedFilesLog) { - Set-Content -Path $copiedFilesLog -Value "" -Encoding Ascii + Set-Content -Path $copiedFilesLog -Value "" -Encoding UTF8 } # Note: this function signature is depended upon by the qtdeploy.ps1 script introduced in 5.7.1-7 @@ -28,7 +28,7 @@ function deployBinary([string]$targetBinaryDir, [string]$SourceDir, [string]$tar Write-Verbose " ${targetBinaryName}: Copying $SourceDir\$targetBinaryName" Copy-Item "$SourceDir\$targetBinaryName" $targetBinaryDir } - if ($copiedFilesLog) { Add-Content $copiedFilesLog "$targetBinaryDir\$targetBinaryName" } + if ($copiedFilesLog) { Add-Content $copiedFilesLog "$targetBinaryDir\$targetBinaryName" -Encoding UTF8 } if ($tlogFile) { Add-Content $tlogFile "$targetBinaryDir\$targetBinaryName" } } -- cgit v1.2.3 From 7b41dc688a381e1701bd4dbe1ccf3c16d0979594 Mon Sep 17 00:00:00 2001 From: Phil Christensen Date: Thu, 13 Jun 2019 14:12:21 -0700 Subject: retry on flaky linker (#6880) * retry on flaky linker --- scripts/cmake/vcpkg_execute_build_process.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_execute_build_process.cmake b/scripts/cmake/vcpkg_execute_build_process.cmake index f02aa296d..27e8c8163 100644 --- a/scripts/cmake/vcpkg_execute_build_process.cmake +++ b/scripts/cmake/vcpkg_execute_build_process.cmake @@ -57,13 +57,15 @@ function(vcpkg_execute_build_process) endif() if(out_contents MATCHES "LINK : fatal error LNK1102:" OR out_contents MATCHES " fatal error C1060: " - OR err_contents MATCHES "LINK : fatal error LNK1102:" OR err_contents MATCHES " fatal error C1060: ") + OR err_contents MATCHES "LINK : fatal error LNK1102:" OR err_contents MATCHES " fatal error C1060: " + OR out_contents MATCHES "LINK : fatal error LNK1318: Unexpected PDB error; ACCESS_DENIED" + OR out_contents MATCHES "LINK : fatal error LNK1104:") # The linker ran out of memory during execution. We will try continuing once more, with parallelism disabled. message(STATUS "Restarting Build without parallelism because memory exceeded") set(LOG_OUT "${CURRENT_BUILDTREES_DIR}/${_ebp_LOGNAME}-out-1.log") set(LOG_ERR "${CURRENT_BUILDTREES_DIR}/${_ebp_LOGNAME}-err-1.log") - if(${_ebp_NO_PARALLEL_COMMAND}) + if(_ebp_NO_PARALLEL_COMMAND) execute_process( COMMAND ${_ebp_NO_PARALLEL_COMMAND} WORKING_DIRECTORY ${_ebp_WORKING_DIRECTORY} -- cgit v1.2.3 From 9cc9978c5bcbe24cb75bc906a1d714a23f09a077 Mon Sep 17 00:00:00 2001 From: dan-shaw <51385773+dan-shaw@users.noreply.github.com> Date: Fri, 14 Jun 2019 13:09:38 -0700 Subject: set CMAKE_SYSTEM_PROCESSOR in Linux (#6872) * add vcpkg_target_architecture to vcpkg_configure_cmake * modify shogun and thrift * update glbinding --- scripts/cmake/vcpkg_configure_cmake.cmake | 1 + scripts/toolchains/linux.cmake | 3 +++ 2 files changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index ceff199ab..8f3aa6425 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -207,6 +207,7 @@ function(vcpkg_configure_cmake) "-DVCPKG_C_FLAGS_DEBUG=${VCPKG_C_FLAGS_DEBUG}" "-DVCPKG_CRT_LINKAGE=${VCPKG_CRT_LINKAGE}" "-DVCPKG_LINKER_FLAGS=${VCPKG_LINKER_FLAGS}" + "-DVCPKG_TARGET_ARCHITECTURE=${VCPKG_TARGET_ARCHITECTURE}" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" ) diff --git a/scripts/toolchains/linux.cmake b/scripts/toolchains/linux.cmake index b9cbc0ff3..70f224da9 100644 --- a/scripts/toolchains/linux.cmake +++ b/scripts/toolchains/linux.cmake @@ -4,6 +4,9 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "") endif() set(CMAKE_SYSTEM_NAME Linux CACHE STRING "") +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(CMAKE_SYSTEM_PROCESSOR x86_64 CACHE STRING "") +endif() get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) if(NOT _CMAKE_IN_TRY_COMPILE) -- cgit v1.2.3 From 8cd2d17460d7c8d1dc74491cd890691f9546dc8c Mon Sep 17 00:00:00 2001 From: TheGoddessInari Date: Sun, 16 Jun 2019 23:09:07 -0700 Subject: [vcpkg] Bootstrap should use Get-CimInstance instead of Get-WmiObject. (#6788) * [vcpkg] Bootstrap should use Get-CimInstance instead of Get-WmiObject. This lets it work with Powershell Core 6.0. --- scripts/bootstrap.ps1 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index b195cc605..6234efaa3 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -339,7 +339,14 @@ if ($disableMetrics) $platform = "x86" $vcpkgReleaseDir = "$vcpkgSourcesPath\msbuild.x86.release" -$architecture=(Get-WmiObject win32_operatingsystem | Select-Object osarchitecture).osarchitecture +if($PSVersionTable.PSVersion.Major -le 2) +{ + $architecture=(Get-WmiObject win32_operatingsystem | Select-Object osarchitecture).osarchitecture +} +else +{ + $architecture=(Get-CimInstance win32_operatingsystem | Select-Object osarchitecture).osarchitecture +} if ($win64) { if (-not $architecture -like "*64*") -- cgit v1.2.3 From e4acc60b3c9acb7fe7a323f146234e3aeab7cab6 Mon Sep 17 00:00:00 2001 From: Phil Christensen Date: Tue, 18 Jun 2019 00:01:32 -0700 Subject: address qhull flaky build with msvc linker (#6943) --- scripts/cmake/vcpkg_execute_build_process.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_execute_build_process.cmake b/scripts/cmake/vcpkg_execute_build_process.cmake index 27e8c8163..d440ba2f6 100644 --- a/scripts/cmake/vcpkg_execute_build_process.cmake +++ b/scripts/cmake/vcpkg_execute_build_process.cmake @@ -59,7 +59,8 @@ function(vcpkg_execute_build_process) if(out_contents MATCHES "LINK : fatal error LNK1102:" OR out_contents MATCHES " fatal error C1060: " OR err_contents MATCHES "LINK : fatal error LNK1102:" OR err_contents MATCHES " fatal error C1060: " OR out_contents MATCHES "LINK : fatal error LNK1318: Unexpected PDB error; ACCESS_DENIED" - OR out_contents MATCHES "LINK : fatal error LNK1104:") + OR out_contents MATCHES "LINK : fatal error LNK1104:" + OR out_contents MATCHES "LINK : fatal error LNK1201:") # The linker ran out of memory during execution. We will try continuing once more, with parallelism disabled. message(STATUS "Restarting Build without parallelism because memory exceeded") set(LOG_OUT "${CURRENT_BUILDTREES_DIR}/${_ebp_LOGNAME}-out-1.log") -- cgit v1.2.3 From df0b8d9e55bfb6772a9e5c02fd826ab520e5d2f8 Mon Sep 17 00:00:00 2001 From: Phil Christensen Date: Wed, 19 Jun 2019 10:47:09 -0700 Subject: [vcpkg] update python3 to 3.7.3 on windows (#6383) * [vcpkg] update python3 to 3.7.3 on windows * Update scripts/cmake/vcpkg_find_acquire_program.cmake Co-Authored-By: Bradley Austin Davis --- scripts/cmake/vcpkg_find_acquire_program.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 4a77b4b8e..451f4bcd3 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -79,9 +79,9 @@ function(vcpkg_find_acquire_program VAR) set(PROGNAME python) set(SUBDIR "python3") set(PATHS ${DOWNLOADS}/tools/python/${SUBDIR}) - set(URL "https://www.python.org/ftp/python/3.5.4/python-3.5.4-embed-win32.zip") - set(ARCHIVE "python-3.5.4-embed-win32.zip") - set(HASH b5240fdc95088c2d7f65d2dd598650f8dd106b49589d94156bd4a078b108c6cabbe7a38ef73e2b2cf00e8312a93d2e587eac2c54ce85540d3c7a26cc60013156) + set(URL "https://www.python.org/ftp/python/3.7.3/python-3.7.3-embed-win32.zip") + set(ARCHIVE "python-3.7.3-embed-win32.zip") + set(HASH 2c1b1f0a29d40a91771ae21a5f733eedc10984cd182cb10c2793bbd24191a89f20612a3f23c34047f37fb06369016bfd4a52915ed1b4a56f8bd2b4ca6994eb31) else() set(PROGNAME python3) set(BREW_PACKAGE_NAME "python") -- cgit v1.2.3 From 943aed271fe256ae683d522bb95d5c2d3f317339 Mon Sep 17 00:00:00 2001 From: Igor Kostenko Date: Wed, 19 Jun 2019 20:08:02 +0100 Subject: Use correct path separators for each platform (#6960) --- scripts/cmake/vcpkg_build_qmake.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_build_qmake.cmake b/scripts/cmake/vcpkg_build_qmake.cmake index 80a0aef0d..cf79fe8fc 100644 --- a/scripts/cmake/vcpkg_build_qmake.cmake +++ b/scripts/cmake/vcpkg_build_qmake.cmake @@ -11,9 +11,11 @@ function(vcpkg_build_qmake) cmake_parse_arguments(_csc "SKIP_MAKEFILES" "BUILD_LOGNAME" "TARGETS;RELEASE_TARGETS;DEBUG_TARGETS" ${ARGN}) if(CMAKE_HOST_WIN32) + set(_PATHSEP ";") vcpkg_find_acquire_program(JOM) set(INVOKE "${JOM}") else() + set(_PATHSEP ":") find_program(MAKE make) set(INVOKE "${MAKE}") endif() @@ -56,7 +58,7 @@ function(vcpkg_build_qmake) #First generate the makefiles so we can modify them if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") - set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/debug/lib;${CURRENT_INSTALLED_DIR}/debug/bin;${CURRENT_INSTALLED_DIR}/tools/qt5;${ENV_PATH_BACKUP}") + set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/debug/lib${_PATHSEP}${CURRENT_INSTALLED_DIR}/debug/bin${_PATHSEP}${CURRENT_INSTALLED_DIR}/tools/qt5${_PATHSEP}${ENV_PATH_BACKUP}") if(NOT _csc_SKIP_MAKEFILES) run_jom(qmake_all makefiles dbg) @@ -81,7 +83,7 @@ function(vcpkg_build_qmake) endif() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") - set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/lib;${CURRENT_INSTALLED_DIR}/bin;${CURRENT_INSTALLED_DIR}/tools/qt5;${ENV_PATH_BACKUP}") + set(ENV{PATH} "${CURRENT_INSTALLED_DIR}/lib${_PATHSEP}${CURRENT_INSTALLED_DIR}/bin${_PATHSEP}${CURRENT_INSTALLED_DIR}/tools/qt5${_PATHSEP}${ENV_PATH_BACKUP}") if(NOT _csc_SKIP_MAKEFILES) run_jom(qmake_all makefiles rel) -- cgit v1.2.3 From 4b0b0c57314cc0d73f7a666a2bc476153d6b42a2 Mon Sep 17 00:00:00 2001 From: past-due <30942300+past-due@users.noreply.github.com> Date: Wed, 19 Jun 2019 15:08:42 -0400 Subject: bootstrap.sh: Retry up to 3 times for transient download errors (#6952) --- scripts/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 00d31760a..b0e4f98a5 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -100,7 +100,7 @@ vcpkgDownloadFile() url=$1; downloadPath=$2 sha512=$3 vcpkgCheckRepoTool "curl" rm -rf "$downloadPath.part" - curl -L $url --create-dirs --output "$downloadPath.part" || exit 1 + curl -L $url --create-dirs --retry 3 --output "$downloadPath.part" || exit 1 vcpkgCheckEqualFileHash $url "$downloadPath.part" $sha512 mv "$downloadPath.part" "$downloadPath" -- cgit v1.2.3 From 989d0497025e59c9f9946bb6c7b1c742604bb589 Mon Sep 17 00:00:00 2001 From: Norbert Nemec Date: Wed, 19 Jun 2019 22:32:39 +0200 Subject: mesonbuild - Update to 0.51.0 --- scripts/cmake/vcpkg_find_acquire_program.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 451f4bcd3..024840223 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -154,10 +154,10 @@ function(vcpkg_find_acquire_program VAR) else() set(SCRIPTNAME meson) endif() - set(PATHS ${DOWNLOADS}/tools/meson/meson-0.50.0) - set(URL "https://github.com/mesonbuild/meson/archive/0.50.0.zip") - set(ARCHIVE "meson-0.50.0.zip") - set(HASH 587cafe0cd551e3fb3507ecab904912dc3e053aa95c864b435526a20d52406536ba970a50be6c9f20d83314c5853aaefa102c5ca14623d0928b091a43e7b6d64) + set(PATHS ${DOWNLOADS}/tools/meson/meson-0.51.0) + set(URL "https://github.com/mesonbuild/meson/archive/0.51.0.zip") + set(ARCHIVE "meson-0.51.0.zip") + set(HASH bf1df65cde7e0e0a44e4b4be7d68de9897a77c4ea4c694f1d77fe82cd3c7e7818dc034a3313ce885ba6883b4ba6d282b7a589f665fa499d9eb79fc7a23e415cc) elseif(VAR MATCHES "FLEX") if(CMAKE_HOST_WIN32) set(PROGNAME win_flex) -- cgit v1.2.3 From 11506d1426163df3c867a99bacd84b8911ea3224 Mon Sep 17 00:00:00 2001 From: Norbert Nemec Date: Wed, 19 Jun 2019 22:35:08 +0200 Subject: set cmake_prefix_path correctly within vcpkg_configure_meson --- scripts/cmake/vcpkg_configure_meson.cmake | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_configure_meson.cmake b/scripts/cmake/vcpkg_configure_meson.cmake index f1ae0e65f..f907c76f1 100644 --- a/scripts/cmake/vcpkg_configure_meson.cmake +++ b/scripts/cmake/vcpkg_configure_meson.cmake @@ -26,6 +26,7 @@ function(vcpkg_configure_meson) set(MESON_RELEASE_LDFLAGS "${MESON_RELEASE_LDFLAGS} /INCREMENTAL:NO /OPT:REF /OPT:ICF") # select meson cmd-line options + list(APPEND _vcm_OPTIONS -Dcmake_prefix_path=${CURRENT_INSTALLED_DIR}) list(APPEND _vcm_OPTIONS --buildtype plain --backend ninja --wrap-mode nodownload) if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) list(APPEND _vcm_OPTIONS --default-library shared) -- cgit v1.2.3 From 54b3be6b60466370d37edbe64fb6c6ede8487f04 Mon Sep 17 00:00:00 2001 From: tarcila Date: Tue, 25 Jun 2019 02:21:30 -0400 Subject: [scripts] Fix vcpkg_fixup_cmake on non Windows platforms (#5630) * [scripts] Fix vcpkg_fixup_cmake on non Windows platforms Script was only handling tools executables ending with .exe. Changed it so anything under /bin/ in transformed. This fixes for instance FlatcTargets-release.cmake from flatbuffers port on osx. --- scripts/cmake/vcpkg_fixup_cmake_targets.cmake | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index 982f414b6..1e0f2493d 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -4,7 +4,8 @@ # Transform all /debug/share//*targets-debug.cmake files and move them to /share/. # Removes all /debug/share//*targets.cmake and /debug/share//*config.cmake # -# Transform all references matching /bin/*.exe to /tools//*.exe +# Transform all references matching /bin/*.exe to /tools//*.exe on Windows +# Transform all references matching /bin/* to /tools//* on other platforms # # Fix ${_IMPORT_PREFIX} in auto generated targets to be one folder deeper. # Replace ${CURRENT_INSTALLED_DIR} with ${_IMPORT_PREFIX} in configs/targets. @@ -27,6 +28,13 @@ function(vcpkg_fixup_cmake_targets) set(_vfct_TARGET_PATH share/${PORT}) endif() + + if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(EXECUTABLE_SUFFIX "\\.exe") + else() + set(EXECUTABLE_SUFFIX) + endif() + set(DEBUG_SHARE ${CURRENT_PACKAGES_DIR}/debug/${_vfct_TARGET_PATH}) set(RELEASE_SHARE ${CURRENT_PACKAGES_DIR}/${_vfct_TARGET_PATH}) @@ -107,7 +115,7 @@ function(vcpkg_fixup_cmake_targets) foreach(RELEASE_TARGET IN LISTS RELEASE_TARGETS) file(READ ${RELEASE_TARGET} _contents) string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" _contents "${_contents}") - string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+\\.exe)" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}") + string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+${EXECUTABLE_SUFFIX})" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}") file(WRITE ${RELEASE_TARGET} "${_contents}") endforeach() @@ -120,7 +128,7 @@ function(vcpkg_fixup_cmake_targets) file(READ ${DEBUG_TARGET} _contents) string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" _contents "${_contents}") - string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \";]+\\.exe)" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}") + string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \";]+${EXECUTABLE_SUFFIX})" "\${_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 ${RELEASE_SHARE}/${DEBUG_TARGET_REL} "${_contents}") -- cgit v1.2.3 From 1ce24dd0db6d9cf6cdb348ff29aa8454b3f1b028 Mon Sep 17 00:00:00 2001 From: Phil Christensen Date: Tue, 25 Jun 2019 16:08:18 -0700 Subject: [docs]Update cmake docs (#7039) --- scripts/cmake/vcpkg_configure_cmake.cmake | 1 + scripts/cmake/vcpkg_extract_source_archive_ex.cmake | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 8f3aa6425..c17bd68c8 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -7,6 +7,7 @@ ## vcpkg_configure_cmake( ## SOURCE_PATH <${SOURCE_PATH}> ## [PREFER_NINJA] +## [DISABLE_PARALLEL_CONFIGURE] ## [GENERATOR <"NMake Makefiles">] ## [OPTIONS <-DUSE_THIS_IN_ALL_BUILDS=1>...] ## [OPTIONS_RELEASE <-DOPTIMIZE=1>...] diff --git a/scripts/cmake/vcpkg_extract_source_archive_ex.cmake b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake index a70a5e4a3..a775c2094 100644 --- a/scripts/cmake/vcpkg_extract_source_archive_ex.cmake +++ b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake @@ -25,7 +25,7 @@ ## This is usually obtained from calling [`vcpkg_download_distfile`](vcpkg_download_distfile.md). ## ## ### REF -## A friendly name that will be used instead of the filename of the archive. +## A friendly name that will be used instead of the filename of the archive. If more than 10 characters it will be truncated. ## ## By convention, this is set to the version number or tag fetched ## -- cgit v1.2.3 From 32ee6c96ce48beffd64fea04c676ffb0d297681b Mon Sep 17 00:00:00 2001 From: John Zhu Date: Tue, 25 Jun 2019 21:45:02 -0700 Subject: #5248 make vcpkg buildable as 'system' user (#7038) If we keep TMP, when run as 'system' user it is using Windows\Temp folder. --- scripts/cleanEnvironmentHelper.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/cleanEnvironmentHelper.ps1 b/scripts/cleanEnvironmentHelper.ps1 index a3792ecd3..fa5fe869d 100644 --- a/scripts/cleanEnvironmentHelper.ps1 +++ b/scripts/cleanEnvironmentHelper.ps1 @@ -1,6 +1,6 @@ # Capture environment variables for the System and User. Also add some special/built-in variables. # These will be used to synthesize a clean environment -$specialEnvironmentMap = @{ "SystemDrive"=$env:SystemDrive; "SystemRoot"=$env:SystemRoot; "UserProfile"=$env:UserProfile } # These are built-in and not set in the registry +$specialEnvironmentMap = @{ "SystemDrive"=$env:SystemDrive; "SystemRoot"=$env:SystemRoot; "UserProfile"=$env:UserProfile; "TMP"=$env:TMP } # These are built-in and not set in the registry $machineEnvironmentMap = [Environment]::GetEnvironmentVariables('Machine') # HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment $userEnvironmentMap = [Environment]::GetEnvironmentVariables('User') # HKEY_CURRENT_USER\Environment -- cgit v1.2.3 From fd87a081bb6acc33ec4e581f1ce60edcad80eda1 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Thu, 27 Jun 2019 00:00:48 +0200 Subject: Introduce an easier way to identify target systems... (#6846) * Introduce an easier way to identify target systems... * fix missing () * move the include around. also added vcpkg_common_functions to be automatically included * remove warning message * added remaining VCPKG_CMAKE_SYSTEM_NAMEs found only in vcpkg_configure_cmake to load a toolchain. * remove warning again from messed up merge --- scripts/cmake/vcpkg_common_definitions.cmake | 14 ++++++++++++++ scripts/ports.cmake | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 scripts/cmake/vcpkg_common_definitions.cmake (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake new file mode 100644 index 000000000..8dc05de3c --- /dev/null +++ b/scripts/cmake/vcpkg_common_definitions.cmake @@ -0,0 +1,14 @@ +if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(VCPKG_TARGET_IS_WINDOWS 1) + if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(VCPKG_TARGET_IS_UWP 1) + endif() +elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(VCPKG_TARGET_IS_OSX 1) +elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(VCPKG_TARGET_IS_LINUX 1) +elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Android") + set(VCPKG_TARGET_IS_ANDROID 1) +elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + set(VCPKG_TARGET_IS_FREEBSD 1) +endif() diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 7a5f2749f..118cc9481 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -68,6 +68,8 @@ if(CMD MATCHES "^BUILD$") include(${CMAKE_TRIPLET_FILE}) set(TRIPLET_SYSTEM_ARCH ${VCPKG_TARGET_ARCHITECTURE}) + include(${CMAKE_CURRENT_LIST_DIR}/cmake/vcpkg_common_definitions.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/cmake/vcpkg_common_functions.cmake) include(${CURRENT_PORT_DIR}/portfile.cmake) set(BUILD_INFO_FILE_PATH ${CURRENT_PACKAGES_DIR}/BUILD_INFO) -- cgit v1.2.3 From 35e985d3ccf60235bc4881df4d934610cd507090 Mon Sep 17 00:00:00 2001 From: Victor Romero Date: Thu, 27 Jun 2019 12:20:12 -0700 Subject: Triplets Overlay Implementation (#7053) * Triplets Overlay Implementation * Use cache for get_triplet_file_path() * Code cleanup --- scripts/ports.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 118cc9481..860d08893 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -32,7 +32,7 @@ endif() if(CMD MATCHES "^BUILD$") - set(CMAKE_TRIPLET_FILE ${VCPKG_ROOT_DIR}/triplets/${TARGET_TRIPLET}.cmake) + set(CMAKE_TRIPLET_FILE ${TARGET_TRIPLET_FILE}) if(NOT EXISTS ${CMAKE_TRIPLET_FILE}) message(FATAL_ERROR "Unsupported target triplet. Triplet file does not exist: ${CMAKE_TRIPLET_FILE}") endif() -- cgit v1.2.3 From b4675fd65a5baebe93d0e60e082ae43013ed246f Mon Sep 17 00:00:00 2001 From: myd7349 Date: Sat, 29 Jun 2019 01:17:39 +0800 Subject: [vcpkg] Add vcpkg_check_features (#6958) * [vcpkg] Add vcpkg_check_feature, vcpkg_check_features * [vcpkg] Remove vcpkg_check_feature * [oniguruma,xtensor] Use vcpkg_check_features --- scripts/cmake/vcpkg_check_features.cmake | 82 ++++++++++++++++++++++++++++++ scripts/cmake/vcpkg_common_functions.cmake | 1 + 2 files changed, 83 insertions(+) create mode 100644 scripts/cmake/vcpkg_check_features.cmake (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_check_features.cmake b/scripts/cmake/vcpkg_check_features.cmake new file mode 100644 index 000000000..c8848e987 --- /dev/null +++ b/scripts/cmake/vcpkg_check_features.cmake @@ -0,0 +1,82 @@ +## # vcpkg_check_features +## +## Check if one or more features are part of the package installation. +## +## ## Usage +## ```cmake +## vcpkg_check_features( +## +## [ ] +## ... +## ) +## ``` +## +## `vcpkg_check_features` accepts a list of (feature, output_variable) pairs. +## The syntax is similar to the `PROPERTIES` argument of `set_target_properties`. +## +## `vcpkg_check_features` will create a variable `FEATURE_OPTIONS` in the +## parent scope, which you can pass as a part of `OPTIONS` argument when +## calling functions like `vcpkg_config_cmake`: +## ```cmake +## vcpkg_config_cmake( +## SOURCE_PATH ${SOURCE_PATH} +## PREFER_NINJA +## OPTIONS +## -DBUILD_TESTING=ON +## ${FEATURE_OPTIONS} +## ) +## ``` +## +## ## Notes +## `vcpkg_check_features` is supposed to be called only once. Otherwise, the +## `FEATURE_OPTIONS` variable set by a previous call will be overwritten. +## +## ## Examples +## +## * [czmq](https://github.com/microsoft/vcpkg/blob/master/ports/czmq/portfile.cmake) +## * [oniguruma](https://github.com/microsoft/vcpkg/blob/master/ports/oniguruma/portfile.cmake) +## * [xtensor](https://github.com/microsoft/vcpkg/blob/master/ports/xtensor/portfile.cmake) +function(vcpkg_check_features) + cmake_parse_arguments(_vcf "" "" "" ${ARGN}) + + list(LENGTH ARGN _vcf_ARGC) + math(EXPR _vcf_INCORRECT_ARGN "${_vcf_ARGC} % 2") + + if(_vcf_INCORRECT_ARGN) + message(FATAL_ERROR "Called with incorrect number of arguments.") + endif() + + set(_vcf_IS_FEATURE_ARG ON) + set(_vcf_FEATURE_OPTIONS) + + # Process (feature, output_var) pairs + foreach(_vcf_ARG ${ARGN}) + if(_vcf_IS_FEATURE_ARG) + set(_vcf_FEATURE ${_vcf_ARG}) + + if(NOT ${_vcf_FEATURE} IN_LIST ALL_FEATURES) + message(FATAL_ERROR "Unknown feature: ${_vcf_FEATURE}") + endif() + + set(_vcf_IS_FEATURE_ARG OFF) + else() + set(_vcf_FEATURE_VAR ${_vcf_ARG}) + + if(${_vcf_FEATURE} IN_LIST FEATURES) + set(${_vcf_FEATURE_VAR} ON PARENT_SCOPE) + else() + set(${_vcf_FEATURE_VAR} OFF PARENT_SCOPE) + endif() + + list(APPEND _vcf_FEATURE_OPTIONS "-D${_vcf_FEATURE_VAR}=${${_vcf_FEATURE_VAR}}") + + set(_vcf_IS_FEATURE_ARG ON) + endif() + endforeach() + + if(DEFINED FEATURE_OPTIONS) + message(WARNING "FEATURE_OPTIONS is already defined and will be overwritten.") + endif() + + set(FEATURE_OPTIONS ${_vcf_FEATURE_OPTIONS} PARENT_SCOPE) +endfunction() diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index b99f8bee8..827d43abe 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -1,5 +1,6 @@ include(vcpkg_acquire_msys) include(vcpkg_add_to_path) +include(vcpkg_check_features) include(vcpkg_check_linkage) include(vcpkg_clean_msbuild) include(vcpkg_download_distfile) -- cgit v1.2.3 From a7bbee315276d37344a464eb95b02ca20ff1b0c2 Mon Sep 17 00:00:00 2001 From: myd7349 Date: Sat, 29 Jun 2019 23:29:13 +0800 Subject: [vcpkg] Update vcpkg_check_features document (#7091) * [oniguruma] Fix misusage of vcpkg_check_features * [xsimd] Use vcpkg_check_features --- scripts/cmake/vcpkg_check_features.cmake | 48 ++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_check_features.cmake b/scripts/cmake/vcpkg_check_features.cmake index c8848e987..115b1501f 100644 --- a/scripts/cmake/vcpkg_check_features.cmake +++ b/scripts/cmake/vcpkg_check_features.cmake @@ -1,6 +1,6 @@ ## # vcpkg_check_features ## -## Check if one or more features are part of the package installation. +## Check if one or more features are a part of the package installation. ## ## ## Usage ## ```cmake @@ -11,12 +11,9 @@ ## ) ## ``` ## -## `vcpkg_check_features` accepts a list of (feature, output_variable) pairs. -## The syntax is similar to the `PROPERTIES` argument of `set_target_properties`. +## `vcpkg_check_features` accepts a list of (feature, output_variable) pairs. If a feature is specified, the corresponding output variable will be set as `ON`, or `OFF` otherwise. The syntax is similar to the `PROPERTIES` argument of `set_target_properties`. ## -## `vcpkg_check_features` will create a variable `FEATURE_OPTIONS` in the -## parent scope, which you can pass as a part of `OPTIONS` argument when -## calling functions like `vcpkg_config_cmake`: +## `vcpkg_check_features` will create a variable `FEATURE_OPTIONS` in the parent scope, which you can pass as a part of `OPTIONS` argument when calling functions like `vcpkg_config_cmake`: ## ```cmake ## vcpkg_config_cmake( ## SOURCE_PATH ${SOURCE_PATH} @@ -28,13 +25,46 @@ ## ``` ## ## ## Notes -## `vcpkg_check_features` is supposed to be called only once. Otherwise, the -## `FEATURE_OPTIONS` variable set by a previous call will be overwritten. +## ```cmake +## vcpkg_check_features( ) +## ``` +## can be used as a replacement of: +## ```cmake +## if( IN_LIST FEATURES) +## set( ON) +## else() +## set( OFF) +## endif() +## ``` +## +## However, if you have a feature that was checked like this before: +## ```cmake +## if( IN_LIST FEATURES) +## set( OFF) +## else() +## set( ON) +## endif() +## ``` +## then you should not use `vcpkg_check_features` instead. [```oniguruma```](https://github.com/microsoft/vcpkg/blob/master/ports/oniguruma/portfile.cmake), for example, has a feature named `non-posix` which is checked with: +## ```cmake +## if("non-posix" IN_LIST FEATURES) +## set(ENABLE_POSIX_API OFF) +## else() +## set(ENABLE_POSIX_API ON) +## endif() +## ``` +## and by replacing these code with: +## ```cmake +## vcpkg_check_features(non-posix ENABLE_POSIX_API) +## ``` +## is totally wrong. +## +## `vcpkg_check_features` is supposed to be called only once. Otherwise, the `FEATURE_OPTIONS` variable set by a previous call will be overwritten. ## ## ## Examples ## ## * [czmq](https://github.com/microsoft/vcpkg/blob/master/ports/czmq/portfile.cmake) -## * [oniguruma](https://github.com/microsoft/vcpkg/blob/master/ports/oniguruma/portfile.cmake) +## * [xsimd](https://github.com/microsoft/vcpkg/blob/master/ports/xsimd/portfile.cmake) ## * [xtensor](https://github.com/microsoft/vcpkg/blob/master/ports/xtensor/portfile.cmake) function(vcpkg_check_features) cmake_parse_arguments(_vcf "" "" "" ${ARGN}) -- cgit v1.2.3 From e2049cb9754006b6a2abed781d34030e16702fad Mon Sep 17 00:00:00 2001 From: Victor Romero Date: Sun, 30 Jun 2019 09:31:22 -0700 Subject: [vcpkg_configure_cmake] Add NO_CHARSET_FLAG option (#7074) * [vcpkg_configure_cmake] Add NO_CHARSET_FLAG option * [vcpkg_configure_cmake] Add documentation for new NO_CHARSET_FLAG option * [vcpkg_configure_cmake, windows toolchain] Handle NO_CHARSET_FLAG in toolchain * [build.cpp] Add Windows toolchain to package hash * [duilib,msix,thrift,tidy-html5] Use NO_CHARSET_FLAG to fix regressions --- scripts/cmake/vcpkg_configure_cmake.cmake | 9 ++++++++- scripts/toolchains/windows.cmake | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index c17bd68c8..ab93c3075 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -51,7 +51,7 @@ ## * [poco](https://github.com/Microsoft/vcpkg/blob/master/ports/poco/portfile.cmake) ## * [opencv](https://github.com/Microsoft/vcpkg/blob/master/ports/opencv/portfile.cmake) function(vcpkg_configure_cmake) - cmake_parse_arguments(_csc "PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN}) + cmake_parse_arguments(_csc "PREFER_NINJA;DISABLE_PARALLEL_CONFIGURE;NO_CHARSET_FLAG" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN}) if(NOT VCPKG_PLATFORM_TOOLSET) message(FATAL_ERROR "Vcpkg has been updated with VS2017 support, however you need to rebuild vcpkg.exe by re-running bootstrap-vcpkg.bat\n") @@ -174,6 +174,11 @@ function(vcpkg_configure_cmake) else() message(FATAL_ERROR "You must set both the VCPKG_CXX_FLAGS and VCPKG_C_FLAGS") endif() + + set(VCPKG_SET_CHARSET_FLAG ON) + if(_csc_NO_CHARSET_FLAG) + set(VCPKG_SET_CHARSET_FLAG OFF) + endif() if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE) list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}") @@ -189,8 +194,10 @@ function(vcpkg_configure_cmake) list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_ROOT_DIR}/scripts/toolchains/freebsd.cmake") endif() + list(APPEND _csc_OPTIONS "-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET}" + "-DVCPKG_SET_CHARSET_FLAG=${VCPKG_SET_CHARSET_FLAG}" "-DVCPKG_PLATFORM_TOOLSET=${VCPKG_PLATFORM_TOOLSET}" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" diff --git a/scripts/toolchains/windows.cmake b/scripts/toolchains/windows.cmake index 12b1ae7f9..d5d7f8db5 100644 --- a/scripts/toolchains/windows.cmake +++ b/scripts/toolchains/windows.cmake @@ -9,7 +9,8 @@ if(NOT _CMAKE_IN_TRY_COMPILE) message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"") endif() - if(VCPKG_PLATFORM_TOOLSET MATCHES "v120") + set(CHARSET_FLAG "/utf-8") + if (NOT VCPKG_SET_CHARSET_FLAG OR VCPKG_PLATFORM_TOOLSET MATCHES "v120") # VS 2013 does not support /utf-8 set(CHARSET_FLAG) endif() @@ -17,7 +18,7 @@ if(NOT _CMAKE_IN_TRY_COMPILE) set(CMAKE_CXX_FLAGS " /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /GR /EHsc /MP ${VCPKG_CXX_FLAGS}" CACHE STRING "") set(CMAKE_C_FLAGS " /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /MP ${VCPKG_C_FLAGS}" CACHE STRING "") set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "") - + unset(CHARSET_FLAG) set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "") @@ -27,5 +28,4 @@ if(NOT _CMAKE_IN_TRY_COMPILE) set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" CACHE STRING "") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" CACHE STRING "") - endif() -- cgit v1.2.3