diff options
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg/base/files.cpp | 14 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/build.cpp | 18 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/postbuildlint.cpp | 5 |
3 files changed, 20 insertions, 17 deletions
diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 4cccebd45..891207445 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -26,20 +26,6 @@ namespace { -#if defined(_WIN32) - struct IsSlash - { - bool operator()(const wchar_t c) const noexcept { return c == L'/' || c == L'\\'; } - }; -#else - struct IsSlash - { - bool operator()(const char c) const noexcept { return c == '/'; } - }; -#endif - - constexpr IsSlash is_slash; - struct NativeStringView { const fs::path::value_type* first; diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index c20f48b36..bae937277 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -203,6 +203,7 @@ namespace vcpkg::Build static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; static const std::string NAME_DLLS_WITHOUT_EXPORTS = "PolicyDLLsWithoutExports"; + static const std::string NAME_MISMATCHED_NUMBER_OF_BINARIES = "PolicyMismatchedNumberOfBinaries"; static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT"; static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder"; static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt"; @@ -210,6 +211,19 @@ namespace vcpkg::Build static const std::string NAME_SKIP_DUMPBIN_CHECKS = "PolicySkipDumpbinChecks"; static const std::string NAME_SKIP_ARCHITECTURE_CHECK = "PolicySkipArchitectureCheck"; + static std::remove_const_t<decltype(ALL_POLICIES)> generate_all_policies() + { + std::remove_const_t<decltype(ALL_POLICIES)> res; + for (size_t i = 0; i < res.size(); ++i) + { + res[i] = static_cast<BuildPolicy>(i); + } + + return res; + } + + decltype(ALL_POLICIES) ALL_POLICIES = generate_all_policies(); + const std::string& to_string(BuildPolicy policy) { switch (policy) @@ -217,6 +231,7 @@ namespace vcpkg::Build case BuildPolicy::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE; case BuildPolicy::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS; case BuildPolicy::DLLS_WITHOUT_EXPORTS: return NAME_DLLS_WITHOUT_EXPORTS; + case BuildPolicy::MISMATCHED_NUMBER_OF_BINARIES: return NAME_MISMATCHED_NUMBER_OF_BINARIES; case BuildPolicy::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT; case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER; case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT; @@ -234,6 +249,7 @@ namespace vcpkg::Build case BuildPolicy::EMPTY_PACKAGE: return "VCPKG_POLICY_EMPTY_PACKAGE"; case BuildPolicy::DLLS_WITHOUT_LIBS: return "VCPKG_POLICY_DLLS_WITHOUT_LIBS"; case BuildPolicy::DLLS_WITHOUT_EXPORTS: return "VCPKG_POLICY_DLLS_WITHOUT_EXPORTS"; + case BuildPolicy::MISMATCHED_NUMBER_OF_BINARIES: return "VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES"; case BuildPolicy::ONLY_RELEASE_CRT: return "VCPKG_POLICY_ONLY_RELEASE_CRT"; case BuildPolicy::EMPTY_INCLUDE_FOLDER: return "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER"; case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT"; @@ -1221,7 +1237,7 @@ namespace vcpkg::Build if (!version.empty()) build_info.version = std::move(version); std::map<BuildPolicy, bool> policies; - for (auto policy : G_ALL_POLICIES) + for (auto policy : ALL_POLICIES) { const auto setting = parser.optional_field(to_string(policy)); if (setting.empty()) continue; diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp index 7b8e65ed6..8490ac364 100644 --- a/toolsrc/src/vcpkg/postbuildlint.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.cpp @@ -872,7 +872,7 @@ namespace vcpkg::PostBuildLint std::vector<fs::path> release_libs = fs.get_files_recursive(release_lib_dir); Util::erase_remove_if(release_libs, not_extension_pred(fs, ".lib")); - if (!pre_build_info.build_type) + if (!pre_build_info.build_type && !build_info.policies.is_enabled(BuildPolicy::MISMATCHED_NUMBER_OF_BINARIES)) error_count += check_matching_debug_and_release_binaries(debug_libs, release_libs); if (!build_info.policies.is_enabled(BuildPolicy::SKIP_ARCHITECTURE_CHECK)) @@ -892,7 +892,8 @@ namespace vcpkg::PostBuildLint { case Build::LinkageType::DYNAMIC: { - if (!pre_build_info.build_type) + if (!pre_build_info.build_type && + !build_info.policies.is_enabled(BuildPolicy::MISMATCHED_NUMBER_OF_BINARIES)) error_count += check_matching_debug_and_release_binaries(debug_dlls, release_dlls); error_count += check_lib_files_are_available_if_dlls_are_available( |
