diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-03-03 19:00:48 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-03-03 19:00:48 -0800 |
| commit | c2a368976dcd42640290a6ef30c5a4fc8a4a825d (patch) | |
| tree | f9ab145ac87ed8de668aa822b16f99560f98b6fd /toolsrc/src | |
| parent | e44aae7210a5c13e8748854dff478905c371defa (diff) | |
| download | vcpkg-c2a368976dcd42640290a6ef30c5a4fc8a4a825d.tar.gz vcpkg-c2a368976dcd42640290a6ef30c5a4fc8a4a825d.zip | |
Add policy: NoDebugBinaries
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/PostBuildLint.cpp | 19 | ||||
| -rw-r--r-- | toolsrc/src/PostBuildLint_BuildPolicies.cpp | 11 |
2 files changed, 27 insertions, 3 deletions
diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index bc02a16a8..b0edaf805 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -601,6 +601,17 @@ namespace vcpkg::PostBuildLint left += static_cast<size_t>(right); } + template <class T> + static bool contains_and_enabled(const std::map<T, opt_bool_t> map, const T& key) + { + auto it = map.find(key); + if (it != map.cend() && it->second == opt_bool_t::ENABLED) + { + return true; + } + + return false; + } static size_t perform_all_checks_and_return_error_count(const package_spec& spec, const vcpkg_paths& paths) { @@ -611,8 +622,7 @@ namespace vcpkg::PostBuildLint 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) + if (contains_and_enabled(build_info.policies, BuildPolicies::EMPTY_PACKAGE)) { return error_count; } @@ -674,7 +684,10 @@ namespace vcpkg::PostBuildLint error_count += check_bin_folders_are_not_present_in_static_build(package_dir); - error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::DEBUG, build_info.crt_linkage), debug_libs, dumpbin_exe); + if (!contains_and_enabled(build_info.policies, BuildPolicies::NO_DEBUG_BINARIES)) + { + error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::DEBUG, build_info.crt_linkage), debug_libs, dumpbin_exe); + } error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, build_info.crt_linkage), release_libs, dumpbin_exe); break; } diff --git a/toolsrc/src/PostBuildLint_BuildPolicies.cpp b/toolsrc/src/PostBuildLint_BuildPolicies.cpp index 53dfcf95a..2e0a1713b 100644 --- a/toolsrc/src/PostBuildLint_BuildPolicies.cpp +++ b/toolsrc/src/PostBuildLint_BuildPolicies.cpp @@ -8,6 +8,7 @@ namespace vcpkg::PostBuildLint::BuildPolicies static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; + static const std::string NAME_NO_DEBUG_BINARIES = "PolicyNoDebugBinaries"; const std::string& type::toString() const { @@ -17,6 +18,8 @@ namespace vcpkg::PostBuildLint::BuildPolicies return NAME_EMPTY_PACKAGE; case DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS; + case NO_DEBUG_BINARIES: + return NAME_NO_DEBUG_BINARIES; case NULLVALUE: return NULLVALUE_STRING; default: @@ -28,6 +31,7 @@ namespace vcpkg::PostBuildLint::BuildPolicies { 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"; + static const std::string CMAKE_VARIABLE_NO_DEBUG_BINARIES = "VCPKG_POLICY_NO_DEBUG_BINARIES"; switch (this->backing_enum) { @@ -35,6 +39,8 @@ namespace vcpkg::PostBuildLint::BuildPolicies return CMAKE_VARIABLE_EMPTY_PACKAGE; case DLLS_WITHOUT_LIBS: return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS; + case NO_DEBUG_BINARIES: + return CMAKE_VARIABLE_NO_DEBUG_BINARIES; case NULLVALUE: Enums::nullvalue_used(ENUM_NAME); default: @@ -54,6 +60,11 @@ namespace vcpkg::PostBuildLint::BuildPolicies return BuildPolicies::DLLS_WITHOUT_LIBS; } + if (s == NAME_NO_DEBUG_BINARIES) + { + return BuildPolicies::NO_DEBUG_BINARIES; + } + return BuildPolicies::NULLVALUE; } } |
