From 99e06a64eca28a9af2b9e5544459e60fa40d19fd Mon Sep 17 00:00:00 2001 From: nicole mazzuca <83086508+strega-nil-ms@users.noreply.github.com> Date: Mon, 16 Aug 2021 13:42:31 -0700 Subject: [PATCH] [rollup:2021-08-09] Rollup PR (#19469) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [rollup:2021-08-09] PR #16706 (@JackBoosY) [vcpkg_fixup_cmake_targets] Fix up OSX system development path * [rollup:2021-08-09] PR #19238 (@strega-nil) [scripts-audit] vcpkg_download_distfile * [rollup:2021-08-09] PR #19239 (@strega-nil) [scripts-audit] vcpkg_find_fortran * [rollup:2021-08-09] PR #19338 (@strega-nil) [tinyfiledialogs] Fix for good * [rollup:2021-08-09] PR #19348 (@strega-nil) [scripts-audit] vcpkg_fixup_pkgconfig * fix ports.cmake with newer vcpkg_download_distfile * fix vcpkg create * move vcpkg_common_definitions down so that it's not incorrect * fix vcpkg_internal_get_cmake_vars Co-authored-by: nicole mazzuca Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> Co-authored-by: Billy Robert O'Neal III --- docs/maintainers/vcpkg_find_fortran.md | 12 +- docs/maintainers/vcpkg_from_git.md | 5 + ports/tinyfiledialogs/portfile.cmake | 11 +- ports/tinyfiledialogs/vcpkg.json | 4 +- ports/vcpkg-cmake-config/vcpkg.json | 3 +- .../vcpkg_cmake_config_fixup.cmake | 40 +- scripts/cmake/vcpkg_download_distfile.cmake | 385 +++++++++--------- scripts/cmake/vcpkg_find_fortran.cmake | 62 +-- scripts/cmake/vcpkg_fixup_cmake_targets.cmake | 40 +- scripts/cmake/vcpkg_fixup_pkgconfig.cmake | 219 +++++----- scripts/cmake/vcpkg_from_git.cmake | 98 +++-- scripts/get_cmake_vars/CMakeLists.txt | 2 + scripts/ports.cmake | 130 +++--- versions/baseline.json | 6 +- versions/t-/tinyfiledialogs.json | 5 + versions/v-/vcpkg-cmake-config.json | 5 + 16 files changed, 599 insertions(+), 428 deletions(-) diff --git a/docs/maintainers/vcpkg_find_fortran.md b/docs/maintainers/vcpkg_find_fortran.md index ccd37ec862..227c1c8372 100644 --- a/docs/maintainers/vcpkg_find_fortran.md +++ b/docs/maintainers/vcpkg_find_fortran.md @@ -8,7 +8,17 @@ Windows(x86/x64) Only: If not it will switch/enable MinGW gfortran ## Usage ```cmake -vcpkg_find_fortran() +vcpkg_find_fortran() +``` + +## Example +```cmake +vcpkg_find_fortran(fortran_args) +# ... +vcpkg_configure_cmake(... + OPTIONS + ${fortran_args} +) ``` ## Source diff --git a/docs/maintainers/vcpkg_from_git.md b/docs/maintainers/vcpkg_from_git.md index 85bb3f9092..de56c60545 100644 --- a/docs/maintainers/vcpkg_from_git.md +++ b/docs/maintainers/vcpkg_from_git.md @@ -27,6 +27,11 @@ The url of the git repository. ### REF The git sha of the commit to download. +### FETCH_REF +The git branch to fetch in non-HEAD mode. After this is fetched, +then `REF` is checked out. This is useful in cases where the git server +does not allow checking out non-advertised objects. + ### HEAD_REF The git branch to use when the package is requested to be built from the latest sources. diff --git a/ports/tinyfiledialogs/portfile.cmake b/ports/tinyfiledialogs/portfile.cmake index 27e5209599..2bc52913a9 100644 --- a/ports/tinyfiledialogs/portfile.cmake +++ b/ports/tinyfiledialogs/portfile.cmake @@ -2,11 +2,12 @@ vcpkg_fail_port_install(ON_TARGET "uwp") vcpkg_check_linkage(ONLY_STATIC_LIBRARY) -vcpkg_from_sourceforge( +vcpkg_from_git( OUT_SOURCE_PATH SOURCE_PATH - REPO tinyfiledialogs - SHA512 d63d6dd847d6bbd1f252c8fbd228086381af7189ac71afc97bd57e06badd1d3f4d90c6aab6207191ae7253d5a71fc44636cf8e33714089d5b478dd2714f59376 - FILENAME "tinyfiledialogs-current.zip" + FETCH_REF master + HEAD_REF master + URL https://git.code.sf.net/p/tinyfiledialogs/code + REF e11f94cd7887b101d64f74892d769f0139b5e166 ) file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") @@ -26,6 +27,6 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(READ "${CURRENT_PACKAGES_DIR}/include/tinyfiledialogs/tinyfiledialogs.h" _contents) # reads between the line "- License -" and a closing "*/" if (NOT _contents MATCHES [[- License -(([^*]|\*[^/])*)\*/]]) - message(FATAL_ERROR "Failed to parse license from tinyfiledialogs.h") + message(FATAL_ERROR "Failed to parse license from tinyfiledialogs.h") endif() file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "${CMAKE_MATCH_1}") diff --git a/ports/tinyfiledialogs/vcpkg.json b/ports/tinyfiledialogs/vcpkg.json index 48819cab3a..1695d50079 100644 --- a/ports/tinyfiledialogs/vcpkg.json +++ b/ports/tinyfiledialogs/vcpkg.json @@ -1,7 +1,7 @@ { "name": "tinyfiledialogs", - "version-semver": "3.8.8", - "port-version": 1, + "version": "3.8.8", + "port-version": 2, "description": "Highly portable and cross-platform dialogs for native inputbox, passwordbox, colorpicker and more", "homepage": "https://sourceforge.net/projects/tinyfiledialogs/", "supports": "!uwp", diff --git a/ports/vcpkg-cmake-config/vcpkg.json b/ports/vcpkg-cmake-config/vcpkg.json index 49faaf4d40..71d81f250c 100644 --- a/ports/vcpkg-cmake-config/vcpkg.json +++ b/ports/vcpkg-cmake-config/vcpkg.json @@ -1,5 +1,4 @@ { "name": "vcpkg-cmake-config", - "version-date": "2021-05-22", - "port-version": 1 + "version-date": "2021-08-11" } diff --git a/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake b/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake index a145d324a9..3cb60fe6be 100644 --- a/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake +++ b/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake @@ -221,6 +221,44 @@ get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)]] file(WRITE "${main_cmake}" "${contents}") endforeach() + if (VCPKG_TARGET_IS_OSX) + # see #16259 for details why this replacement is necessary. + file(GLOB targets_files "${release_share}/*[Tt]argets.cmake") + if (targets_files STREQUAL "") + file(GLOB targets_files "${release_share}/*[Cc]onfig.cmake") + endif() + foreach(targets_file IN LISTS targets_files) + file(READ "${targets_file}" targets_content) + string(REGEX MATCHALL "INTERFACE_LINK_LIBRARIES[^\n]*\n" library_contents "${targets_content}") + foreach(line IN LISTS library_contents) + set(fixed_line "${line}") + string(REGEX MATCHALL [[/[^ ;"]+/[^ ;"/]+\.framework]] frameworks "${line}") + foreach(framework IN LISTS frameworks) + if(NOT framework MATCHES [[^(.+)/(.+)\.framework$]]) + continue() + endif() + set(path "${CMAKE_MATCH_1}") + set(name "${CMAKE_MATCH_2}") + if(NOT DEFINED VCPKG_DETECTED_CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES) + set(_saved_buildtrees_dir "${CURRENT_BUILDTREES_DIR}") + set(CURRENT_BUILDTREES_DIR "${CURRENT_BUILDTREES_DIR}/get-cmake-vars") + z_vcpkg_get_cmake_vars(cmake_vars_file) + debug_message("Including cmake vars from: ${cmake_vars_file}") + include("${cmake_vars_file}") + set(VCPKG_DETECTED_CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${VCPKG_DETECTED_CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES}" PARENT_SCOPE) + set(CURRENT_BUILDTREES_DIR "${_saved_buildtrees_dir}") + endif() + list(FIND VCPKG_DETECTED_CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${path}" index) + if(NOT index EQUAL -1) + string(REPLACE "${framework}" "-framework ${name}" fixed_line "${fixed_line}") + endif() + endforeach() + string(REPLACE "${line}" "${fixed_line}" targets_content "${targets_content}") + endforeach() + file(WRITE "${targets_file}" "${targets_content}") + endforeach() + endif() + # Remove /debug// if it's empty. file(GLOB_RECURSE remaining_files "${debug_share}/*") if(remaining_files STREQUAL "") @@ -233,5 +271,3 @@ get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)]] file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") endif() endfunction() - - diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index 557024351e..8bbe9e3b57 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -58,221 +58,222 @@ The helper [`vcpkg_from_github`](vcpkg_from_github.md) should be used for downlo * [freetype](https://github.com/Microsoft/vcpkg/blob/master/ports/freetype/portfile.cmake) #]===] -include(vcpkg_execute_in_download_mode) +function(z_vcpkg_download_distfile_test_hash path kind error_advice sha512 skip_sha512) + if(_VCPKG_INTERNAL_NO_HASH_CHECK) + # When using the internal hash skip, do not output an explicit message. + return() + endif() + if(skip_sha512) + message(STATUS "Skipping hash check for ${file_path}.") + return() + endif() -function(vcpkg_download_distfile VAR) - set(options SKIP_SHA512 SILENT_EXIT QUIET ALWAYS_REDOWNLOAD) - set(oneValueArgs FILENAME SHA512) - set(multipleValuesArgs URLS HEADERS) - # parse parameters such that semicolons in options arguments to COMMAND don't get erased - cmake_parse_arguments(PARSE_ARGV 1 vcpkg_download_distfile "${options}" "${oneValueArgs}" "${multipleValuesArgs}") + file(SHA512 "${path}" file_hash) + if(NOT "${file_hash}" STREQUAL "${sha512}") + message(FATAL_ERROR + "\nFile does not have expected hash:\n" + " File path: [ ${file_path} ]\n" + " Expected hash: [ ${sha512} ]\n" + " Actual hash: [ ${file_hash} ]\n" + "${CUSTOM_ERROR_ADVICE}\n") + endif() +endfunction() - if(NOT DEFINED vcpkg_download_distfile_URLS) +function(z_vcpkg_download_distfile_show_proxy_and_fail error_code) + message(FATAL_ERROR + " \n" + " Failed to download file with error: ${error_code}\n" + " If you use a proxy, please check your proxy setting. Possible causes are:\n" + " \n" + " 1. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable\n" + " to `https://address:port`. This is not correct, because `https://` prefix\n" + " claims the proxy is an HTTPS proxy, while your proxy (v2ray, shadowsocksr\n" + " , etc..) is an HTTP proxy. Try setting `http://address:port` to both\n" + " HTTP_PROXY and HTTPS_PROXY instead.\n" + " \n" + " 2. You are using Fiddler. Currently a bug (https://github.com/microsoft/vcpkg/issues/17752)\n" + " will set HTTPS_PROXY to `https://fiddler_address:port` which lead to problem 1 above.\n" + " Workaround is open Windows 10 Settings App, and search for Proxy Configuration page,\n" + " Change `http=address:port;https=address:port` to `address`, and fill the port number.\n" + " \n" + " 3. You proxy's remote server is out of service.\n" + " \n" + " In future vcpkg releases, if you are using Windows, you no longer need to set\n" + " HTTP(S)_PROXY environment variables. Vcpkg will simply apply Windows IE Proxy\n" + " Settings set by your proxy software. See (https://github.com/microsoft/vcpkg-tool/pull/49)\n" + " and (https://github.com/microsoft/vcpkg-tool/pull/77)\n" + " \n" + " Otherwise, please submit an issue at https://github.com/Microsoft/vcpkg/issues\n") +endfunction() + +function(z_vcpkg_download_distfile_via_aria filename urls headers sha512 skip_sha512) + vcpkg_find_acquire_program(ARIA2) + message(STATUS "Downloading ${filename}...") + + vcpkg_list(SET headers_param) + foreach(header IN LISTS headers) + vcpkg_list(APPEND headers_param "--header=${header}") + endforeach() + + vcpkg_execute_in_download_mode( + COMMAND ${ARIA2} ${urls} + -o temp/${filename} + -l download-${filename}-detailed.log + ${headers_param} + OUTPUT_FILE download-${filename}-out.log + ERROR_FILE download-${filename}-err.log + RESULT_VARIABLE error_code + WORKING_DIRECTORY "${DOWNLOADS}" + ) + if (NOT "${error_code}" STREQUAL "0") + message(STATUS + "Downloading ${filename}... Failed.\n" + " Exit Code: ${error_code}\n" + " See logs for more information:\n" + " ${DOWNLOADS}/download-${filename}-out.log\n" + " ${DOWNLOADS}/download-${filename}-err.log\n" + " ${DOWNLOADS}/download-${filename}-detailed.log\n" + ) + z_vcpkg_download_distfile_show_proxy_and_fail() + else() + z_vcpkg_download_distfile_test_hash( + "${DOWNLOADS}/temp/${filename}" + "downloaded file" + "The file may have been corrupted in transit." + ) + file(REMOVE + ${DOWNLOADS}/download-${filename}-out.log + ${DOWNLOADS}/download-${filename}-err.log + ${DOWNLOADS}/download-${filename}-detailed.log + ) + get_filename_component(downloaded_file_dir "${downloaded_file_path}" DIRECTORY) + file(MAKE_DIRECTORY "${downloaded_file_dir}") + file(RENAME "${DOWNLOADS}/temp/${filename}" "${downloaded_file_path}") + endif() +endfunction() + +function(vcpkg_download_distfile out_var) + cmake_parse_arguments(PARSE_ARGV 1 arg + "SKIP_SHA512;SILENT_EXIT;QUIET;ALWAYS_REDOWNLOAD" + "FILENAME;SHA512" + "URLS;HEADERS" + ) + + if(NOT DEFINED arg_URLS) message(FATAL_ERROR "vcpkg_download_distfile requires a URLS argument.") endif() - if(NOT DEFINED vcpkg_download_distfile_FILENAME) + if(NOT DEFINED arg_FILENAME) message(FATAL_ERROR "vcpkg_download_distfile requires a FILENAME argument.") endif() - if(vcpkg_download_distfile_SILENT_EXIT) + if(arg_SILENT_EXIT) message(WARNING "SILENT_EXIT has been deprecated as an argument to vcpkg_download_distfile -- remove the argument to resolve this warning") endif() - if(vcpkg_download_distfile_ALWAYS_REDOWNLOAD AND NOT vcpkg_download_distfile_SKIP_SHA512) + if(arg_ALWAYS_REDOWNLOAD AND NOT arg_SKIP_SHA512) message(FATAL_ERROR "ALWAYS_REDOWNLOAD option requires SKIP_SHA512 as well") endif() - if(_VCPKG_INTERNAL_NO_HASH_CHECK) - set(vcpkg_download_distfile_SKIP_SHA512 1) - else() - 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() + + if(NOT arg_SKIP_SHA512 AND NOT DEFINED arg_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.") + elseif(arg_SKIP_SHA512 AND DEFINED arg_SHA512) + message(FATAL_ERROR "vcpkg_download_distfile must not be passed both SHA512 and SKIP_SHA512.") endif() - if(NOT vcpkg_download_distfile_SKIP_SHA512) - if(vcpkg_download_distfile_SHA512 STREQUAL "0") - string(REPEAT "0" 128 vcpkg_download_distfile_SHA512) - endif() - string(LENGTH "${vcpkg_download_distfile_SHA512}" vcpkg_download_distfile_SHA512_length) - if(NOT vcpkg_download_distfile_SHA512_length EQUAL "128") - message(FATAL_ERROR "Invalid SHA512: ${vcpkg_download_distfile_SHA512}. If you do not know the file's SHA512, set this to \"0\".") + + if(_VCPKG_INTERNAL_NO_HASH_CHECK) + set(arg_SKIP_SHA512 1) + endif() + + if(NOT arg_SKIP_SHA512) + if("${arg_SHA512}" STREQUAL "0") + string(REPEAT 0 128 arg_SHA512) + else() + string(LENGTH "${arg_SHA512}" arg_SHA512_length) + if(NOT "${arg_SHA512_length}" EQUAL "128" OR NOT "${arg_SHA512}" MATCHES "^[a-zA-Z0-9]*$") + message(FATAL_ERROR "Invalid SHA512: ${arg_SHA512}. + If you do not know the file's SHA512, set this to \"0\".") + endif() endif() endif() - set(downloaded_file_path ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME}) - set(download_file_path_part "${DOWNLOADS}/temp/${vcpkg_download_distfile_FILENAME}") + set(downloaded_file_path "${DOWNLOADS}/${arg_FILENAME}") + set(download_file_path_part "${DOWNLOADS}/temp/${arg_FILENAME}") # Works around issue #3399 - if(IS_DIRECTORY "${DOWNLOADS}/temp") - # Delete "temp0" directory created by the old version of vcpkg - file(REMOVE_RECURSE "${DOWNLOADS}/temp0") - - file(GLOB temp_files "${DOWNLOADS}/temp") - file(REMOVE_RECURSE ${temp_files}) - else() - file(MAKE_DIRECTORY "${DOWNLOADS}/temp") - endif() - - function(test_hash FILE_PATH FILE_KIND CUSTOM_ERROR_ADVICE) - 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 ${FILE_PATH}.") - return() - endif() - - file(SHA512 ${FILE_PATH} FILE_HASH) - if(NOT FILE_HASH STREQUAL vcpkg_download_distfile_SHA512) - message(FATAL_ERROR - "\nFile does not have expected hash:\n" - " File path: [ ${FILE_PATH} ]\n" - " Expected hash: [ ${vcpkg_download_distfile_SHA512} ]\n" - " Actual hash: [ ${FILE_HASH} ]\n" - "${CUSTOM_ERROR_ADVICE}\n") - endif() - endfunction() + # Delete "temp0" directory created by the old version of vcpkg + file(REMOVE_RECURSE "${DOWNLOADS}/temp0") + file(REMOVE_RECURSE "${DOWNLOADS}/temp") + file(MAKE_DIRECTORY "${DOWNLOADS}/temp") # vcpkg_download_distfile_ALWAYS_REDOWNLOAD only triggers when NOT _VCPKG_NO_DOWNLOADS # this could be de-morgan'd out but it's more clear this way - if(EXISTS "${downloaded_file_path}" AND NOT (vcpkg_download_distfile_ALWAYS_REDOWNLOAD AND NOT _VCPKG_NO_DOWNLOADS)) - if(NOT vcpkg_download_distfile_QUIET) - message(STATUS "Using ${downloaded_file_path}") - endif() - test_hash("${downloaded_file_path}" "cached file" "Please delete the file and retry if this file should be downloaded again.") - else() - if(_VCPKG_NO_DOWNLOADS) + if(_VCPKG_NO_DOWNLOADS) + if(NOT EXISTS "${downloaded_file_path}") message(FATAL_ERROR "Downloads are disabled, but '${downloaded_file_path}' does not exist.") endif() - - # Tries to download the file. - list(GET vcpkg_download_distfile_URLS 0 SAMPLE_URL) - if(_VCPKG_DOWNLOAD_TOOL STREQUAL "ARIA2" AND NOT SAMPLE_URL MATCHES "aria2") - vcpkg_find_acquire_program("ARIA2") - message(STATUS "Downloading ${vcpkg_download_distfile_FILENAME}...") - if(vcpkg_download_distfile_HEADERS) - foreach(header IN LISTS vcpkg_download_distfile_HEADERS) - list(APPEND request_headers "--header=${header}") - endforeach() - endif() - vcpkg_execute_in_download_mode( - COMMAND ${ARIA2} ${vcpkg_download_distfile_URLS} - -o temp/${vcpkg_download_distfile_FILENAME} - -l download-${vcpkg_download_distfile_FILENAME}-detailed.log - ${request_headers} - OUTPUT_FILE download-${vcpkg_download_distfile_FILENAME}-out.log - ERROR_FILE download-${vcpkg_download_distfile_FILENAME}-err.log - RESULT_VARIABLE error_code - WORKING_DIRECTORY "${DOWNLOADS}" - ) - if (NOT "${error_code}" STREQUAL "0") - message(STATUS - "Downloading ${vcpkg_download_distfile_FILENAME}... Failed.\n" - " Exit Code: ${error_code}\n" - " See logs for more information:\n" - " ${DOWNLOADS}/download-${vcpkg_download_distfile_FILENAME}-out.log\n" - " ${DOWNLOADS}/download-${vcpkg_download_distfile_FILENAME}-err.log\n" - " ${DOWNLOADS}/download-${vcpkg_download_distfile_FILENAME}-detailed.log\n" - ) - set(download_success 0) - else() - test_hash("${DOWNLOADS}/temp/${vcpkg_download_distfile_FILENAME}" "downloaded file" "The file may have been corrupted in transit.") - file(REMOVE - ${DOWNLOADS}/download-${vcpkg_download_distfile_FILENAME}-out.log - ${DOWNLOADS}/download-${vcpkg_download_distfile_FILENAME}-err.log - ${DOWNLOADS}/download-${vcpkg_download_distfile_FILENAME}-detailed.log - ) - get_filename_component(downloaded_file_dir "${downloaded_file_path}" DIRECTORY) - file(MAKE_DIRECTORY "${downloaded_file_dir}") - file(RENAME "${DOWNLOADS}/temp/${vcpkg_download_distfile_FILENAME}" "${downloaded_file_path}") - set(download_success 1) - endif() - elseif(vcpkg_download_distfile_SKIP_SHA512 OR vcpkg_download_distfile_HEADERS) - # This is a workaround until the vcpkg tool supports downloading files without SHA512 and with headers - set(download_success 0) - set(request_headers) - if(vcpkg_download_distfile_HEADERS) - foreach(header IN LISTS vcpkg_download_distfile_HEADERS) - list(APPEND request_headers HTTPHEADER ${header}) - endforeach() - endif() - foreach(url IN LISTS vcpkg_download_distfile_URLS) - message(STATUS "Downloading ${url} -> ${vcpkg_download_distfile_FILENAME}...") - file(DOWNLOAD "${url}" "${download_file_path_part}" STATUS download_status ${request_headers}) - list(GET download_status 0 status_code) - if (NOT "${status_code}" STREQUAL "0") - message(STATUS "Downloading ${url}... Failed. Status: ${download_status}") - else() - test_hash("${download_file_path_part}" "downloaded file" "The file may have been corrupted in transit. This can be caused by proxies. If you use a proxy, please set the HTTPS_PROXY and HTTP_PROXY environment variables to \"https://user:password@your-proxy-ip-address:port/\".\n") - get_filename_component(downloaded_file_dir "${downloaded_file_path}" DIRECTORY) - file(MAKE_DIRECTORY "${downloaded_file_dir}") - file(RENAME ${download_file_path_part} ${downloaded_file_path}) - set(download_success 1) - break() - endif() - endforeach(url) - else() - set(urls) - foreach(url IN LISTS vcpkg_download_distfile_URLS) - list(APPEND urls "--url=${url}") - endforeach() - if(NOT vcpkg_download_distfile_QUIET) - message(STATUS "Downloading ${vcpkg_download_distfile_URLS} -> ${vcpkg_download_distfile_FILENAME}...") - endif() - set(request_headers) - if(vcpkg_download_distfile_HEADERS) - foreach(header IN LISTS vcpkg_download_distfile_HEADERS) - list(APPEND request_headers "--header=${header}") - endforeach() - endif() - vcpkg_execute_in_download_mode( - COMMAND "$ENV{VCPKG_COMMAND}" x-download - "${downloaded_file_path}" - "${vcpkg_download_distfile_SHA512}" - ${urls} - ${request_headers} - --debug - --feature-flags=-manifests # there's a bug in vcpkg x-download when it finds a manifest-root - OUTPUT_VARIABLE output - ERROR_VARIABLE output - RESULT_VARIABLE failure - WORKING_DIRECTORY "${DOWNLOADS}" - ) - if(failure) - message("${output}") - set(download_success 0) - else() - set(download_success 1) - endif() + if(NOT arg_QUIET) + message(STATUS "Using ${downloaded_file_path}") endif() - if(NOT download_success) - message(FATAL_ERROR - " \n" - " Failed to download file.\n" - " If you use a proxy, please check your proxy setting. Possible causes are:\n" - " \n" - " 1. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable\n" - " to `https://address:port`. This is not correct, because `https://` prefix\n" - " claims the proxy is an HTTPS proxy, while your proxy (v2ray, shadowsocksr\n" - " , etc..) is an HTTP proxy. Try setting `http://address:port` to both\n" - " HTTP_PROXY and HTTPS_PROXY instead.\n" - " \n" - " 2. You are using Fiddler. Currently a bug (https://github.com/microsoft/vcpkg/issues/17752)\n" - " will set HTTPS_PROXY to `https://fiddler_address:port` which lead to problem 1 above.\n" - " Workaround is open Windows 10 Settings App, and search for Proxy Configuration page,\n" - " Change `http=address:port;https=address:port` to `address`, and fill the port number.\n" - " \n" - " 3. You proxy's remote server is out of service.\n" - " \n" - " In future vcpkg releases, if you are using Windows, you no longer need to set\n" - " HTTP(S)_PROXY environment variables. Vcpkg will simply apply Windows IE Proxy\n" - " Settings set by your proxy software. See (https://github.com/microsoft/vcpkg-tool/pull/49)\n" - " and (https://github.com/microsoft/vcpkg-tool/pull/77)\n" - " \n" - " Otherwise, please submit an issue at https://github.com/Microsoft/vcpkg/issues\n") + z_vcpkg_download_distfile_test_hash( + "${downloaded_file_path}" + "cached file" + "Please delete the file and retry if this file should be downloaded again." + ) + set("${out_var}" "${downloaded_file_path}" PARENT_SCOPE) + return() + endif() + + if(_VCPKG_DOWNLOAD_TOOL STREQUAL "ARIA2" AND NOT EXISTS "${downloaded_file_path}") + z_vcpkg_download_distfile_via_aria( + "${arg_FILENAME}" + "${arg_URLS}" + "${arg_HEADERS}" + "${arg_SHA512}" + "${arg_skip_sha512}" + ) + set("${out_var}" "${downloaded_file_path}" PARENT_SCOPE) + return() + endif() + + vcpkg_list(SET urls_param) + foreach(url IN LISTS arg_URLS) + vcpkg_list(APPEND urls_param "--url=${url}") + endforeach() + if(NOT vcpkg_download_distfile_QUIET) + message(STATUS "Downloading ${arg_URLS} -> ${arg_FILENAME}...") + endif() + + vcpkg_list(SET headers_param) + foreach(header IN LISTS arg_HEADERS) + list(APPEND headers_param "--header=${header}") + endforeach() + + if(arg_SKIP_SHA512) + vcpkg_list(SET sha512_param "--skip-sha512") + else() + vcpkg_list(SET sha512_param "--sha512=${arg_SHA512}") + endif() + + if(NOT EXISTS "${downloaded_file_path}" OR arg_ALWAYS_REDOWNLOAD) + vcpkg_execute_in_download_mode( + COMMAND "$ENV{VCPKG_COMMAND}" x-download + "${downloaded_file_path}" + ${sha512_param} + ${urls_param} + ${headers_param} + --debug + --feature-flags=-manifests # there's a bug in vcpkg x-download when it finds a manifest-root + OUTPUT_VARIABLE output + ERROR_VARIABLE output + RESULT_VARIABLE error_code + WORKING_DIRECTORY "${DOWNLOADS}" + ) + + if(NOT "${error_code}" EQUAL "0") + message("${output}") + z_vcpkg_download_distfile_show_proxy_and_fail("${error_code}") endif() endif() - set(${VAR} ${downloaded_file_path} PARENT_SCOPE) + + set("${out_var}" "${downloaded_file_path}" PARENT_SCOPE) endfunction() diff --git a/scripts/cmake/vcpkg_find_fortran.cmake b/scripts/cmake/vcpkg_find_fortran.cmake index ad790abb86..c504976292 100644 --- a/scripts/cmake/vcpkg_find_fortran.cmake +++ b/scripts/cmake/vcpkg_find_fortran.cmake @@ -7,27 +7,41 @@ Windows(x86/x64) Only: If not it will switch/enable MinGW gfortran ## Usage ```cmake -vcpkg_find_fortran() +vcpkg_find_fortran() +``` + +## Example +```cmake +vcpkg_find_fortran(fortran_args) +# ... +vcpkg_configure_cmake(... + OPTIONS + ${fortran_args} +) ``` #]===] -function(vcpkg_find_fortran additional_cmake_args_out) - set(ARGS_OUT) +function(vcpkg_find_fortran out_var) + if("${ARGC}" GREATER "1") + message(WARNING "${CMAKE_CURRENT_FUNCTION} was passed extra args: ${ARGN}") + endif() + + vcpkg_list(SET additional_cmake_args) + set(CMAKE_BINARY_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}") set(CMAKE_CURRENT_BINARY_DIR "${CMAKE_BINARY_DIR}") set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_BINARY_DIR}/Platform") include(CMakeDetermineFortranCompiler) - if(NOT CMAKE_Fortran_COMPILER AND NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE) - # This intentionally breaks users with a custom toolchain which do not have a Fortran compiler setup - # because they either need to use a port-overlay (for e.g. lapack), remove the toolchain for the port using fortran - # or setup fortran in their VCPKG_CHAINLOAD_TOOLCHAIN_FILE themselfs! + + if(NOT CMAKE_Fortran_COMPILER AND "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" STREQUAL "") + # If a user uses their own VCPKG_CHAINLOAD_TOOLCHAIN_FILE, they _must_ figure out fortran on their own. if(WIN32) message(STATUS "No Fortran compiler found on the PATH. Using MinGW gfortran!") # If no Fortran compiler is on the path we switch to use gfortan from MinGW within vcpkg - if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") - set(MINGW_PATH mingw32) - set(MACHINE_FLAG -m32) - vcpkg_acquire_msys(MSYS_ROOT + if("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "x86") + set(mingw_path mingw32) + set(machine_flag -m32) + vcpkg_acquire_msys(msys_root DIRECT_PACKAGES "https://repo.msys2.org/mingw/i686/mingw-w64-i686-gcc-fortran-10.2.0-1-any.pkg.tar.zst" ddbdaf9ea865181e16a0931b2ec88c2dcef8add34628e479c7b9de4fa2ccb22e09c7239442e58702e0acd3adabc920565e976984f2bcd90a3668bf7f48a245f1 @@ -62,10 +76,10 @@ function(vcpkg_find_fortran additional_cmake_args_out) "https://repo.msys2.org/mingw/i686/mingw-w64-i686-zstd-1.4.5-1-any.pkg.tar.zst" 68f431073717b59549ab0fd26be8df8afcb43f3dd85be2ffcbc7d1a629999eed924656a7fc3f50937b2e6605a5067542d016181106b7bc3408b89b268ced5d23 ) - elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") - set(MINGW_PATH mingw64) - set(MACHINE_FLAG -m64) - vcpkg_acquire_msys(MSYS_ROOT + elseif("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "x64") + set(mingw_path mingw64) + set(machine_flag -m64) + vcpkg_acquire_msys(msys_root DIRECT_PACKAGES "https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gcc-fortran-10.2.0-1-any.pkg.tar.zst" 0de02db791e978ae21577e675ee9676f741336c9a5ceb5614dbdfc793e2c1c4749b394f41362af7b069e970302fddf8c6772ebd8445fe1c360861606b1784b4d @@ -104,14 +118,16 @@ function(vcpkg_find_fortran additional_cmake_args_out) message(FATAL_ERROR "Unknown architecture '${VCPKG_TARGET_ARCHITECTURE}' for MinGW Fortran build!") endif() - set(MINGW_BIN "${MSYS_ROOT}/${MINGW_PATH}/bin") - vcpkg_add_to_path(PREPEND "${MINGW_BIN}") - list(APPEND ARGS_OUT -DCMAKE_GNUtoMS=ON - "-DCMAKE_Fortran_COMPILER=${MINGW_BIN}/gfortran.exe" - "-DCMAKE_C_COMPILER=${MINGW_BIN}/gcc.exe" - "-DCMAKE_Fortran_FLAGS_INIT:STRING= -mabi=ms ${MACHINE_FLAG} ${VCPKG_Fortran_FLAGS}") + set(mingw_bin "${msys_root}/${mingw_path}/bin") + vcpkg_add_to_path(PREPEND "${mingw_bin}") + vcpkg_list(APPEND additional_cmake_args + -DCMAKE_GNUtoMS=ON + "-DCMAKE_Fortran_COMPILER=${mingw_bin}/gfortran.exe" + "-DCMAKE_C_COMPILER=${mingw_bin}/gcc.exe" + "-DCMAKE_Fortran_FLAGS_INIT:STRING= -mabi=ms ${machine_flag} ${VCPKG_Fortran_FLAGS}") + # This is for private use by vcpkg-gfortran - set(vcpkg_find_fortran_MSYS_ROOT "${MSYS_ROOT}" PARENT_SCOPE) + set(vcpkg_find_fortran_MSYS_ROOT "${msys_root}" PARENT_SCOPE) set(VCPKG_USE_INTERNAL_Fortran TRUE PARENT_SCOPE) set(VCPKG_POLICY_SKIP_DUMPBIN_CHECKS enabled PARENT_SCOPE) set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/mingw.cmake" PARENT_SCOPE) # Switching to MinGW toolchain for Fortran @@ -127,5 +143,5 @@ function(vcpkg_find_fortran additional_cmake_args_out) message(FATAL_ERROR "Unable to find a Fortran compiler using 'CMakeDetermineFortranCompiler'. Please install one (e.g. gfortran) and make it available on the PATH!") endif() endif() - set(${additional_cmake_args_out} ${ARGS_OUT} PARENT_SCOPE) + set("${out_var}" "${additional_cmake_args}" PARENT_SCOPE) endfunction() diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index e6fbe785b5..0641aa2240 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -220,6 +220,44 @@ function(vcpkg_fixup_cmake_targets) file(WRITE ${MAIN_CMAKE} "${_contents}") endforeach() + if (VCPKG_TARGET_IS_OSX) + # see #16259 for details why this replacement is necessary. + file(GLOB targets_files "${RELEASE_SHARE}/*[Tt]argets.cmake") + if (targets_files STREQUAL "") + file(GLOB targets_files "${RELEASE_SHARE}/*[Cc]onfig.cmake") + endif() + foreach(targets_file IN LISTS targets_files) + file(READ "${targets_file}" targets_content) + string(REGEX MATCHALL "INTERFACE_LINK_LIBRARIES[^\n]*\n" library_contents "${targets_content}") + foreach(line IN LISTS library_contents) + set(fixed_line "${line}") + string(REGEX MATCHALL [[/[^ ;"]+/[^ ;"/]+\.framework]] frameworks "${line}") + foreach(framework IN LISTS frameworks) + if(NOT framework MATCHES [[^(.+)/(.+)\.framework$]]) + continue() + endif() + set(path "${CMAKE_MATCH_1}") + set(name "${CMAKE_MATCH_2}") + if(NOT DEFINED VCPKG_DETECTED_CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES) + set(_saved_buildtrees_dir "${CURRENT_BUILDTREES_DIR}") + set(CURRENT_BUILDTREES_DIR "${CURRENT_BUILDTREES_DIR}/get-cmake-vars") + z_vcpkg_get_cmake_vars(cmake_vars_file) + debug_message("Including cmake vars from: ${cmake_vars_file}") + include("${cmake_vars_file}") + set(VCPKG_DETECTED_CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${VCPKG_DETECTED_CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES}" PARENT_SCOPE) + set(CURRENT_BUILDTREES_DIR "${_saved_buildtrees_dir}") + endif() + list(FIND VCPKG_DETECTED_CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${path}" index) + if(NOT index EQUAL -1) + string(REPLACE "${framework}" "-framework ${name}" fixed_line "${fixed_line}") + endif() + endforeach() + string(REPLACE "${line}" "${fixed_line}" targets_content "${targets_content}") + endforeach() + file(WRITE "${targets_file}" "${targets_content}") + endforeach() + endif() + # Remove /debug// if it's empty. file(GLOB_RECURSE REMAINING_FILES "${DEBUG_SHARE}/*") if(NOT REMAINING_FILES) @@ -241,5 +279,3 @@ function(vcpkg_fixup_cmake_targets) file(WRITE ${CMAKE_FILE} "${_contents}") endforeach() endfunction() - - diff --git a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake index 3f37099a71..a9b9723e00 100644 --- a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake +++ b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake @@ -45,115 +45,122 @@ Still work in progress. If there are more cases which can be handled here feel f * [brotli](https://github.com/Microsoft/vcpkg/blob/master/ports/brotli/portfile.cmake) #]===] -function(vcpkg_fixup_pkgconfig_check_files pkg_cfg_cmd _file _config) - set(PATH_SUFFIX_DEBUG /debug) - set(PATH_SUFFIX_RELEASE) - set(PKGCONFIG_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_config}}/lib/pkgconfig") - set(PKGCONFIG_INSTALLED_SHARE_DIR "${CURRENT_INSTALLED_DIR}/share/pkgconfig") - set(PKGCONFIG_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}${PATH_SUFFIX_${_config}}/lib/pkgconfig") - set(PKGCONFIG_PACKAGES_SHARE_DIR "${CURRENT_PACKAGES_DIR}/share/pkgconfig") +function(z_vcpkg_fixup_pkgconfig_check_files file config) + set(path_suffix_debug /debug) + set(path_suffix_release "") if(DEFINED ENV{PKG_CONFIG_PATH}) - set(BACKUP_ENV_PKG_CONFIG_PATH "$ENV{PKG_CONFIG_PATH}") + set(backup_env_pkg_config_path "$ENV{PKG_CONFIG_PATH}") else() - unset(BACKUP_ENV_PKG_CONFIG_PATH) - endif() - if(DEFINED ENV{PKG_CONFIG_PATH} AND NOT ENV{PKG_CONFIG_PATH} STREQUAL "") - set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_INSTALLED_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}$ENV{PKG_CONFIG_PATH}") - else() - set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_INSTALLED_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_SHARE_DIR}") + unset(backup_env_pkg_config_path) endif() - # First make sure everything is ok with the package and its deps - get_filename_component(_package_name "${_file}" NAME_WLE) - debug_message("Checking package (${_config}): ${_package_name}") - execute_process(COMMAND "${pkg_cfg_cmd}" --print-errors --exists ${_package_name} - WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" - RESULT_VARIABLE _pkg_error_var - OUTPUT_VARIABLE _pkg_output - ERROR_VARIABLE _pkg_error_out - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE - ) - if(NOT _pkg_error_var EQUAL 0) - message(STATUS "pkg_cfg_cmd call with:${pkg_cfg_cmd} --exists ${_package_name} failed") - message(STATUS "ENV{PKG_CONFIG_PATH}:$ENV{PKG_CONFIG_PATH}") - message(STATUS "pkg-config call failed with error code:${_pkg_error_var}") - message(STATUS "pkg-config output:${_pkg_output}") - message(FATAL_ERROR "pkg-config error output:${_pkg_error_out}") - else() - debug_message("pkg-config returned:${_pkg_error_var}") - debug_message("pkg-config output:${_pkg_output}") - debug_message("pkg-config error output:${_pkg_error_out}") + vcpkg_list(SET pkg_config_path + "${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_config}}/lib/pkgconfig" + "${CURRENT_INSTALLED_DIR}/share/pkgconfig" + "${CURRENT_PACKAGES_DIR}${PATH_SUFFIX_${_config}}/lib/pkgconfig" + "${CURRENT_PACKAGES_DIR}/share/pkgconfig" + ) + if(DEFINED ENV{PKG_CONFIG_PATH} AND NOT ENV{PKG_CONFIG_PATH} STREQUAL "") + vcpkg_list(APPEND pkg_config_path "$ENV{PKG_CONFIG_PATH}") endif() - if(DEFINED BACKUP_ENV_PKG_CONFIG_PATH) - set(ENV{PKG_CONFIG_PATH} "${BACKUP_ENV_PKG_CONFIG_PATH}") + vcpkg_list(JOIN pkg_config_path "${VCPKG_PATH_SEPARATOR}" pkg_config_path) + set(ENV{PKG_CONFIG_PATH} "${pkg_config_path}") + + # First make sure everything is ok with the package and its deps + cmake_path(GET file STEM package_name) + debug_message("Checking package (${config}): ${package_name}") + execute_process( + COMMAND "${PKGCONFIG}" --print-errors --exists "${package_name}" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + RESULT_VARIABLE error_var + OUTPUT_VARIABLE output + ERROR_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) + if(NOT "${error_var}" EQUAL "0") + message(FATAL_ERROR "${PKGCONFIG} --exists ${package_name} failed with error code: ${error_var} + ENV{PKG_CONFIG_PATH}: \"$ENV{PKG_CONFIG_PATH}\" + output: ${output}" + ) + else() + debug_message("pkg-config --exists ${package_name} output: ${output}") + endif() + if(DEFINED backup_env_pkg_config_path) + set(ENV{PKG_CONFIG_PATH} "${backup_env_pkg_config_path}") else() unset(ENV{PKG_CONFIG_PATH}) endif() endfunction() function(vcpkg_fixup_pkgconfig) - # parse parameters such that semicolons in options arguments to COMMAND don't get erased - cmake_parse_arguments(PARSE_ARGV 0 _vfpkg "SKIP_CHECK" "" "RELEASE_FILES;DEBUG_FILES;SYSTEM_LIBRARIES;SYSTEM_PACKAGES;IGNORE_FLAGS") + cmake_parse_arguments(PARSE_ARGV 0 arg + "SKIP_CHECK" + "" + "RELEASE_FILES;DEBUG_FILES;SYSTEM_LIBRARIES;SYSTEM_PACKAGES;IGNORE_FLAGS" + ) - if(_vfpkg_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "vcpkg_fixup_pkgconfig() was passed extra arguments: ${_vfct_UNPARSED_ARGUMENTS}") + if(DEFINED arg_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}") endif() - if((DEFINED _vfpkg_RELEASE_FILES AND NOT DEFINED _vfpkg_DEBUG_FILES) OR (NOT DEFINED _vfpkg_RELEASE_FILES AND DEFINED _vfpkg_DEBUG_FILES)) - message(FATAL_ERROR "vcpkg_fixup_pkgconfig() requires both or neither of DEBUG_FILES and RELEASE_FILES") + if(DEFINED arg_RELEASE_FILES AND NOT DEFINED arg_DEBUG_FILES) + message(FATAL_ERROR "DEBUG_FILES must be specified if RELEASE_FILES was specified.") + endif() + if(NOT DEFINED arg_RELEASE_FILES AND DEFINED arg_DEBUG_FILES) + message(FATAL_ERROR "RELEASE_FILES must be specified if DEBUG_FILES was specified.") endif() - if(NOT DEFINED _vfpkg_RELEASE_FILES) - file(GLOB_RECURSE _vfpkg_RELEASE_FILES "${CURRENT_PACKAGES_DIR}/**/*.pc") - file(GLOB_RECURSE _vfpkg_DEBUG_FILES "${CURRENT_PACKAGES_DIR}/debug/**/*.pc") - if(_vfpkg_DEBUG_FILES) - list(REMOVE_ITEM _vfpkg_RELEASE_FILES ${_vfpkg_DEBUG_FILES}) - endif() + if(NOT DEFINED arg_RELEASE_FILES) + file(GLOB_RECURSE arg_RELEASE_FILES "${CURRENT_PACKAGES_DIR}/**/*.pc") + file(GLOB_RECURSE arg_DEBUG_FILES "${CURRENT_PACKAGES_DIR}/debug/**/*.pc") + foreach(debug_file IN LISTS arg_DEBUG_FILES) + vcpkg_list(REMOVE_ITEM arg_RELEASE_FILES "${debug_file}") + endforeach() endif() vcpkg_find_acquire_program(PKGCONFIG) debug_message("Using pkg-config from: ${PKGCONFIG}") - #Absolute Unix like paths - string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}") - string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}") + string(REGEX REPLACE "^([a-zA-Z]):/" [[/\1/]] unix_packages_dir "${CURRENT_PACKAGES_DIR}") + string(REGEX REPLACE "^([a-zA-Z]):/" [[/\1/]] unix_installed_dir "${CURRENT_INSTALLED_DIR}") - foreach(CONFIG RELEASE DEBUG) - debug_message("${CONFIG} Files: ${_vfpkg_${CONFIG}_FILES}") - if(VCPKG_BUILD_TYPE STREQUAL "debug" AND CONFIG STREQUAL "RELEASE") + foreach(config IN ITEMS RELEASE DEBUG) + debug_message("${config} Files: ${arg_${config}_FILES}") + if("${VCPKG_BUILD_TYPE}" STREQUAL "debug" AND "${config}" STREQUAL "RELEASE") continue() endif() - if(VCPKG_BUILD_TYPE STREQUAL "release" AND CONFIG STREQUAL "DEBUG") + if("${VCPKG_BUILD_TYPE}" STREQUAL "release" AND "${config}" STREQUAL "DEBUG") continue() endif() - foreach(_file ${_vfpkg_${CONFIG}_FILES}) - message(STATUS "Fixing pkgconfig file: ${_file}") - get_filename_component(PKG_LIB_SEARCH_PATH "${_file}" DIRECTORY) - if(CONFIG STREQUAL "DEBUG") - file(RELATIVE_PATH RELATIVE_PC_PATH "${PKG_LIB_SEARCH_PATH}" "${CURRENT_PACKAGES_DIR}/debug/") + foreach(file IN LISTS "arg_${config}_FILES") + message(STATUS "Fixing pkgconfig file: ${file}") + cmake_path(GET file PARENT_PATH pkg_lib_search_path) + if("${config}" STREQUAL "DEBUG") + set(relative_pc_path "${CURRENT_PACKAGES_DIR}/debug") + cmake_path(RELATIVE_PATH relative_pc_path BASE_DIRECTORY "${pkg_lib_search_path}") else() - file(RELATIVE_PATH RELATIVE_PC_PATH "${PKG_LIB_SEARCH_PATH}" "${CURRENT_PACKAGES_DIR}") + set(relative_pc_path "${CURRENT_PACKAGES_DIR}") + cmake_path(RELATIVE_PATH relative_pc_path BASE_DIRECTORY "${pkg_lib_search_path}") endif() - # strip trailing slash - string(REGEX REPLACE "/$" "" RELATIVE_PC_PATH "${RELATIVE_PC_PATH}") #Correct *.pc file - file(READ "${_file}" _contents) - string(REPLACE "${CURRENT_PACKAGES_DIR}" "\${prefix}" _contents "${_contents}") - string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${prefix}" _contents "${_contents}") - string(REPLACE "${_VCPKG_PACKAGES_DIR}" "\${prefix}" _contents "${_contents}") - string(REPLACE "${_VCPKG_INSTALLED_DIR}" "\${prefix}" _contents "${_contents}") - string(REGEX REPLACE "(^|\n)prefix[\t ]*=[^\n]*" "" _contents "${_contents}") - if(CONFIG STREQUAL "DEBUG") - string(REPLACE "}/debug" "}" _contents "${_contents}") - # Prefix points at the debug subfolder - string(REPLACE "\${prefix}/include" "\${prefix}/../include" _contents "${_contents}") - string(REPLACE "\${prefix}/share" "\${prefix}/../share" _contents "${_contents}") + file(READ "${file}" contents) + + string(REPLACE "${CURRENT_PACKAGES_DIR}" [[${prefix}]] contents "${contents}") + string(REPLACE "${CURRENT_INSTALLED_DIR}" [[${prefix}]] contents "${contents}") + string(REPLACE "${unix_packages_dir}" [[${prefix}]] contents "${contents}") + string(REPLACE "${unix_installed_dir}" [[${prefix}]] contents "${contents}") + + string(REGEX REPLACE "(^|\n)prefix[\t ]*=[^\n]*" "" contents "${contents}") + if("${config}" STREQUAL "DEBUG") + # prefix points at the debug subfolder + string(REPLACE [[${prefix}/debug]] [[${prefix}]] contents "${contents}") + string(REPLACE [[${prefix}/include]] [[${prefix}/../include]] contents "${contents}") + string(REPLACE [[${prefix}/share]] [[${prefix}/../share]] contents "${contents}") endif() - string(REGEX REPLACE " -L(\\\${[^}]*}[^ \n\t]*)" " -L\"\\1\"" _contents "${_contents}") - string(REGEX REPLACE " -I(\\\${[^}]*}[^ \n\t]*)" " -I\"\\1\"" _contents "${_contents}") - string(REGEX REPLACE " -l(\\\${[^}]*}[^ \n\t]*)" " -l\"\\1\"" _contents "${_contents}") + # quote -L, -I, and -l paths starting with `${blah}` + string(REGEX REPLACE " -([LIl])(\\\${[^}]*}[^ \n\t]*)" [[ -\1"\2"]] contents "${contents}") # This section fuses XYZ.private and XYZ according to VCPKG_LIBRARY_LINKAGE # # Pkgconfig searches Requires.private transitively for Cflags in the dynamic case, @@ -161,33 +168,51 @@ function(vcpkg_fixup_pkgconfig) # # Once this transformation is complete, users of vcpkg should never need to pass # --static. - if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") - # Libs comes before Libs.private - string(REGEX REPLACE "(^|\n)(Libs: *[^\n]*)(.*)\nLibs.private:( *[^\n]*)" "\\1\\2\\4\\3" _contents "${_contents}") - # Libs.private comes before Libs - string(REGEX REPLACE "(^|\n)Libs.private:( *[^\n]*)(.*\nLibs: *[^\n]*)" "\\3\\2" _contents "${_contents}") - # Only Libs.private - string(REGEX REPLACE "(^|\n)Libs.private: *" "\\1Libs: " _contents "${_contents}") - # Requires comes before Requires.private - string(REGEX REPLACE "(^|\n)(Requires: *[^\n]*)(.*)\nRequires.private:( *[^\n]*)" "\\1\\2\\4\\3" _contents "${_contents}") - # Requires.private comes before Requires - string(REGEX REPLACE "(^|\n)Requires.private:( *[^\n]*)(.*\nRequires: *[^\n]*)" "\\3\\2" _contents "${_contents}") - # Only Requires.private - string(REGEX REPLACE "(^|\n)Requires.private: *" "\\1Requires: " _contents "${_contents}") + if("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "static") + # how this works: + # we want to transform: + # Libs: $1 + # Libs.private: $2 + # into + # Libs: $1 $2 + # and the same thing for Requires and Requires.private + + set(libs_line "") + set(requires_line "") + if("${contents}" MATCHES "Libs: *([^\n]*)") + string(APPEND libs_line " ${CMAKE_MATCH_1}") + endif() + if("${contents}" MATCHES "Libs.private: *([^\n]*)") + string(APPEND libs_line " ${CMAKE_MATCH_1}") + endif() + if("${contents}" MATCHES "Requires: *([^\n]*)") + string(APPEND requires_line " ${CMAKE_MATCH_1}") + endif() + if("${contents}" MATCHES "Requires.private: *([^\n]*)") + string(APPEND requires_line " ${CMAKE_MATCH_1}") + endif() + + string(REGEX REPLACE "(^|\n)(Requires|Libs)(\\.private)?:[^\n]*\n" [[\1]] contents "${contents}") + + if(NOT "${libs_line}" STREQUAL "") + string(APPEND contents "Libs:${libs_line}\n") + endif() + if(NOT "${requires_line}" STREQUAL "") + string(APPEND contents "Requires:${requires_line}\n") + endif() endif() - file(WRITE "${_file}" "prefix=\${pcfiledir}/${RELATIVE_PC_PATH}\n${_contents}") - unset(PKG_LIB_SEARCH_PATH) + file(WRITE "${file}" "prefix=\${pcfiledir}/${relative_pc_path}\n${contents}") endforeach() - if(NOT _vfpkg_SKIP_CHECK) # The check can only run after all files have been corrected! - foreach(_file ${_vfpkg_${CONFIG}_FILES}) - vcpkg_fixup_pkgconfig_check_files("${PKGCONFIG}" "${_file}" "${CONFIG}") + if(NOT arg_SKIP_CHECK) # The check can only run after all files have been corrected! + foreach(file IN LISTS "arg_${config}_FILES") + z_vcpkg_fixup_pkgconfig_check_files("${PKGCONFIG}" "${file}" "${config}") endforeach() endif() endforeach() debug_message("Fixing pkgconfig --- finished") - set(VCPKG_FIXUP_PKGCONFIG_CALLED TRUE CACHE INTERNAL "See below" FORCE) + set(Z_VCPKG_FIXUP_PKGCONFIG_CALLED TRUE CACHE INTERNAL "See below" FORCE) # Variable to check if this function has been called! # Theoreotically vcpkg could look for *.pc files and automatically call this function # or check if this function has been called if *.pc files are detected. diff --git a/scripts/cmake/vcpkg_from_git.cmake b/scripts/cmake/vcpkg_from_git.cmake index ac46e32cc1..0a5fdb6225 100644 --- a/scripts/cmake/vcpkg_from_git.cmake +++ b/scripts/cmake/vcpkg_from_git.cmake @@ -26,6 +26,11 @@ The url of the git repository. ### REF The git sha of the commit to download. +### FETCH_REF +The git branch to fetch in non-HEAD mode. After this is fetched, +then `REF` is checked out. This is useful in cases where the git server +does not allow checking out non-advertised objects. + ### HEAD_REF The git branch to use when the package is requested to be built from the latest sources. @@ -44,12 +49,10 @@ Relative paths are based on the port directory. * [fdlibm](https://github.com/Microsoft/vcpkg/blob/master/ports/fdlibm/portfile.cmake) #]===] -include(vcpkg_execute_in_download_mode) - function(vcpkg_from_git) cmake_parse_arguments(PARSE_ARGV 0 "arg" "" - "OUT_SOURCE_PATH;URL;REF;HEAD_REF;TAG" + "OUT_SOURCE_PATH;URL;REF;FETCH_REF;HEAD_REF;TAG" "PATCHES" ) @@ -62,26 +65,41 @@ function(vcpkg_from_git) if(NOT DEFINED arg_OUT_SOURCE_PATH) - message(FATAL_ERROR "OUT_SOURCE_PATH must be specified.") + message(FATAL_ERROR "OUT_SOURCE_PATH must be specified") endif() if(NOT DEFINED arg_URL) - message(FATAL_ERROR "The git url must be specified") + message(FATAL_ERROR "URL must be specified") endif() if(NOT DEFINED arg_REF AND NOT DEFINED arg_HEAD_REF) - message(FATAL_ERROR "At least one of REF or HEAD_REF must be specified.") + message(FATAL_ERROR "At least one of REF or HEAD_REF must be specified") + endif() + if(DEFINED arg_FETCH_REF AND NOT DEFINED arg_REF) + message(FATAL_ERROR "REF must be specified if FETCH_REF is specified") endif() - set(working_directory_param "") - set(ref_to_use "${arg_REF}") + vcpkg_list(SET git_fetch_shallow_param --depth 1) + vcpkg_list(SET extract_working_directory_param) + set(git_working_directory "${DOWNLOADS}/git-tmp") if(VCPKG_USE_HEAD_VERSION) if(DEFINED arg_HEAD_REF) - set(working_directory_param "WORKING_DIRECTORY" "${CURRENT_BUILDTREES_DIR}/src/head") + vcpkg_list(SET working_directory_param "WORKING_DIRECTORY" "${CURRENT_BUILDTREES_DIR}/src/head") + vcpkg_list(SET git_fetch_shallow_param --depth 1) set(ref_to_use "${arg_HEAD_REF}") + set(git_working_directory "${CURRENT_BUILDTREES_DIR}/src/git-tmp") else() message(STATUS "Package does not specify HEAD_REF. Falling back to non-HEAD version.") endif() - elseif(NOT DEFINED arg_REF) - message(FATAL_ERROR "Package does not specify REF. It must be built using --head.") + else() + if(NOT DEFINED arg_REF) + message(FATAL_ERROR "Package does not specify REF. It must be built using --head.") + endif() + + if(DEFINED arg_FETCH_REF) + set(ref_to_use "${arg_FETCH_REF}") + vcpkg_list(SET git_fetch_shallow_param) + else() + set(ref_to_use "${arg_REF}") + endif() endif() string(REPLACE "/" "_-" sanitized_ref "${ref_to_use}") @@ -98,40 +116,54 @@ function(vcpkg_from_git) # Note: git init is safe to run multiple times vcpkg_execute_required_process( ALLOW_IN_DOWNLOAD_MODE - COMMAND "${GIT}" init git-tmp - WORKING_DIRECTORY "${DOWNLOADS}" + COMMAND "${GIT}" init "${git_working_directory}" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" LOGNAME "git-init-${TARGET_TRIPLET}" ) vcpkg_execute_required_process( ALLOW_IN_DOWNLOAD_MODE - COMMAND "${GIT}" fetch "${arg_URL}" "${ref_to_use}" --depth 1 -n - WORKING_DIRECTORY "${DOWNLOADS}/git-tmp" + COMMAND "${GIT}" fetch "${arg_URL}" "${ref_to_use}" ${git_fetch_shallow_param} -n + WORKING_DIRECTORY "${git_working_directory}" LOGNAME "git-fetch-${TARGET_TRIPLET}" ) - vcpkg_execute_in_download_mode( - COMMAND "${GIT}" rev-parse FETCH_HEAD - OUTPUT_VARIABLE rev_parse_head - ERROR_VARIABLE rev_parse_head - RESULT_VARIABLE error_code - WORKING_DIRECTORY "${DOWNLOADS}/git-tmp" - ) - if(error_code) - message(FATAL_ERROR "unable to determine FETCH_HEAD after fetching git repository") - endif() - string(STRIP "${rev_parse_head}" rev_parse_head) + if(VCPKG_USE_HEAD_VERSION) - set(VCPKG_HEAD_VERSION "${rev_parse_head}" PARENT_SCOPE) - elseif(NOT rev_parse_head STREQUAL arg_REF) - message(FATAL_ERROR "REF (${arg_REF}) does not match FETCH_HEAD (${rev_parse_head}) - [Expected : ( ${arg_REF} )]) - [ Actual : ( ${rev_parse_head} )]" + vcpkg_execute_in_download_mode( + COMMAND "${GIT}" rev-parse FETCH_HEAD + OUTPUT_VARIABLE rev_parse_ref + ERROR_VARIABLE rev_parse_ref + RESULT_VARIABLE error_code + WORKING_DIRECTORY "${git_working_directory}" ) + if(error_code) + message(FATAL_ERROR "unable to determine FETCH_HEAD after fetching git repository") + endif() + string(STRIP "${rev_parse_ref}" rev_parse_ref) + set(VCPKG_HEAD_VERSION "${rev_parse_ref}" PARENT_SCOPE) + else() + vcpkg_execute_in_download_mode( + COMMAND "${GIT}" rev-parse "${arg_REF}" + OUTPUT_VARIABLE rev_parse_ref + ERROR_VARIABLE rev_parse_ref + RESULT_VARIABLE error_code + WORKING_DIRECTORY "${git_working_directory}" + ) + if(error_code) + message(FATAL_ERROR "unable to rev-parse ${arg_REF} after fetching git repository") + endif() + string(STRIP "${rev_parse_ref}" rev_parse_ref) + if(NOT "${rev_parse_ref}" STREQUAL "${arg_REF}") + message(FATAL_ERROR "REF (${arg_REF}) does not match rev-parse'd reference (${rev_parse_ref}) + [Expected : ( ${arg_REF} )]) + [ Actual : ( ${rev_parse_ref} )]" + ) + endif() endif() file(MAKE_DIRECTORY "${DOWNLOADS}/temp") vcpkg_execute_required_process( ALLOW_IN_DOWNLOAD_MODE - COMMAND "${GIT}" archive "${rev_parse_head}" -o "${temp_archive}" + COMMAND "${GIT}" archive "${rev_parse_ref}" -o "${temp_archive}" WORKING_DIRECTORY "${DOWNLOADS}/git-tmp" LOGNAME git-archive ) @@ -146,7 +178,7 @@ function(vcpkg_from_git) REF "${sanitized_ref}" PATCHES ${arg_PATCHES} NO_REMOVE_ONE_LEVEL - ${working_directory_param} + ${extract_working_directory_param} ) set("${arg_OUT_SOURCE_PATH}" "${SOURCE_PATH}" PARENT_SCOPE) diff --git a/scripts/get_cmake_vars/CMakeLists.txt b/scripts/get_cmake_vars/CMakeLists.txt index 084042fb11..1b2e1e561f 100644 --- a/scripts/get_cmake_vars/CMakeLists.txt +++ b/scripts/get_cmake_vars/CMakeLists.txt @@ -29,6 +29,8 @@ foreach(_lang IN LISTS VCPKG_LANGUAGES) list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_${_lang}_STANDARD) list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_${_lang}_COMPILE_FEATURES) list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_${_lang}_EXTENSION) + list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_${_lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES) + # Probably never required since implicit. #list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_${_lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES) #list(APPEND VCPKG_DEFAULT_VARS_TO_CHECK CMAKE_${_lang}_IMPLICIT_INCLUDE_DIRECTORIES) diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 03547edff9..e33fa58657 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -1,8 +1,64 @@ -# rebuild: 1 cmake_minimum_required(VERSION 3.21) set(SCRIPTS "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Location to stored scripts") +list(APPEND CMAKE_MODULE_PATH "${SCRIPTS}/cmake") +include("${SCRIPTS}/cmake/execute_process.cmake") +include("${SCRIPTS}/cmake/vcpkg_acquire_msys.cmake") +include("${SCRIPTS}/cmake/vcpkg_add_to_path.cmake") +include("${SCRIPTS}/cmake/vcpkg_apply_patches.cmake") +include("${SCRIPTS}/cmake/vcpkg_build_cmake.cmake") +include("${SCRIPTS}/cmake/vcpkg_build_make.cmake") +include("${SCRIPTS}/cmake/vcpkg_build_msbuild.cmake") +include("${SCRIPTS}/cmake/vcpkg_build_ninja.cmake") +include("${SCRIPTS}/cmake/vcpkg_build_nmake.cmake") +include("${SCRIPTS}/cmake/vcpkg_build_qmake.cmake") +include("${SCRIPTS}/cmake/vcpkg_buildpath_length_warning.cmake") +include("${SCRIPTS}/cmake/vcpkg_check_features.cmake") +include("${SCRIPTS}/cmake/vcpkg_check_linkage.cmake") +include("${SCRIPTS}/cmake/vcpkg_clean_executables_in_bin.cmake") +include("${SCRIPTS}/cmake/vcpkg_clean_msbuild.cmake") +include("${SCRIPTS}/cmake/vcpkg_configure_cmake.cmake") +include("${SCRIPTS}/cmake/vcpkg_configure_gn.cmake") +include("${SCRIPTS}/cmake/vcpkg_configure_make.cmake") +include("${SCRIPTS}/cmake/vcpkg_configure_meson.cmake") +include("${SCRIPTS}/cmake/vcpkg_configure_qmake.cmake") +include("${SCRIPTS}/cmake/vcpkg_copy_pdbs.cmake") +include("${SCRIPTS}/cmake/vcpkg_copy_tool_dependencies.cmake") +include("${SCRIPTS}/cmake/vcpkg_copy_tools.cmake") +include("${SCRIPTS}/cmake/vcpkg_download_distfile.cmake") +include("${SCRIPTS}/cmake/vcpkg_execute_build_process.cmake") +include("${SCRIPTS}/cmake/vcpkg_execute_required_process.cmake") +include("${SCRIPTS}/cmake/vcpkg_execute_required_process_repeat.cmake") +include("${SCRIPTS}/cmake/vcpkg_extract_source_archive.cmake") +include("${SCRIPTS}/cmake/vcpkg_extract_source_archive_ex.cmake") +include("${SCRIPTS}/cmake/vcpkg_fail_port_install.cmake") +include("${SCRIPTS}/cmake/vcpkg_find_acquire_program.cmake") +include("${SCRIPTS}/cmake/vcpkg_fixup_cmake_targets.cmake") +include("${SCRIPTS}/cmake/vcpkg_fixup_pkgconfig.cmake") +include("${SCRIPTS}/cmake/vcpkg_from_bitbucket.cmake") +include("${SCRIPTS}/cmake/vcpkg_from_git.cmake") +include("${SCRIPTS}/cmake/vcpkg_from_github.cmake") +include("${SCRIPTS}/cmake/vcpkg_from_gitlab.cmake") +include("${SCRIPTS}/cmake/vcpkg_from_sourceforge.cmake") +include("${SCRIPTS}/cmake/vcpkg_get_program_files_platform_bitness.cmake") +include("${SCRIPTS}/cmake/vcpkg_get_windows_sdk.cmake") +include("${SCRIPTS}/cmake/vcpkg_install_cmake.cmake") +include("${SCRIPTS}/cmake/vcpkg_install_gn.cmake") +include("${SCRIPTS}/cmake/vcpkg_install_make.cmake") +include("${SCRIPTS}/cmake/vcpkg_install_meson.cmake") +include("${SCRIPTS}/cmake/vcpkg_install_msbuild.cmake") +include("${SCRIPTS}/cmake/vcpkg_install_nmake.cmake") +include("${SCRIPTS}/cmake/vcpkg_install_qmake.cmake") +include("${SCRIPTS}/cmake/vcpkg_list.cmake") +include("${SCRIPTS}/cmake/vcpkg_minimum_required.cmake") +include("${SCRIPTS}/cmake/vcpkg_replace_string.cmake") +include("${SCRIPTS}/cmake/vcpkg_test_cmake.cmake") + +include("${SCRIPTS}/cmake/z_vcpkg_apply_patches.cmake") +include("${SCRIPTS}/cmake/z_vcpkg_forward_output_variable.cmake") include("${SCRIPTS}/cmake/z_vcpkg_function_arguments.cmake") +include("${SCRIPTS}/cmake/z_vcpkg_get_cmake_vars.cmake") +include("${SCRIPTS}/cmake/z_vcpkg_prettify_command_line.cmake") function(debug_message) if(PORT_DEBUG) @@ -24,9 +80,7 @@ else() set(Z_VCPKG_BACKCOMPAT_MESSAGE_LEVEL "WARNING") endif() -list(APPEND CMAKE_MODULE_PATH "${SCRIPTS}/cmake") -include("${SCRIPTS}/cmake/vcpkg_minimum_required.cmake") -vcpkg_minimum_required(VERSION 2021-07-16) +vcpkg_minimum_required(VERSION 2021-08-03) file(TO_CMAKE_PATH "${BUILDTREES_DIR}" BUILDTREES_DIR) file(TO_CMAKE_PATH "${PACKAGES_DIR}" PACKAGES_DIR) @@ -82,61 +136,6 @@ if(CMD MATCHES "^BUILD$") set(TRIPLET_SYSTEM_ARCH "${VCPKG_TARGET_ARCHITECTURE}") include("${SCRIPTS}/cmake/vcpkg_common_definitions.cmake") - include("${SCRIPTS}/cmake/execute_process.cmake") - include("${SCRIPTS}/cmake/vcpkg_acquire_msys.cmake") - include("${SCRIPTS}/cmake/vcpkg_add_to_path.cmake") - include("${SCRIPTS}/cmake/vcpkg_apply_patches.cmake") - include("${SCRIPTS}/cmake/vcpkg_build_cmake.cmake") - include("${SCRIPTS}/cmake/vcpkg_build_make.cmake") - include("${SCRIPTS}/cmake/vcpkg_build_msbuild.cmake") - include("${SCRIPTS}/cmake/vcpkg_build_ninja.cmake") - include("${SCRIPTS}/cmake/vcpkg_build_nmake.cmake") - include("${SCRIPTS}/cmake/vcpkg_build_qmake.cmake") - include("${SCRIPTS}/cmake/vcpkg_buildpath_length_warning.cmake") - include("${SCRIPTS}/cmake/vcpkg_check_features.cmake") - include("${SCRIPTS}/cmake/vcpkg_check_linkage.cmake") - include("${SCRIPTS}/cmake/vcpkg_clean_executables_in_bin.cmake") - include("${SCRIPTS}/cmake/vcpkg_clean_msbuild.cmake") - include("${SCRIPTS}/cmake/vcpkg_configure_cmake.cmake") - include("${SCRIPTS}/cmake/vcpkg_configure_gn.cmake") - include("${SCRIPTS}/cmake/vcpkg_configure_make.cmake") - include("${SCRIPTS}/cmake/vcpkg_configure_meson.cmake") - include("${SCRIPTS}/cmake/vcpkg_configure_qmake.cmake") - include("${SCRIPTS}/cmake/vcpkg_copy_pdbs.cmake") - include("${SCRIPTS}/cmake/vcpkg_copy_tool_dependencies.cmake") - include("${SCRIPTS}/cmake/vcpkg_copy_tools.cmake") - include("${SCRIPTS}/cmake/vcpkg_download_distfile.cmake") - include("${SCRIPTS}/cmake/vcpkg_execute_build_process.cmake") - include("${SCRIPTS}/cmake/vcpkg_execute_required_process.cmake") - include("${SCRIPTS}/cmake/vcpkg_execute_required_process_repeat.cmake") - include("${SCRIPTS}/cmake/vcpkg_extract_source_archive.cmake") - include("${SCRIPTS}/cmake/vcpkg_extract_source_archive_ex.cmake") - include("${SCRIPTS}/cmake/vcpkg_fail_port_install.cmake") - include("${SCRIPTS}/cmake/vcpkg_find_acquire_program.cmake") - include("${SCRIPTS}/cmake/vcpkg_fixup_cmake_targets.cmake") - include("${SCRIPTS}/cmake/vcpkg_fixup_pkgconfig.cmake") - include("${SCRIPTS}/cmake/vcpkg_from_bitbucket.cmake") - include("${SCRIPTS}/cmake/vcpkg_from_git.cmake") - include("${SCRIPTS}/cmake/vcpkg_from_github.cmake") - include("${SCRIPTS}/cmake/vcpkg_from_gitlab.cmake") - include("${SCRIPTS}/cmake/vcpkg_from_sourceforge.cmake") - include("${SCRIPTS}/cmake/vcpkg_get_program_files_platform_bitness.cmake") - include("${SCRIPTS}/cmake/vcpkg_get_windows_sdk.cmake") - include("${SCRIPTS}/cmake/vcpkg_install_cmake.cmake") - include("${SCRIPTS}/cmake/vcpkg_install_gn.cmake") - include("${SCRIPTS}/cmake/vcpkg_install_make.cmake") - include("${SCRIPTS}/cmake/vcpkg_install_meson.cmake") - include("${SCRIPTS}/cmake/vcpkg_install_msbuild.cmake") - include("${SCRIPTS}/cmake/vcpkg_install_nmake.cmake") - include("${SCRIPTS}/cmake/vcpkg_install_qmake.cmake") - include("${SCRIPTS}/cmake/vcpkg_list.cmake") - include("${SCRIPTS}/cmake/vcpkg_replace_string.cmake") - include("${SCRIPTS}/cmake/vcpkg_test_cmake.cmake") - - include("${SCRIPTS}/cmake/z_vcpkg_apply_patches.cmake") - include("${SCRIPTS}/cmake/z_vcpkg_forward_output_variable.cmake") - include("${SCRIPTS}/cmake/z_vcpkg_get_cmake_vars.cmake") - include("${SCRIPTS}/cmake/z_vcpkg_prettify_command_line.cmake") include("${CURRENT_PORT_DIR}/portfile.cmake") if(DEFINED PORT) @@ -169,13 +168,12 @@ elseif(CMD MATCHES "^CREATE$") message(STATUS "Using pre-downloaded: ${NATIVE_DOWNLOAD_PATH}") message(STATUS "If this is not desired, delete the file and ${NATIVE_PORT_PATH}") else() - include(vcpkg_download_distfile) - set(_VCPKG_INTERNAL_NO_HASH_CHECK ON) - vcpkg_download_distfile(ARCHIVE - URLS "${URL}" - FILENAME "${FILENAME}" - ) - set(_VCPKG_INTERNAL_NO_HASH_CHECK OFF) + message(STATUS "Downloading ${URL} -> ${FILENAME}...") + file(DOWNLOAD "${URL}" "${DOWNLOAD_PATH}" STATUS download_status) + list(GET download_status 0 status_code) + if(NOT "${download_status}" EQUAL "0") + message(FATAL_ERROR "Downloading ${URL}... Failed. Status: ${download_status}") + endif() endif() file(SHA512 "${DOWNLOAD_PATH}" SHA512) diff --git a/versions/baseline.json b/versions/baseline.json index 94f34acba5..28551738f9 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6334,7 +6334,7 @@ }, "tinyfiledialogs": { "baseline": "3.8.8", - "port-version": 1 + "port-version": 2 }, "tinygltf": { "baseline": "2020-07-28", @@ -6617,8 +6617,8 @@ "port-version": 0 }, "vcpkg-cmake-config": { - "baseline": "2021-05-22", - "port-version": 1 + "baseline": "2021-08-11", + "port-version": 0 }, "vcpkg-gfortran": { "baseline": "3", diff --git a/versions/t-/tinyfiledialogs.json b/versions/t-/tinyfiledialogs.json index d7b0b5fcdf..31ef037fba 100644 --- a/versions/t-/tinyfiledialogs.json +++ b/versions/t-/tinyfiledialogs.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "abb5795ae7f012d210a4d98e4f072dea1b94c97a", + "version": "3.8.8", + "port-version": 2 + }, { "git-tree": "3959a47c7d93ca7db6e2022553b1d3427970cecf", "version-semver": "3.8.8", diff --git a/versions/v-/vcpkg-cmake-config.json b/versions/v-/vcpkg-cmake-config.json index 1a528ef23c..affac6bbe9 100644 --- a/versions/v-/vcpkg-cmake-config.json +++ b/versions/v-/vcpkg-cmake-config.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b3abb12ba8ab43770aea4e5a8d4915319bd295ee", + "version-date": "2021-08-11", + "port-version": 0 + }, { "git-tree": "330cc51bc99c6b71ed5fb51901f6f838684015a5", "version-date": "2021-05-22",