diff options
28 files changed, 227 insertions, 171 deletions
diff --git a/docs/users/triplets.md b/docs/users/triplets.md index 7aea35dd2..70580df46 100644 --- a/docs/users/triplets.md +++ b/docs/users/triplets.md @@ -12,10 +12,10 @@ To change the triplet used by your project, such as to enable static linking, se ### VCPKG_TARGET_ARCHITECTURE Specifies the target machine architecture. -Valid options are `x86`, `x64`, and `arm`. +Valid options are `x86`, `x64`, `arm`, and `arm64`. ### VCPKG_CRT_LINKAGE -Specifies the desired MSVCRT linkage. +Specifies the desired CRT linkage (for MSVC). Valid options are `dynamic` and `static`. @@ -27,8 +27,11 @@ Valid options are `dynamic` and `static`. Note that libraries can ignore this se ### VCPKG_CMAKE_SYSTEM_NAME Specifies the target platform. -Valid options are `WindowsStore` or empty. Empty corresponds to Windows Desktop and `WindowsStore` corresponds to UWP. -When setting this variable to `WindowsStore`, you must also set `VCPKG_CMAKE_SYSTEM_VERSION` to `10.0`. +Valid options include any CMake system name, such as: +- Empty (Windows Desktop for legacy reasons) +- `WindowsStore` (Universal Windows Platform) +- `Darwin` (Mac OSX) +- `Linux` (Linux) ### VCPKG_PLATFORM_TOOLSET Specifies the VS-based C/C++ compiler toolchain to use. @@ -45,22 +48,35 @@ This (if set) will override all other compiler detection logic. By default, a to See also the CMake documentation for toolchain files: https://cmake.org/cmake/help/v3.11/manual/cmake-toolchains.7.html. +### VCPKG_CXX_FLAGS +Sets additional compiler flags to be used when not using `VCPKG_CHAINLOAD_TOOLCHAIN_FILE`. + +This option also has forms for configuration-specific and C flags: +- `VCPKG_CXX_FLAGS_DEBUG` +- `VCPKG_CXX_FLAGS_RELEASE` +- `VCPKG_C_FLAGS` +- `VCPKG_C_FLAGS_DEBUG` +- `VCPKG_C_FLAGS_RELEASE` + ## Per-port customization The CMake Macro `PORT` will be set when interpreting the triplet file and can be used to change settings (such as `VCPKG_LIBRARY_LINKAGE`) on a per-port basis. Example: ```cmake set(VCPKG_LIBRARY_LINKAGE static) -set(VCPKG_CRT_LINKAGE dynamic) if(PORT MATCHES "qt5-") set(VCPKG_LIBRARY_LINKAGE dynamic) endif() ``` -This will build all the `qt5-*` libraries as DLLs against the dynamic CRT, but every other library as a static library (still against the dynamic CRT). +This will build all the `qt5-*` libraries as DLLs, but every other library as a static library. For an example in a real project, see https://github.com/Intelight/vcpkg/blob/master/triplets/x86-windows-mixed.cmake. ## Additional Remarks -The default triplet when running any vcpkg command is `%VCPKG_DEFAULT_TRIPLET%` or `x86-windows` if that environment variable is undefined. +The default triplet when running any vcpkg command is `%VCPKG_DEFAULT_TRIPLET%` or a platform-specific choice if that environment variable is undefined. + +- Windows: `x86-windows` +- Linux: `x64-linux` +- OSX: `x64-osx` We recommend using a systematic naming scheme when creating new triplets. The Android toolchain naming scheme is a good source of inspiration: https://developer.android.com/ndk/guides/standalone_toolchain.html. diff --git a/ports/dimcli/CONTROL b/ports/dimcli/CONTROL index c8b8c56e2..96943086c 100644 --- a/ports/dimcli/CONTROL +++ b/ports/dimcli/CONTROL @@ -1,3 +1,3 @@ Source: dimcli -Version: 3.1.1-1 +Version: 3.1.1-2 Description: C++ command line parser toolkit diff --git a/ports/dimcli/fix-cmake.patch b/ports/dimcli/fix-cmake.patch new file mode 100644 index 000000000..63795e041 --- /dev/null +++ b/ports/dimcli/fix-cmake.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2f319ee..a38eca2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -264,7 +264,7 @@ endfunction()
+ # "-1.2.3" from the that vcpkg likes to add when building things.
+ get_filename_component(prjname "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
+ string(REGEX REPLACE "(-[\.0-9\-]*)$" "" prjname ${prjname})
+-project(${prjname})
++project(dimcli)
+ string(TOUPPER "${prjname}" DEFINE_PREFIX)
+
+ get_property(parent DIRECTORY PROPERTY PARENT_DIRECTORY)
+@@ -323,9 +323,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER cmake)
+
+ set(CMAKE_CONFIGURATION_TYPES Debug Release)
+-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
+-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR}/bin)
+-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/bin)
+
+ if(MSVC)
+ # "/EHsc" - exceptions from c++ only (not from structured or "C")
diff --git a/ports/dimcli/portfile.cmake b/ports/dimcli/portfile.cmake index 3c4eb912c..f1cb2f4ec 100644 --- a/ports/dimcli/portfile.cmake +++ b/ports/dimcli/portfile.cmake @@ -3,17 +3,27 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO gknowles/dimcli - REF v3.1.1 + REF v3.1.1 SHA512 ed9aeedc59a9d48c59aa8dd1adb9cb110771c1eab0bbab8f8b518e12a45cdafb0ea94301d082ed3a033ca2428c19c8d990c76f666d1e9822cddf6e744f1db701 HEAD_REF master + PATCHES + "${CMAKE_CURRENT_LIST_DIR}/fix-cmake.patch" ) set(staticCrt OFF) -if(VCPKG_CRT_LINKAGE STREQUAL static) +if(VCPKG_CRT_LINKAGE STREQUAL "static") set(staticCrt ON) endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(ENV{_CL_} "/DDIMCLI_LIB_DYN_LINK") +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - OPTIONS -DLINK_STATIC_RUNTIME:BOOL=${staticCrt} -DINSTALL_LIBS:BOOL=ON + OPTIONS + -DLINK_STATIC_RUNTIME:BOOL=${staticCrt} + -DINSTALL_LIBS:BOOL=ON + -DRECURSIVE_GENERATE=ON ) vcpkg_install_cmake() @@ -22,6 +32,8 @@ vcpkg_install_cmake() file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") # Handle copyright -file(INSTALL "${SOURCE_PATH}/LICENSE" +file( + INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/dimcli" - RENAME copyright) + RENAME copyright +) diff --git a/ports/fmt/CONTROL b/ports/fmt/CONTROL index 7d1690878..e2abca792 100644 --- a/ports/fmt/CONTROL +++ b/ports/fmt/CONTROL @@ -1,3 +1,3 @@ Source: fmt -Version: 5.0.0 +Version: 5.0.0-1 Description: Formatting library for C++. It can be used as a safe alternative to printf or as a fast alternative to IOStreams. diff --git a/ports/fmt/portfile.cmake b/ports/fmt/portfile.cmake index 668482aa8..858eb5a7f 100644 --- a/ports/fmt/portfile.cmake +++ b/ports/fmt/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_configure_cmake( -DFMT_CMAKE_DIR=share/fmt -DFMT_TEST=OFF -DFMT_DOC=OFF + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON ) vcpkg_install_cmake() diff --git a/ports/freetype/portfile.cmake b/ports/freetype/portfile.cmake index 15e8aceab..9cdcd0f09 100644 --- a/ports/freetype/portfile.cmake +++ b/ports/freetype/portfile.cmake @@ -2,7 +2,7 @@ include(vcpkg_common_functions) set(FT_VERSION 2.8.1) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/freetype-${FT_VERSION}) vcpkg_download_distfile(ARCHIVE - URLS "http://download.savannah.gnu.org/releases/freetype/freetype-${FT_VERSION}.tar.bz2" + URLS "https://download.savannah.gnu.org/releases/freetype/freetype-${FT_VERSION}.tar.bz2" FILENAME "freetype-${FT_VERSION}.tar.bz2" SHA512 ca59e47f0fceeeb9b8032be2671072604d0c79094675df24187829c05e99757d0a48a0f8062d4d688e056f783aa8f6090d732ad116562e94784fccf1339eb823 ) diff --git a/ports/sol2/CONTROL b/ports/sol2/CONTROL index 9314cfcd6..1bb79470f 100644 --- a/ports/sol2/CONTROL +++ b/ports/sol2/CONTROL @@ -1,3 +1,3 @@ Source: sol2 -Version: 2.20.3-1 +Version: 2.20.4 Description: Sol v2.0 - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great diff --git a/ports/sol2/portfile.cmake b/ports/sol2/portfile.cmake index d51bf25a1..584f9af9d 100644 --- a/ports/sol2/portfile.cmake +++ b/ports/sol2/portfile.cmake @@ -3,12 +3,9 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ThePhD/sol2 - REF v2.20.3 - SHA512 f1d39a6762c7c9c40bffd08129a80c4c8dd70ffcaadc195cbcd681471e6978176d0ae06d4b8db6aabc05b0ae2670c10bd287b9e859ec7810f2441c3c6c8fe521 + REF v2.20.4 + SHA512 dacacf57da3d1be3f20542ba83676e247a0d5815d0ee5dbfdbe996ffa264a5aaa71d7e5088088b0f1b41001f681d3c81339fc3f1ba394095eeaef4cb9376499a HEAD_REF develop - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/sol2_fix_targets.patch - ${CMAKE_CURRENT_LIST_DIR}/sol2_fix_install_interface.patch ) vcpkg_configure_cmake( diff --git a/ports/sol2/sol2_fix_install_interface.patch b/ports/sol2/sol2_fix_install_interface.patch deleted file mode 100644 index 6b2daf66a..000000000 --- a/ports/sol2/sol2_fix_install_interface.patch +++ /dev/null @@ -1,22 +0,0 @@ -From d72b243c717159b2e44f2dc12d25752be578e2ec Mon Sep 17 00:00:00 2001
-From: Roman Sztergbaum <roman.sztergbaum@epitech.eu>
-Date: Sat, 23 Jun 2018 10:43:51 +0200
-Subject: [PATCH] fix install interface
-
----
- CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index abd298f8..ba52ded8 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -141,7 +141,7 @@ CMAKE_DEPENDENT_OPTION(TESTS_DYNAMIC_LOADING_EXAMPLES "Enable build of dynamic l
- add_library(sol2 INTERFACE)
- target_include_directories(sol2 INTERFACE
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
-- $<INSTALL_INTERFACE:include/sol>)
-+ $<INSTALL_INTERFACE:include/sol> $<INSTALL_INTERFACE:include>)
-
- # # Version configurations
- configure_package_config_file(
diff --git a/ports/sol2/sol2_fix_targets.patch b/ports/sol2/sol2_fix_targets.patch deleted file mode 100644 index 68b6088b0..000000000 --- a/ports/sol2/sol2_fix_targets.patch +++ /dev/null @@ -1,39 +0,0 @@ -From c53fa6d2b5f59d737b830021eb0872622b2058a2 Mon Sep 17 00:00:00 2001
-From: Roman Sztergbaum <roman.sztergbaum@epitech.eu>
-Date: Fri, 22 Jun 2018 22:02:11 +0200
-Subject: [PATCH] fix sol2-config.cmake.in
-
----
- cmake/sol2-config.cmake.in | 21 ++++++++++++---------
- 1 file changed, 12 insertions(+), 9 deletions(-)
-
-diff --git a/cmake/sol2-config.cmake.in b/cmake/sol2-config.cmake.in
-index 9c69beb4..c15c0e5d 100644
---- a/cmake/sol2-config.cmake.in
-+++ b/cmake/sol2-config.cmake.in
-@@ -26,13 +26,16 @@ include("${CMAKE_CURRENT_LIST_DIR}/sol2-targets.cmake")
-
- MESSAGE(STATUS ${CMAKE_CURRENT_LIST_DIR})
-
--get_target_property(SOL_INCLUDE_DIRS
-- sol2 INTERFACE_INCLUDE_DIRECTORIES)
-+if (TARGET sol2)
-+ get_target_property(SOL2_INCLUDE_DIRS
-+ sol2 INTERFACE_INCLUDE_DIRECTORIES)
-+ set_and_check(SOL2_INCLUDE_DIRS "${SOL2_INCLUDE_DIRS}")
-+ set(SOL2_LIBRARIES sol2)
-+endif()
-
--get_target_property(SOL_SINGLE_INCLUDE_DIRS
-- sol2_single INTERFACE_INCLUDE_DIRECTORIES)
--
--set_and_check(SOL2_INCLUDE_DIRS "${SOL2_INCLUDE_DIRS}")
--set_and_check(SOL2_INCLUDE_DIRS "${SOL2_SINGLE_INCLUDE_DIRS}")
--set(SOL2_LIBRARIES sol2)
--set(SOL2_LIBRARIES_SINGLE sol2_single)
-+if(TARGET sol2_single)
-+ get_target_property(SOL_SINGLE_INCLUDE_DIRS
-+ sol2_single INTERFACE_INCLUDE_DIRECTORIES)
-+ set_and_check(SOL2_INCLUDE_DIRS "${SOL2_SINGLE_INCLUDE_DIRS}")
-+ set(SOL2_LIBRARIES_SINGLE sol2_single)
-+endif()
diff --git a/ports/xlnt/CONTROL b/ports/xlnt/CONTROL index 25b4ce010..339bd7954 100644 --- a/ports/xlnt/CONTROL +++ b/ports/xlnt/CONTROL @@ -1,3 +1,3 @@ Source: xlnt
-Version: 1.2.0-1
+Version: 1.2.0-2
Description: Cross-platform user-friendly xlsx library for C++14
diff --git a/ports/xlnt/portfile.cmake b/ports/xlnt/portfile.cmake index f0cb9425d..060227b2a 100644 --- a/ports/xlnt/portfile.cmake +++ b/ports/xlnt/portfile.cmake @@ -1,17 +1,13 @@ include(vcpkg_common_functions)
-set(XLNT_VERSION 1.2.0)
-set(XLNT_HASH 359ff1e99531513d7b1228ff07f137531be99d7a95bbc5b399168a6c609f56dba2e030464f8203db92db137ab80dbe10f71de71a62b0bcb96eaafc0f09256339)
-set(XLNT_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/xlnt-${XLNT_VERSION})
-
-vcpkg_download_distfile(ARCHIVE
- URLS https://github.com/tfussell/xlnt/archive/v${XLNT_VERSION}.zip
- FILENAME xlnt-${XLNT_VERSION}.zip
- SHA512 ${XLNT_HASH}
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO tfussell/xlnt
+ REF v1.2.0
+ SHA512 e95eeb23ffe0bd68081a3a1dccfc2164697d4fac4386ddb9cc1029180a499de250c28df34d1b3971ff26e95a55d822f43efe032aa989321ee29d3d3e7a8b5587
+ HEAD_REF master
)
-vcpkg_extract_source_archive(${ARCHIVE})
-
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(STATIC OFF)
else()
@@ -19,7 +15,7 @@ else() endif()
vcpkg_configure_cmake(
- SOURCE_PATH ${XLNT_SOURCE_PATH}
+ SOURCE_PATH ${SOURCE_PATH}
OPTIONS -DTESTS=OFF -DSAMPLES=OFF -DBENCHMARKS=OFF -DSTATIC=${STATIC}
)
@@ -28,6 +24,6 @@ vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/man)
-file(INSTALL ${XLNT_SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/xlnt RENAME copyright)
+file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/xlnt RENAME copyright)
vcpkg_copy_pdbs()
diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake index 1894d6e9a..d62fbbf84 100644 --- a/scripts/cmake/vcpkg_apply_patches.cmake +++ b/scripts/cmake/vcpkg_apply_patches.cmake @@ -51,7 +51,6 @@ function(vcpkg_apply_patches) message(STATUS "Applying patch failed. This is expected if this patch was previously applied.") endif() - message(STATUS "Applying patch ${PATCH} done") math(EXPR PATCHNUM "${PATCHNUM}+1") endforeach() endfunction() diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 983ac9221..9aafb0d4b 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -74,7 +74,7 @@ function(vcpkg_build_cmake) set(CONFIG "Release") endif() - message(STATUS "Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE}") + message(STATUS "Building ${TARGET_TRIPLET}-${SHORT_BUILDTYPE}") set(LOGPREFIX "${CURRENT_BUILDTREES_DIR}/${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}-${SHORT_BUILDTYPE}") set(LOGS) @@ -174,7 +174,6 @@ function(vcpkg_build_cmake) ${STRINGIFIED_LOGS}) endif() endif() - message(STATUS "Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} done") if(_bc_ADD_BIN_TO_PATH) set(ENV{PATH} "${_BACKUP_ENV_PATH}") endif() diff --git a/scripts/cmake/vcpkg_build_qmake.cmake b/scripts/cmake/vcpkg_build_qmake.cmake index 194ab8206..5d894a646 100644 --- a/scripts/cmake/vcpkg_build_qmake.cmake +++ b/scripts/cmake/vcpkg_build_qmake.cmake @@ -33,7 +33,6 @@ function(vcpkg_build_qmake) WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${LOG_SUFFIX} LOGNAME package-${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX} ) - message(STATUS "Package ${LOG_PREFIX}-${TARGET_TRIPLET}-${LOG_SUFFIX} done") endfunction() # This fixes issues on machines with default codepages that are not ASCII compatible, such as some CJK encodings diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 3e0922428..81a30d4bb 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -122,6 +122,9 @@ function(vcpkg_configure_cmake) if(DEFINED VCPKG_CMAKE_SYSTEM_NAME) list(APPEND _csc_OPTIONS "-DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}") + if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT DEFINED VCPKG_CMAKE_SYSTEM_VERSION) + set(VCPKG_CMAKE_SYSTEM_VERSION 10.0) + endif() endif() if(DEFINED VCPKG_CMAKE_SYSTEM_VERSION) list(APPEND _csc_OPTIONS "-DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}") @@ -239,7 +242,6 @@ function(vcpkg_configure_cmake) WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vcpkg-parallel-configure LOGNAME config-${TARGET_TRIPLET} ) - message(STATUS "Configuring ${TARGET_TRIPLET} done") else() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") @@ -249,7 +251,6 @@ function(vcpkg_configure_cmake) WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg LOGNAME config-${TARGET_TRIPLET}-dbg ) - message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done") endif() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") @@ -260,7 +261,6 @@ function(vcpkg_configure_cmake) WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME config-${TARGET_TRIPLET}-rel ) - message(STATUS "Configuring ${TARGET_TRIPLET}-rel done") endif() endif() diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index 9fc0a0c9a..db3e45594 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -81,9 +81,8 @@ function(vcpkg_download_distfile VAR) return() endif() - message(STATUS "Testing integrity of ${FILE_KIND}...") file(SHA512 ${FILE_PATH} FILE_HASH) - if(NOT "${FILE_HASH}" STREQUAL "${vcpkg_download_distfile_SHA512}") + if(NOT FILE_HASH STREQUAL vcpkg_download_distfile_SHA512) message(FATAL_ERROR "\nFile does not have expected hash:\n" " File path: [ ${FILE_PATH} ]\n" @@ -91,10 +90,9 @@ function(vcpkg_download_distfile VAR) " Actual hash: [ ${FILE_HASH} ]\n" "${CUSTOM_ERROR_ADVICE}\n") endif() - message(STATUS "Testing integrity of ${FILE_KIND}... OK") endfunction() - if(EXISTS ${downloaded_file_path}) + if(EXISTS "${downloaded_file_path}") message(STATUS "Using cached ${downloaded_file_path}") test_hash("${downloaded_file_path}" "cached file" "Please delete the file and retry if this file should be downloaded again.") else() @@ -104,7 +102,7 @@ function(vcpkg_download_distfile VAR) # Tries to download the file. list(GET vcpkg_download_distfile_URLS 0 SAMPLE_URL) - if(${_VCPKG_DOWNLOAD_TOOL} MATCHES "ARIA2" AND NOT ${SAMPLE_URL} MATCHES "aria2") + if(_VCPKG_DOWNLOAD_TOOL STREQUAL "ARIA2" AND NOT SAMPLE_URL MATCHES "aria2") vcpkg_find_acquire_program("ARIA2") message(STATUS "Downloading ${vcpkg_download_distfile_FILENAME}...") execute_process( @@ -127,7 +125,6 @@ function(vcpkg_download_distfile VAR) ) set(download_success 0) else() - message(STATUS "Downloading ${vcpkg_download_distfile_FILENAME}... OK") file(REMOVE ${DOWNLOADS}/download-${vcpkg_download_distfile_FILENAME}-out.log ${DOWNLOADS}/download-${vcpkg_download_distfile_FILENAME}-err.log @@ -144,7 +141,6 @@ function(vcpkg_download_distfile VAR) message(STATUS "Downloading ${url}... Failed. Status: ${download_status}") set(download_success 0) else() - message(STATUS "Downloading ${url}... OK") set(download_success 1) break() endif() diff --git a/scripts/cmake/vcpkg_extract_source_archive.cmake b/scripts/cmake/vcpkg_extract_source_archive.cmake index 5c16616c6..3aafd4ca4 100644 --- a/scripts/cmake/vcpkg_extract_source_archive.cmake +++ b/scripts/cmake/vcpkg_extract_source_archive.cmake @@ -53,7 +53,6 @@ function(vcpkg_extract_source_archive_ex) ) file(WRITE ${WORKING_DIRECTORY}/${ARCHIVE_FILENAME}.extracted) endif() - message(STATUS "Extracting done") endfunction() function(vcpkg_extract_source_archive ARCHIVE) diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake index 28ada0631..fbceb2aae 100644 --- a/scripts/cmake/vcpkg_from_github.cmake +++ b/scripts/cmake/vcpkg_from_github.cmake @@ -141,7 +141,7 @@ function(vcpkg_from_github) endif() set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE) - + message(STATUS "Using source at ${SOURCE_PATH}") return() endif() @@ -205,4 +205,5 @@ function(vcpkg_from_github) PATCHES ${_vdud_PATCHES} ) set(${_vdud_OUT_SOURCE_PATH} "${TEMP_SOURCE_PATH}" PARENT_SCOPE) + message(STATUS "Using source at ${TEMP_SOURCE_PATH}") endfunction() diff --git a/scripts/cmake/vcpkg_install_meson.cmake b/scripts/cmake/vcpkg_install_meson.cmake index f6d49288c..7ab9d55b3 100644 --- a/scripts/cmake/vcpkg_install_meson.cmake +++ b/scripts/cmake/vcpkg_install_meson.cmake @@ -10,7 +10,6 @@ function(vcpkg_install_meson) WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME package-${TARGET_TRIPLET}-rel ) - message(STATUS "Package ${TARGET_TRIPLET}-rel done") message(STATUS "Package ${TARGET_TRIPLET}-dbg") vcpkg_execute_required_process( @@ -18,6 +17,5 @@ function(vcpkg_install_meson) WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg LOGNAME package-${TARGET_TRIPLET}-dbg ) - message(STATUS "Package ${TARGET_TRIPLET}-dbg done") endfunction() diff --git a/scripts/ports.cmake b/scripts/ports.cmake index ef06a4d65..7a5f2749f 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -37,7 +37,7 @@ if(CMD MATCHES "^BUILD$") message(FATAL_ERROR "Unsupported target triplet. Triplet file does not exist: ${CMAKE_TRIPLET_FILE}") endif() - if(NOT DEFINED CURRENT_PORT_DIR) + if(NOT DEFINED CURRENT_PORT_DIR) message(FATAL_ERROR "CURRENT_PORT_DIR was not defined") endif() set(TO_CMAKE_PATH "${CURRENT_PORT_DIR}" CURRENT_PORT_DIR) @@ -51,19 +51,18 @@ if(CMD MATCHES "^BUILD$") message(FATAL_ERROR "Port is missing control file: ${CURRENT_PORT_DIR}/CONTROL") endif() - message(STATUS "CURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR}") - message(STATUS "DOWNLOADS=${DOWNLOADS}") - - message(STATUS "CURRENT_PACKAGES_DIR=${CURRENT_PACKAGES_DIR}") - message(STATUS "CURRENT_BUILDTREES_DIR=${CURRENT_BUILDTREES_DIR}") - message(STATUS "CURRENT_PORT_DIR=${CURRENT_PORT_DIR}") - unset(PACKAGES_DIR) unset(BUILDTREES_DIR) - file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}) if(EXISTS ${CURRENT_PACKAGES_DIR}) - message(FATAL_ERROR "Unable to remove directory: ${CURRENT_PACKAGES_DIR}\n Files are likely in use.") + file(GLOB FILES_IN_CURRENT_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}/*") + if(FILES_IN_CURRENT_PACKAGES_DIR) + file(REMOVE_RECURSE ${FILES_IN_CURRENT_PACKAGES_DIR}) + file(GLOB FILES_IN_CURRENT_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}/*") + if(FILES_IN_CURRENT_PACKAGES_DIR) + message(FATAL_ERROR "Unable to empty directory: ${CURRENT_PACKAGES_DIR}\n Files are likely in use.") + endif() + endif() endif() file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR} ${CURRENT_PACKAGES_DIR}) diff --git a/scripts/vcpkgTools.xml b/scripts/vcpkgTools.xml index 314f62701..320e86275 100644 --- a/scripts/vcpkgTools.xml +++ b/scripts/vcpkgTools.xml @@ -1,25 +1,25 @@ <?xml version="1.0"?> <tools version="2"> <tool name="cmake" os="windows"> - <version>3.10.2</version> - <exeRelativePath>cmake-3.10.2-win32-x86\bin\cmake.exe</exeRelativePath> - <url>https://cmake.org/files/v3.10/cmake-3.10.2-win32-x86.zip</url> - <sha512>9c16861a2ac09c7011b84f38459ecfec2829a9f825b254acbbde46d98f12f8ca0d4db3a6764758cb671507ee7c0327576d87658b81d7ddf1e8280b37569eb16d</sha512> - <archiveName>cmake-3.10.2-win32-x86.zip</archiveName> + <version>3.11.4</version> + <exeRelativePath>cmake-3.11.4-win32-x86\bin\cmake.exe</exeRelativePath> + <url>https://cmake.org/files/v3.11/cmake-3.11.4-win32-x86.zip</url> + <sha512>3d866ef3c41a9cf738427fccf4730ccf8fd86bb4d13e9a1671b156bbdb2bc6beeecc7e7e8190cea8297498cfd67366c71231e9e08b121d4cd6e5ceac04124c19</sha512> + <archiveName>cmake-3.11.4-win32-x86.zip</archiveName> </tool> <tool name="cmake" os="osx"> - <version>3.10.2</version> - <exeRelativePath>cmake-3.10.2-Darwin-x86_64/CMake.app/Contents/bin/cmake</exeRelativePath> - <url>https://cmake.org/files/v3.10/cmake-3.10.2-Darwin-x86_64.tar.gz</url> - <sha512>cb7d76e11c892eb786da5804282c4141564390c3552e08c506c7abb93015eb5f619c55255459872b219399ce8114ac321fe92df7f82a7e42bbc874eec240571e</sha512> - <archiveName>cmake-3.10.2-Darwin-x86_64.tar.gz</archiveName> + <version>3.11.4</version> + <exeRelativePath>cmake-3.11.4-Darwin-x86_64/CMake.app/Contents/bin/cmake</exeRelativePath> + <url>https://cmake.org/files/v3.11/cmake-3.11.4-Darwin-x86_64.tar.gz</url> + <sha512>eeb967dc5b6e46e8dee06939b8b416d40f644baad79ffd90f86ad18e1e3b58b50dec0f064e60467125be9bedb7de8c48fbcb8a97ca731645939539f97645db54</sha512> + <archiveName>cmake-3.11.4-Darwin-x86_64.tar.gz</archiveName> </tool> <tool name="cmake" os="linux"> - <version>3.10.2</version> - <exeRelativePath>cmake-3.10.2-Linux-x86_64/bin/cmake</exeRelativePath> - <url>https://cmake.org/files/v3.10/cmake-3.10.2-Linux-x86_64.tar.gz</url> - <sha512>54389b5cb3f3cb9d182d35e0b1eaf7b301695899930da0d26e9df1dc25056213a077646d23ea609a93daa81d30687757d9cf0dc263339fa3d73dbeb1284bc1a9</sha512> - <archiveName>cmake-3.10.2-Linux-x86_64.tar.gz</archiveName> + <version>3.11.4</version> + <exeRelativePath>cmake-3.11.4-Linux-x86_64/bin/cmake</exeRelativePath> + <url>https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.tar.gz</url> + <sha512>70d92eea972710684582154dc1b884536aba5abda130a431257750b54437c46397aea39c2cc31056ecf36ddadbc1cf5c22434794fb314ea67c15a9be3bd20092</sha512> + <archiveName>cmake-3.11.4-Linux-x86_64.tar.gz</archiveName> </tool> <tool name="git" os="windows"> <version>2.17.1</version> diff --git a/toolsrc/CMakeLists.txt b/toolsrc/CMakeLists.txt index abfd872d2..a06cbae78 100644 --- a/toolsrc/CMakeLists.txt +++ b/toolsrc/CMakeLists.txt @@ -48,6 +48,10 @@ elseif(CLANG) target_link_libraries(vcpkg PRIVATE c++experimental)
endif()
+if(WIN32)
+ target_link_libraries(vcpkg PRIVATE bcrypt)
+endif()
+
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(vcpkg PRIVATE Threads::Threads)
diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index f16805d0a..eee910841 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -37,6 +37,10 @@ namespace vcpkg::Files virtual void write_contents(const fs::path& file_path, const std::string& data, std::error_code& ec) = 0; virtual void rename(const fs::path& oldpath, const fs::path& newpath) = 0; virtual void rename(const fs::path& oldpath, const fs::path& newpath, std::error_code& ec) = 0; + virtual void rename_or_copy(const fs::path& oldpath, + const fs::path& newpath, + StringLiteral temp_suffix, + std::error_code& ec) = 0; virtual bool remove(const fs::path& path) = 0; virtual bool remove(const fs::path& path, std::error_code& ec) = 0; virtual std::uintmax_t remove_all(const fs::path& path, std::error_code& ec) = 0; @@ -53,13 +57,9 @@ namespace vcpkg::Files std::error_code& ec) = 0; virtual fs::file_status status(const fs::path& path, std::error_code& ec) const = 0; - inline void write_contents(const fs::path& file_path, const std::string& data) - { - std::error_code ec; - write_contents(file_path, data, ec); - Checks::check_exit( - VCPKG_LINE_INFO, !ec, "error while writing file: %s: %s", file_path.u8string(), ec.message()); - } + virtual std::vector<fs::path> find_from_PATH(const std::string& name) const = 0; + + void write_contents(const fs::path& file_path, const std::string& data); }; Filesystem& get_real_filesystem(); @@ -69,6 +69,4 @@ namespace vcpkg::Files bool has_invalid_chars_for_filesystem(const std::string& s); void print_paths(const std::vector<fs::path>& paths); - - std::vector<fs::path> find_from_PATH(const std::string& name); } diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 3d96e834b..a6fbfbd73 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -4,10 +4,26 @@ #include <vcpkg/base/system.h> #include <vcpkg/base/util.h> +#if defined(__linux__) +#include <fcntl.h> +#include <sys/sendfile.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> +#endif + namespace vcpkg::Files { static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])"); + void Filesystem::write_contents(const fs::path& file_path, const std::string& data) + { + std::error_code ec; + write_contents(file_path, data, ec); + Checks::check_exit( + VCPKG_LINE_INFO, !ec, "error while writing file: %s: %s", file_path.u8string(), ec.message()); + } + struct RealFilesystem final : Filesystem { virtual Expected<std::string> read_contents(const fs::path& file_path) const override @@ -117,6 +133,42 @@ namespace vcpkg::Files { fs::stdfs::rename(oldpath, newpath); } + virtual void rename_or_copy(const fs::path& oldpath, + const fs::path& newpath, + StringLiteral temp_suffix, + std::error_code& ec) override + { + this->rename(oldpath, newpath, ec); +#if defined(__linux__) + if (ec) + { + auto dst = newpath; + dst.replace_filename(dst.filename() + temp_suffix.c_str()); + + int i_fd = open(oldpath.c_str(), O_RDONLY); + if (i_fd == -1) return; + + int o_fd = creat(dst.c_str(), 0664); + if (o_fd == -1) + { + close(i_fd); + return; + } + + off_t bytes = 0; + struct stat info = {0}; + fstat(i_fd, &info); + auto written_bytes = sendfile(o_fd, i_fd, &bytes, info.st_size); + close(i_fd); + close(o_fd); + if (written_bytes == -1) return; + + this->rename(dst, newpath, ec); + if (ec) return; + this->remove(oldpath, ec); + } +#endif + } virtual bool remove(const fs::path& path) override { return fs::stdfs::remove(path); } virtual bool remove(const fs::path& path, std::error_code& ec) override { return fs::stdfs::remove(path, ec); } virtual std::uintmax_t remove_all(const fs::path& path, std::error_code& ec) override @@ -197,6 +249,40 @@ namespace vcpkg::Files } } } + + virtual std::vector<fs::path> find_from_PATH(const std::string& name) const override + { +#if defined(_WIN32) + static constexpr StringLiteral EXTS[] = {".cmd", ".exe", ".bat"}; + auto paths = Strings::split(System::get_environment_variable("PATH").value_or_exit(VCPKG_LINE_INFO), ";"); + + std::vector<fs::path> ret; + for (auto&& path : paths) + { + auto base = path + "/" + name; + for (auto&& ext : EXTS) + { + auto p = fs::u8path(base + ext.c_str()); + if (Util::find(ret, p) != ret.end() && this->exists(p)) + { + ret.push_back(p); + Debug::println("Found path: %s", p.u8string()); + } + } + } + + return ret; +#else + const std::string cmd = Strings::format("which %s", name); + auto out = System::cmd_execute_and_capture_output(cmd); + if (out.exit_code != 0) + { + return {}; + } + + return Util::fmap(Strings::split(out.output, "\n"), [](auto&& s) { return fs::path(s); }); +#endif + } }; Filesystem& get_real_filesystem() @@ -219,20 +305,4 @@ namespace vcpkg::Files } System::println(); } - - std::vector<fs::path> find_from_PATH(const std::string& name) - { -#if defined(_WIN32) - const std::string cmd = Strings::format("where.exe %s", name); -#else - const std::string cmd = Strings::format("which %s", name); -#endif - auto out = System::cmd_execute_and_capture_output(cmd); - if (out.exit_code != 0) - { - return {}; - } - - return Util::fmap(Strings::split(out.output, "\n"), [](auto&& s) { return fs::path(s); }); - } } diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index bcde9217c..bf3fffafe 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -458,6 +458,8 @@ namespace vcpkg::Build std::vector<AbiEntry> abi_tag_entries; + abi_tag_entries.emplace_back(AbiEntry{"cmake", Commands::Fetch::get_tool_version(paths, Tools::CMAKE)}); + abi_tag_entries.insert(abi_tag_entries.end(), dependency_abis.begin(), dependency_abis.end()); abi_tag_entries.emplace_back( @@ -646,10 +648,14 @@ namespace vcpkg::Build compress_archive(paths, spec, tmp_archive_path); fs.create_directories(archive_path.parent_path(), ec); - fs.rename(tmp_archive_path, archive_path, ec); + fs.rename_or_copy(tmp_archive_path, archive_path, ".tmp", ec); if (ec) - System::println( - System::Color::warning, "Failed to store binary cache: %s", archive_path.u8string()); + { + System::println(System::Color::warning, + "Failed to store binary cache %s: %s", + archive_path.u8string(), + ec.message()); + } else System::println("Stored binary cache: %s", archive_path.u8string()); } diff --git a/toolsrc/src/vcpkg/commands.fetch.cpp b/toolsrc/src/vcpkg/commands.fetch.cpp index 0681e2324..30aec74e5 100644 --- a/toolsrc/src/vcpkg/commands.fetch.cpp +++ b/toolsrc/src/vcpkg/commands.fetch.cpp @@ -9,7 +9,6 @@ #include <vcpkg/base/util.h> #include <vcpkg/commands.h> #include <vcpkg/help.h> -# namespace vcpkg::Commands::Fetch { @@ -151,15 +150,20 @@ namespace vcpkg::Commands::Fetch std::vector<PathAndVersion> get_versions(const std::vector<fs::path>& candidate_paths) const { + auto&& fs = Files::get_real_filesystem(); + std::vector<PathAndVersion> output; for (auto&& p : candidate_paths) { + if (!fs.exists(p)) continue; auto maybe_version = this->get_version(p); if (const auto version = maybe_version.get()) { output.emplace_back(PathAndVersion{p, *version}); + return output; } } + return output; } }; @@ -254,7 +258,7 @@ namespace vcpkg::Commands::Fetch #else static const ToolData TOOL_DATA = ToolData{{3, 5, 1}, ""}; #endif - const std::vector<fs::path> from_path = Files::find_from_PATH("cmake"); + const std::vector<fs::path> from_path = paths.get_filesystem().find_from_PATH("cmake"); candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); const auto& program_files = System::get_program_files_platform_bitness(); @@ -315,7 +319,7 @@ namespace vcpkg::Commands::Fetch std::vector<fs::path> candidate_paths; candidate_paths.push_back(TOOL_DATA.exe_path); - const std::vector<fs::path> from_path = Files::find_from_PATH("ninja"); + const std::vector<fs::path> from_path = paths.get_filesystem().find_from_PATH("ninja"); candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); const NinjaVersionProvider version_provider{}; @@ -360,7 +364,7 @@ Type 'NuGet help <command>' for help on a specific command. std::vector<fs::path> candidate_paths; candidate_paths.push_back(TOOL_DATA.exe_path); - const std::vector<fs::path> from_path = Files::find_from_PATH("nuget"); + const std::vector<fs::path> from_path = paths.get_filesystem().find_from_PATH("nuget"); candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); const NugetVersionProvider version_provider{}; @@ -408,7 +412,7 @@ git version 2.17.1.windows.2 #if defined(_WIN32) candidate_paths.push_back(TOOL_DATA.exe_path); #endif - const std::vector<fs::path> from_path = Files::find_from_PATH("git"); + const std::vector<fs::path> from_path = paths.get_filesystem().find_from_PATH("git"); candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); const auto& program_files = System::get_program_files_platform_bitness(); |
