diff --git a/docs/EXAMPLES.md b/docs/EXAMPLES.md index 6302dab07..1a2bacc99 100644 --- a/docs/EXAMPLES.md +++ b/docs/EXAMPLES.md @@ -3,7 +3,7 @@ ## Overview Vcpkg helps you get C and C++ libraries on Windows. -For short description of available commands, run `vcpkg help`. +For short description of available commands, run `.\vcpkg help`. ## Table of Contents - Example 1: Using Sqlite @@ -75,7 +75,7 @@ To install for other architectures and platforms such as Universal Windows Platf PS D:\src\vcpkg> .\vcpkg install sqlite3:x86-uwp zlib:x64-windows ``` -See `vcpkg help triplet` for all supported targets. +See `.\vcpkg help triplet` for all supported targets. ### Step 2: Use @@ -95,7 +95,7 @@ Installing new libraries will make them instantly available. You can now simply use File -> New Project in Visual Studio 2015 or Visual Studio "15" Preview and the library will be automatically available. For Sqlite, you can try out their [C/C++ sample](https://sqlite.org/quickstart.html). -To remove the integration for your user, you can use `vcpkg integrate remove`. +To remove the integration for your user, you can use `.\vcpkg integrate remove`. #### Option B: CMake (Toolchain File) @@ -150,9 +150,9 @@ PS D:\src\cmake-test\build> .\Debug\main.exe Libraries are installed into the `installed\` subfolder, partitioned by architecture (e.g. x86-windows): * The header files are installed to `installed\x86-windows\include` -* Release `.lib` files are installed to `installed\x86-windows\lib` +* Release `.lib` files are installed to `installed\x86-windows\lib` or `installed\x86-windows\lib\manual-link` * Release `.dll` files are installed to `installed\x86-windows\bin` -* Debug `.lib` files are installed to `installed\x86-windows\debug\lib` +* Debug `.lib` files are installed to `installed\x86-windows\debug\lib` or `installed\x86-windows\debug\lib\manual-link` * Debug `.dll` files are installed to `installed\x86-windows\debug\bin` See your build system specific documentation for how to use prebuilt binaries. diff --git a/ports/aws-sdk-cpp/CONTROL b/ports/aws-sdk-cpp/CONTROL index 989d3a9eb..18de04d46 100644 --- a/ports/aws-sdk-cpp/CONTROL +++ b/ports/aws-sdk-cpp/CONTROL @@ -1,3 +1,3 @@ Source: aws-sdk-cpp -Version: 1.0.47 +Version: 1.0.61 Description: AWS SDK for C++ diff --git a/ports/aws-sdk-cpp/disable_warning_as_error.patch b/ports/aws-sdk-cpp/disable_warning_as_error.patch new file mode 100644 index 000000000..ec5587eb8 --- /dev/null +++ b/ports/aws-sdk-cpp/disable_warning_as_error.patch @@ -0,0 +1,13 @@ +diff --git a/cmake/compiler_settings.cmake b/cmake/compiler_settings.cmake +index 36795a2..77334ee 100644 +--- a/cmake/compiler_settings.cmake ++++ b/cmake/compiler_settings.cmake +@@ -57,7 +57,7 @@ endif() + if(MSVC) + # warnings as errors, max warning level (4) + if(NOT CMAKE_CXX_FLAGS MATCHES "/WX") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") ++ #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") + endif() + + # taken from http://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake diff --git a/ports/aws-sdk-cpp/portfile.cmake b/ports/aws-sdk-cpp/portfile.cmake index 5313e85b7..21219c3c9 100644 --- a/ports/aws-sdk-cpp/portfile.cmake +++ b/ports/aws-sdk-cpp/portfile.cmake @@ -1,9 +1,9 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/aws-sdk-cpp-1.0.47) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/aws-sdk-cpp-1.0.61) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/aws/aws-sdk-cpp/archive/1.0.47.tar.gz" - FILENAME "aws-sdk-cpp-1.0.47.tar.gz" - SHA512 ce7471bafe2763f1c382eed8afeaf6422058599a3aa11ae52909da668c45d12827fcd06b9b3ce34e3c2fa33297fd2e09421b8a89833d581efaf62b7108232acf + URLS "https://github.com/aws/aws-sdk-cpp/archive/1.0.61.tar.gz" + FILENAME "aws-sdk-cpp-1.0.61.tar.gz" + SHA512 aef0a85a32db24dc4fba0fc49c2533074580f3df628e787ff0808f03deea5dac42e19b1edc966706784e98cfed17a350c3eff4f222df7cc756065be56d1fc6a6 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -11,6 +11,7 @@ vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES ${CMAKE_CURRENT_LIST_DIR}/drop_git.patch + ${CMAKE_CURRENT_LIST_DIR}/disable_warning_as_error.patch ) if(VCPKG_CRT_LINKAGE STREQUAL static) @@ -44,11 +45,7 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(COPY ${DEBUG_LIB_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) file(REMOVE ${LIB_FILES} ${DEBUG_LIB_FILES}) - vcpkg_apply_patches( #define USE_IMPORT_EXPORT in SDKConfig.h - SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/shared_define.patch - ) + file(APPEND ${CURRENT_PACKAGES_DIR}/include/aws/core/SDKConfig.h "#define USE_IMPORT_EXPORT") endif() # Handle copyright diff --git a/ports/aws-sdk-cpp/shared_define.patch b/ports/aws-sdk-cpp/shared_define.patch deleted file mode 100644 index 96657b33e..000000000 --- a/ports/aws-sdk-cpp/shared_define.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff --git a/aws/core/SDKConfig.h b/aws/core/SDKConfig.h -index 130c9dd..66b2630 100644 ---- a/aws/core/SDKConfig.h -+++ b/aws/core/SDKConfig.h -@@ -17,3 +17,4 @@ - - #define JSON_USE_EXCEPTION 0 - -+#define USE_IMPORT_EXPORT -\ No newline at end of file diff --git a/ports/cpprestsdk/CONTROL b/ports/cpprestsdk/CONTROL index b3438026f..f284f2b53 100644 --- a/ports/cpprestsdk/CONTROL +++ b/ports/cpprestsdk/CONTROL @@ -1,5 +1,5 @@ Source: cpprestsdk -Version: 2.9.0-1 -Build-Depends: zlib [windows], openssl [windows], boost [windows] +Version: 2.9.0-2 +Build-Depends: zlib [windows], openssl [windows], boost [windows], websocketpp [windows] Description: C++11 JSON, REST, and OAuth library The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services. \ No newline at end of file diff --git a/ports/cpprestsdk/portfile.cmake b/ports/cpprestsdk/portfile.cmake index d1b5fa7f6..f92c5147a 100644 --- a/ports/cpprestsdk/portfile.cmake +++ b/ports/cpprestsdk/portfile.cmake @@ -15,9 +15,13 @@ vcpkg_apply_patches( ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch ) +SET(WEBSOCKETPP_PATH "${CURRENT_INSTALLED_DIR}/share/websocketpp") + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/Release OPTIONS + -DWEBSOCKETPP_CONFIG=${WEBSOCKETPP_PATH} + -DWEBSOCKETPP_CONFIG_VERSION=${WEBSOCKETPP_PATH} -DBUILD_TESTS=OFF -DBUILD_SAMPLES=OFF -DCPPREST_EXCLUDE_WEBSOCKETS=OFF diff --git a/ports/cuda/CONTROL b/ports/cuda/CONTROL new file mode 100644 index 000000000..00df3011c --- /dev/null +++ b/ports/cuda/CONTROL @@ -0,0 +1,3 @@ +Source: cuda +Version: 8.0 +Description: A parallel computing platform and programming model \ No newline at end of file diff --git a/ports/cuda/portfile.cmake b/ports/cuda/portfile.cmake new file mode 100644 index 000000000..3b20afe0f --- /dev/null +++ b/ports/cuda/portfile.cmake @@ -0,0 +1,34 @@ +# Due to the complexity involved, this package doesn't install CUDA. It instead verifies that CUDA is installed. +# Other packages can depend on this package to declare a dependency on CUDA. +# If this package is installed, we assume that CUDA is properly installed. + +execute_process( + COMMAND nvcc --version + OUTPUT_VARIABLE NVCC_OUTPUT + RESULT_VARIABLE error_code) + +# Sample output +# NVIDIA (R) Cuda compiler driver +# Copyright (c) 2005-2016 NVIDIA Corporation +# Built on Sat_Sep__3_19:05:48_CDT_2016 +# Cuda compilation tools, release 8.0, V8.0.44 +set(CUDA_REQUIRED_VERSION "V8.0.0") + +if (${error_code}) + message(FATAL_ERROR "CUDA is not installed. Before continuing, please download and install CUDA (${CUDA_REQUIRED_VERSION} or higher) from:" + "\n https://developer.nvidia.com/cuda-downloads \n") +endif() + +string(REGEX MATCH "V([0-9]+)\\.([0-9]+)\\.([0-9]+)" CUDA_VERSION ${NVCC_OUTPUT}) +message(STATUS "Found CUDA ${CUDA_VERSION}") +set(CUDA_VERSION_MAJOR ${CMAKE_MATCH_1}) +#set(CUDA_VERSION_MINOR ${CMAKE_MATCH_2}) +#set(CUDA_VERSION_PATCH ${CMAKE_MATCH_3}) + + +if (${CUDA_VERSION_MAJOR} LESS 8) + message(FATAL_ERROR "CUDA ${CUDA_VERSION} but ${CUDA_REQUIRED_VERSION} is required. Please download and install a more recent version of CUDA from:" + "\n https://developer.nvidia.com/cuda-downloads \n") +endif() + +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) \ No newline at end of file diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake index ffd71d137..90915976c 100644 --- a/ports/grpc/portfile.cmake +++ b/ports/grpc/portfile.cmake @@ -53,6 +53,8 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets-release.cmake ${C file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/gRPC/gRPCTargets-debug.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-debug.cmake) file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/grpc RENAME copyright) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/grpc_cpp_plugin.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/poco/CONTROL b/ports/poco/CONTROL index 6f4f7e3b1..ae2758c1f 100644 --- a/ports/poco/CONTROL +++ b/ports/poco/CONTROL @@ -1,4 +1,4 @@ Source: poco -Version: 1.7.6-2 +Version: 1.7.6-3 Build-Depends: zlib, pcre, sqlite3, expat Description: Modern, powerful open source C++ class libraries for building network and internet-based applications that run on desktop, server, mobile and embedded systems. \ No newline at end of file diff --git a/ports/poco/foundation-public-include-pcre.patch b/ports/poco/foundation-public-include-pcre.patch new file mode 100644 index 000000000..ab4403ad8 --- /dev/null +++ b/ports/poco/foundation-public-include-pcre.patch @@ -0,0 +1,12 @@ +diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt +index 76005b1..efc99b6 100644 +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -166,6 +166,7 @@ target_link_libraries( "${LIBNAME}" ${SYSLIBS}) + target_include_directories( "${LIBNAME}" + PUBLIC + $ ++ $ + $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src + ) diff --git a/ports/poco/portfile.cmake b/ports/poco/portfile.cmake index 413f19c7e..e774c3c17 100644 --- a/ports/poco/portfile.cmake +++ b/ports/poco/portfile.cmake @@ -13,6 +13,7 @@ vcpkg_apply_patches( PATCHES ${CMAKE_CURRENT_LIST_DIR}/config_h.patch ${CMAKE_CURRENT_LIST_DIR}/find_pcre.patch + ${CMAKE_CURRENT_LIST_DIR}/foundation-public-include-pcre.patch ) if(VCPKG_LIBRARY_LINKAGE STREQUAL static) diff --git a/ports/websocketpp/CONTROL b/ports/websocketpp/CONTROL index c11e64d3e..f812dc565 100644 --- a/ports/websocketpp/CONTROL +++ b/ports/websocketpp/CONTROL @@ -1,3 +1,4 @@ Source: websocketpp Version: 0.7.0 +Build-Depends: zlib, openssl, boost Description: Library that implements RFC6455 The WebSocket Protocol \ No newline at end of file diff --git a/ports/wt/CONTROL b/ports/wt/CONTROL index 1a89dd378..d7ac2c535 100644 --- a/ports/wt/CONTROL +++ b/ports/wt/CONTROL @@ -1,4 +1,4 @@ Source: wt -Version: 3.3.6-2 +Version: 3.3.6-3 Description: Wt is a C++ library for developing web applications Build-Depends: boost, openssl diff --git a/ports/wt/portfile.cmake b/ports/wt/portfile.cmake index f762eface..7e2bdb47c 100644 --- a/ports/wt/portfile.cmake +++ b/ports/wt/portfile.cmake @@ -7,10 +7,15 @@ vcpkg_download_distfile(ARCHIVE_FILE SHA512 d6135713d300bcd3956a4fd673af73be0561eb5d6aa91c47255b966950ddb411217e6a826c1d11c0d941dbb6d006c9926231d7334b21de6256cca331066e18a6 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) - +vcpkg_download_distfile(PATCH_FILE + URLS "https://github.com/emweb/wt/commit/b944cdc0961f683cd12fc6e60db3d0b328cd46dd.diff" + FILENAME "wt-fix-boost-1-63.diff" + SHA512 0766837ed8852da675b02b45bfbe7a6705ab20f67aa20849df4cc4b93b00dec0b73acea3568bca1046e203119445044c5ea06e33bac5d5d991f6a56b8fe282e1 +) vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-disable-boost-autolink-option.patch + ${PATCH_FILE} ) vcpkg_configure_cmake( diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 2e73a72d6..18e2a8b00 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -1,9 +1,14 @@ function(vcpkg_build_cmake) cmake_parse_arguments(_bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ARGN}) - set(MSVC_EXTRA_ARGS /p:VCPkgLocalAppDataDisabled=true) + set(MSVC_EXTRA_ARGS + "/p:VCPkgLocalAppDataDisabled=true" + "/p:UseIntelMKL=No" + ) # Specifies the architecture of the toolset, NOT the architecture of the produced binary + # This can help libraries that cause the linker to run out of memory. + # https://support.microsoft.com/en-us/help/2891057/linker-fatal-error-lnk1102-out-of-memory if (_bc_MSVC_64_TOOLSET) list(APPEND MSVC_EXTRA_ARGS "/p:PreferredToolArchitecture=x64") endif() diff --git a/scripts/cmake/vcpkg_build_msbuild.cmake b/scripts/cmake/vcpkg_build_msbuild.cmake index df255c745..f4a809e7f 100644 --- a/scripts/cmake/vcpkg_build_msbuild.cmake +++ b/scripts/cmake/vcpkg_build_msbuild.cmake @@ -55,6 +55,7 @@ function(vcpkg_build_msbuild) /p:Configuration=${_csc_RELEASE_CONFIGURATION} /p:Platform=${_csc_PLATFORM} /p:VCPkgLocalAppDataDisabled=true + /p:UseIntelMKL=No /m WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME build-${TARGET_TRIPLET}-rel @@ -67,6 +68,7 @@ function(vcpkg_build_msbuild) /p:Configuration=${_csc_DEBUG_CONFIGURATION} /p:Platform=${_csc_PLATFORM} /p:VCPkgLocalAppDataDisabled=true + /p:UseIntelMKL=No /m WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg LOGNAME build-${TARGET_TRIPLET}-dbg diff --git a/scripts/cmake/vcpkg_install_cmake.cmake b/scripts/cmake/vcpkg_install_cmake.cmake index 5997fa764..0ebff6961 100644 --- a/scripts/cmake/vcpkg_install_cmake.cmake +++ b/scripts/cmake/vcpkg_install_cmake.cmake @@ -1,9 +1,14 @@ function(vcpkg_install_cmake) cmake_parse_arguments(_bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ARGN}) - set(MSVC_EXTRA_ARGS /p:VCPkgLocalAppDataDisabled=true) + set(MSVC_EXTRA_ARGS + "/p:VCPkgLocalAppDataDisabled=true" + "/p:UseIntelMKL=No" + ) # Specifies the architecture of the toolset, NOT the architecture of the produced binary + # This can help libraries that cause the linker to run out of memory. + # https://support.microsoft.com/en-us/help/2891057/linker-fatal-error-lnk1102-out-of-memory if (_bc_MSVC_64_TOOLSET) list(APPEND MSVC_EXTRA_ARGS "/p:PreferredToolArchitecture=x64") endif() diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 index a2ce66522..951975758 100644 --- a/scripts/findVisualStudioInstallationInstances.ps1 +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -13,17 +13,8 @@ $downloadsDir = "$vcpkgRootDir\downloads" $nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" $nugetPackageDir = "$downloadsDir\nuget-packages" -$SetupAPIVersion = "1.3.269-rc" -$url = "https://api.nuget.org/packages/microsoft.visualstudio.setup.configuration.native.$SetupAPIVersion.nupkg" -$downloadName = "microsoft.visualstudio.setup.configuration.native.$SetupAPIVersion.nupkg" -$downloadPath = "$downloadsDir\$downloadName" - -if (!(Test-Path $downloadPath)) -{ - Start-BitsTransfer -Source $url -Destination $downloadPath #-ErrorAction SilentlyContinue -} - -$nugetOutput = & $nugetexe install Microsoft.VisualStudio.Setup.Configuration.Native -Pre -Source $downloadsDir -OutputDirectory $nugetPackageDir 2>&1 +$SetupAPIVersion = "1.5.125-rc" +$nugetOutput = & $nugetexe install Microsoft.VisualStudio.Setup.Configuration.Native -Version $SetupAPIVersion -OutputDirectory $nugetPackageDir -nocache 2>&1 $SetupConsoleExe = "$nugetPackageDir\Microsoft.VisualStudio.Setup.Configuration.Native.$SetupAPIVersion\tools\x86\Microsoft.VisualStudio.Setup.Configuration.Console.exe" @@ -34,8 +25,9 @@ if (!(Test-Path $SetupConsoleExe)) $instances = & $SetupConsoleExe -nologo -value InstallationPath 2>&1 $instanceCount = $instances.Length + # The last item can be empty -if ($instances[$entryCount - 1] -eq "") +if ($instanceCount -gt 0 -and $instances[$instanceCount - 1] -eq "") { $instances = $instances[0..($instanceCount - 2)] } diff --git a/scripts/ports.cmake b/scripts/ports.cmake index cc01a0619..c03b005ea 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -79,6 +79,9 @@ if(CMD MATCHES "^BUILD$") if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_LIBS) file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutLIBs: ${VCPKG_POLICY_DLLS_WITHOUT_LIBS}\n") endif() + if (DEFINED VCPKG_POLICY_EMPTY_PACKAGE) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyPackage: ${VCPKG_POLICY_EMPTY_PACKAGE}\n") + endif() elseif(CMD MATCHES "^CREATE$") file(TO_NATIVE_PATH ${VCPKG_ROOT_DIR} NATIVE_VCPKG_ROOT_DIR) file(TO_NATIVE_PATH ${DOWNLOADS} NATIVE_DOWNLOADS) diff --git a/toolsrc/include/PostBuildLint_BuildPolicies.h b/toolsrc/include/PostBuildLint_BuildPolicies.h index 8298ffe2d..187ba6d64 100644 --- a/toolsrc/include/PostBuildLint_BuildPolicies.h +++ b/toolsrc/include/PostBuildLint_BuildPolicies.h @@ -6,6 +6,7 @@ namespace vcpkg::PostBuildLint::BuildPolicies enum class backing_enum_t { UNKNOWN = 0, + EMPTY_PACKAGE, DLLS_WITHOUT_LIBS }; @@ -22,10 +23,12 @@ namespace vcpkg::PostBuildLint::BuildPolicies backing_enum_t backing_enum; }; - static constexpr int value_count = 2; + static constexpr int value_count = 3; const std::vector& values(); + static constexpr type UNKNOWN(backing_enum_t::UNKNOWN); + static constexpr type EMPTY_PACKAGE(backing_enum_t::EMPTY_PACKAGE); static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS); type parse(const std::string& s); diff --git a/toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h b/toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h deleted file mode 100644 index 484f74cf0..000000000 --- a/toolsrc/include/PostBuildLint_OutdatedDynamicCrt.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once -#include -#include - -namespace vcpkg::PostBuildLint -{ - struct OutdatedDynamicCrt - { - // Old CPP - static const OutdatedDynamicCrt MSVCP100_DLL; - static const OutdatedDynamicCrt MSVCP100D_DLL; - static const OutdatedDynamicCrt MSVCP110_DLL; - static const OutdatedDynamicCrt MSVCP110_WIN_DLL; - static const OutdatedDynamicCrt MSVCP120_DLL; - static const OutdatedDynamicCrt MSVCP120_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCP60_DLL; - static const OutdatedDynamicCrt MSVCP_WIN_DLL; - - // Old C - static const OutdatedDynamicCrt MSVCR100_DLL; - static const OutdatedDynamicCrt MSVCR100D_DLL; - static const OutdatedDynamicCrt MSVCR100_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCR110_DLL; - static const OutdatedDynamicCrt MSVCR120_DLL; - static const OutdatedDynamicCrt MSVCR120_CLR0400_DLL; - static const OutdatedDynamicCrt MSVCRT_DLL; - static const OutdatedDynamicCrt MSVCRT20_DLL; - static const OutdatedDynamicCrt MSVCRT40_DLL; - - static const std::vector& values() - { - static const std::vector v = { - MSVCP100_DLL, MSVCP100D_DLL, - MSVCP110_DLL,MSVCP110_WIN_DLL, - MSVCP120_DLL, MSVCP120_CLR0400_DLL, - MSVCP60_DLL, - MSVCP_WIN_DLL, - - MSVCR100_DLL, MSVCR100D_DLL, MSVCR100_CLR0400_DLL, - MSVCR110_DLL, - MSVCR120_DLL, MSVCR120_CLR0400_DLL, - MSVCRT_DLL, MSVCRT20_DLL,MSVCRT40_DLL - }; - return v; - } - - OutdatedDynamicCrt() = delete; - - std::regex crt_regex() const; - const std::string& toString() const; - - private: - explicit OutdatedDynamicCrt(const std::string& dll_name, const std::string& crt_regex_as_string) - : m_dll_name(dll_name), m_crt_regex_as_string(crt_regex_as_string) { } - - std::string m_dll_name; - std::string m_crt_regex_as_string; - }; -} diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index 5954089e9..90bd55843 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -7,7 +7,6 @@ #include "coff_file_reader.h" #include "PostBuildLint_BuildInfo.h" #include "PostBuildLint_BuildType.h" -#include "PostBuildLint_OutdatedDynamicCrt.h" namespace vcpkg::PostBuildLint { @@ -17,6 +16,41 @@ namespace vcpkg::PostBuildLint ERROR_DETECTED = 1 }; + struct OutdatedDynamicCrt + { + std::string name; + std::regex regex; + + OutdatedDynamicCrt(const std::string& name, const std::string& regex_as_string) + : name(name), regex(std::regex(regex_as_string, std::regex_constants::icase)) {} + }; + + const std::vector& get_outdated_dynamic_crts() + { + static const std::vector v = { + {"msvcp100.dll", R"(msvcp100\.dll)"}, + {"msvcp100d.dll", R"(msvcp100d\.dll)"}, + {"msvcp110.dll", R"(msvcp110\.dll)"}, + {"msvcp110_win.dll", R"(msvcp110_win\.dll)"}, + {"msvcp120.dll", R"(msvcp120\.dll)"}, + {"msvcp120_clr0400.dll", R"(msvcp120_clr0400\.dll)"}, + {"msvcp60.dll", R"(msvcp60\.dll)"}, + {"msvcp60.dll", R"(msvcp60\.dll)"}, + + {"msvcr100.dll", R"(msvcr100\.dll)"}, + {"msvcr100d.dll", R"(msvcr100d\.dll)"}, + {"msvcr100_clr0400.dll", R"(msvcr100_clr0400\.dll)"}, + {"msvcr110.dll", R"(msvcr110\.dll)"}, + {"msvcr120.dll", R"(msvcr120\.dll)"}, + {"msvcr120_clr0400.dll", R"(msvcr120_clr0400\.dll)"}, + {"msvcrt.dll", R"(msvcrt\.dll)"}, + {"msvcrt20.dll", R"(msvcrt20\.dll)"}, + {"msvcrt40.dll", R"(msvcrt40\.dll)"} + }; + + return v; + } + static lint_status check_for_files_in_include_directory(const fs::path& package_dir) { const fs::path include_dir = package_dir / "include"; @@ -516,7 +550,7 @@ namespace vcpkg::PostBuildLint static lint_status check_outdated_crt_linkage_of_dlls(const std::vector& dlls, const fs::path dumpbin_exe) { - const std::vector& outdated_crts = OutdatedDynamicCrt::values(); + const std::vector& outdated_crts = get_outdated_dynamic_crts(); std::vector dlls_with_outdated_crt; @@ -528,7 +562,7 @@ namespace vcpkg::PostBuildLint for (const OutdatedDynamicCrt& outdated_crt : outdated_crts) { - if (std::regex_search(ec_data.output.cbegin(), ec_data.output.cend(), outdated_crt.crt_regex())) + if (std::regex_search(ec_data.output.cbegin(), ec_data.output.cend(), outdated_crt.regex)) { dlls_with_outdated_crt.push_back({dll, outdated_crt}); break; @@ -542,7 +576,7 @@ namespace vcpkg::PostBuildLint System::println(""); for (const OutdatedDynamicCrt_and_file btf : dlls_with_outdated_crt) { - System::println(" %s: %s", btf.file.generic_string(), btf.outdated_crt.toString()); + System::println(" %s: %s", btf.file.generic_string(), btf.outdated_crt.name); } System::println(""); @@ -582,16 +616,21 @@ namespace vcpkg::PostBuildLint left += static_cast(right); } - void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths) + static size_t perform_all_checks_and_return_error_count(const package_spec& spec, const vcpkg_paths& paths) { const fs::path dumpbin_exe = Environment::get_dumpbin_exe(paths); - System::println("-- Performing post-build validation"); - BuildInfo build_info = read_build_info(paths.build_info_file_path(spec)); const fs::path package_dir = paths.package_dir(spec); size_t error_count = 0; + + auto it = build_info.policies.find(BuildPolicies::EMPTY_PACKAGE); + if (it != build_info.policies.cend() && it->second == opt_bool_t::ENABLED) + { + return error_count; + } + error_count += check_for_files_in_include_directory(package_dir); error_count += check_for_files_in_debug_include_directory(package_dir); error_count += check_for_files_in_debug_share_directory(package_dir); @@ -663,13 +702,22 @@ namespace vcpkg::PostBuildLint Checks::unreachable(); } #if 0 - error_count += check_no_subdirectories(package_dir / "lib"); - error_count += check_no_subdirectories(package_dir / "debug" / "lib"); + error_count += check_no_subdirectories(package_dir / "lib"); + error_count += check_no_subdirectories(package_dir / "debug" / "lib"); #endif error_count += check_no_empty_folders(package_dir); error_count += check_no_files_in_package_dir_and_debug_dir(package_dir); + return error_count; + } + + void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths) + { + System::println("-- Performing post-build validation"); + + const size_t error_count = perform_all_checks_and_return_error_count(spec, paths); + if (error_count != 0) { const fs::path portfile = paths.ports / spec.name() / "portfile.cmake"; diff --git a/toolsrc/src/PostBuildLint_BuildPolicies.cpp b/toolsrc/src/PostBuildLint_BuildPolicies.cpp index d7d67c991..4e5ac3cea 100644 --- a/toolsrc/src/PostBuildLint_BuildPolicies.cpp +++ b/toolsrc/src/PostBuildLint_BuildPolicies.cpp @@ -5,12 +5,15 @@ namespace vcpkg::PostBuildLint::BuildPolicies { static const std::string NAME_UNKNOWN = "PolicyUnknown"; + static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; const std::string& type::toString() const { switch (this->backing_enum) { + case EMPTY_PACKAGE: + return NAME_EMPTY_PACKAGE; case DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS; case UNKNOWN: @@ -22,10 +25,13 @@ namespace vcpkg::PostBuildLint::BuildPolicies const std::string& type::cmake_variable() const { + static const std::string CMAKE_VARIABLE_EMPTY_PACKAGE = "VCPKG_POLICY_EMPTY_PACKAGE"; static const std::string CMAKE_VARIABLE_DLLS_WITHOUT_LIBS = "VCPKG_POLICY_DLLS_WITHOUT_LIBS"; switch (this->backing_enum) { + case EMPTY_PACKAGE: + return CMAKE_VARIABLE_EMPTY_PACKAGE; case DLLS_WITHOUT_LIBS: return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS; case UNKNOWN: @@ -39,12 +45,17 @@ namespace vcpkg::PostBuildLint::BuildPolicies const std::vector& values() { - static const std::vector& v = {UNKNOWN, DLLS_WITHOUT_LIBS}; + static const std::vector& v = {UNKNOWN, EMPTY_PACKAGE, DLLS_WITHOUT_LIBS}; return v; } type parse(const std::string& s) { + if (s == NAME_EMPTY_PACKAGE) + { + return BuildPolicies::EMPTY_PACKAGE; + } + if (s == NAME_DLLS_WITHOUT_LIBS) { return BuildPolicies::DLLS_WITHOUT_LIBS; diff --git a/toolsrc/src/PostBuildLint_OutdatedDynamicCrt.cpp b/toolsrc/src/PostBuildLint_OutdatedDynamicCrt.cpp deleted file mode 100644 index 67965cd93..000000000 --- a/toolsrc/src/PostBuildLint_OutdatedDynamicCrt.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "pch.h" -#include "PostBuildLint_OutdatedDynamicCrt.h" - -namespace vcpkg::PostBuildLint -{ - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP100_DLL = OutdatedDynamicCrt("msvcp100.dll", R"(msvcp100\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP100D_DLL = OutdatedDynamicCrt("msvcp100d.dll", R"(msvcp100d\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP110_DLL = OutdatedDynamicCrt("msvcp110.dll", R"(msvcp110\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP110_WIN_DLL = OutdatedDynamicCrt("msvcp110_win.dll", R"(msvcp110_win\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP120_DLL = OutdatedDynamicCrt("msvcp120.dll", R"(msvcp120\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP120_CLR0400_DLL = OutdatedDynamicCrt("msvcp120_clr0400.dll", R"(msvcp120_clr0400\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP60_DLL = OutdatedDynamicCrt("msvcp60.dll", R"(msvcp60\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCP_WIN_DLL = OutdatedDynamicCrt("msvcp60.dll", R"(msvcp60\.dll)");; - - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR100_DLL = OutdatedDynamicCrt("msvcr100.dll", R"(msvcr100\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR100D_DLL = OutdatedDynamicCrt("msvcr100d.dll", R"(msvcr100d\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR100_CLR0400_DLL = OutdatedDynamicCrt("msvcr100_clr0400.dll", R"(msvcr100_clr0400\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR110_DLL = OutdatedDynamicCrt("msvcr110.dll", R"(msvcr110\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR120_DLL = OutdatedDynamicCrt("msvcr120.dll", R"(msvcr120\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCR120_CLR0400_DLL = OutdatedDynamicCrt("msvcr120_clr0400.dll", R"(msvcr120_clr0400\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCRT_DLL = OutdatedDynamicCrt("msvcrt.dll", R"(msvcrt\.dll)"); - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCRT20_DLL = OutdatedDynamicCrt("msvcrt20.dll", R"(msvcrt20\.dll)");; - const OutdatedDynamicCrt OutdatedDynamicCrt::MSVCRT40_DLL = OutdatedDynamicCrt("msvcrt40.dll", R"(msvcrt40\.dll)");; - - std::regex OutdatedDynamicCrt::crt_regex() const - { - const std::regex r(this->m_crt_regex_as_string, std::regex_constants::icase); - return r; - } - - const std::string& OutdatedDynamicCrt::toString() const - { - return this->m_dll_name; - } -} diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp index 7e8608e72..f49104d1e 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/commands_remove.cpp @@ -196,26 +196,29 @@ namespace vcpkg::Commands::Remove for (const package_spec_with_remove_plan& action : remove_plan) { - if (action.plan.plan_type == remove_plan_type::NOT_INSTALLED) - { - System::println(System::color::success, "Package %s is not installed", action.spec); - } - else if (action.plan.plan_type == remove_plan_type::REMOVE) - { - const std::string display_name = action.spec.display_name(); - System::println("Removing package %s... ", display_name); - remove_package(paths, action.spec, &status_db); - System::println(System::color::success, "Removing package %s... done", display_name); + const std::string display_name = action.spec.display_name(); - if (alsoRemoveFolderFromPackages) - { - System::println("Purging package %s... ", display_name); - delete_directory(paths.packages / action.spec.dir()); - System::println(System::color::success, "Purging package %s... done", display_name); - } + switch (action.plan.plan_type) + { + case remove_plan_type::NOT_INSTALLED: + System::println(System::color::success, "Package %s is not installed", display_name); + break; + case remove_plan_type::REMOVE: + System::println("Removing package %s... ", display_name); + remove_package(paths, action.spec, &status_db); + System::println(System::color::success, "Removing package %s... done", display_name); + break; + case remove_plan_type::UNKNOWN: + default: + Checks::unreachable(); + } + + if (alsoRemoveFolderFromPackages) + { + System::println("Purging package %s... ", display_name); + delete_directory(paths.packages / action.spec.dir()); + System::println(System::color::success, "Purging package %s... done", display_name); } - else - Checks::unreachable(); } exit(EXIT_SUCCESS); diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index d002f8d5f..2a651e294 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -154,7 +154,6 @@ - @@ -214,7 +213,6 @@ - diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 3359d9ada..99cbf7037 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -165,9 +165,6 @@ Source Files - - Source Files - Source Files @@ -293,8 +290,5 @@ Header Files - - Header Files - \ No newline at end of file