mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-23 11:07:10 +01:00
Add policy: NoDebugBinaries
This commit is contained in:
parent
e44aae7210
commit
c2a368976d
@ -82,6 +82,9 @@ if(CMD MATCHES "^BUILD$")
|
|||||||
if (DEFINED VCPKG_POLICY_EMPTY_PACKAGE)
|
if (DEFINED VCPKG_POLICY_EMPTY_PACKAGE)
|
||||||
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyPackage: ${VCPKG_POLICY_EMPTY_PACKAGE}\n")
|
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyPackage: ${VCPKG_POLICY_EMPTY_PACKAGE}\n")
|
||||||
endif()
|
endif()
|
||||||
|
if (DEFINED VCPKG_POLICY_NO_DEBUG_BINARIES)
|
||||||
|
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyNoDebugBinaries: ${VCPKG_POLICY_NO_DEBUG_BINARIES}\n")
|
||||||
|
endif()
|
||||||
elseif(CMD MATCHES "^CREATE$")
|
elseif(CMD MATCHES "^CREATE$")
|
||||||
file(TO_NATIVE_PATH ${VCPKG_ROOT_DIR} NATIVE_VCPKG_ROOT_DIR)
|
file(TO_NATIVE_PATH ${VCPKG_ROOT_DIR} NATIVE_VCPKG_ROOT_DIR)
|
||||||
file(TO_NATIVE_PATH ${DOWNLOADS} NATIVE_DOWNLOADS)
|
file(TO_NATIVE_PATH ${DOWNLOADS} NATIVE_DOWNLOADS)
|
||||||
|
@ -8,7 +8,8 @@ namespace vcpkg::PostBuildLint::BuildPolicies
|
|||||||
{
|
{
|
||||||
NULLVALUE = 0,
|
NULLVALUE = 0,
|
||||||
EMPTY_PACKAGE,
|
EMPTY_PACKAGE,
|
||||||
DLLS_WITHOUT_LIBS
|
DLLS_WITHOUT_LIBS,
|
||||||
|
NO_DEBUG_BINARIES
|
||||||
};
|
};
|
||||||
|
|
||||||
struct type
|
struct type
|
||||||
@ -29,8 +30,9 @@ namespace vcpkg::PostBuildLint::BuildPolicies
|
|||||||
static constexpr type NULLVALUE(backing_enum_t::NULLVALUE);
|
static constexpr type NULLVALUE(backing_enum_t::NULLVALUE);
|
||||||
static constexpr type EMPTY_PACKAGE(backing_enum_t::EMPTY_PACKAGE);
|
static constexpr type EMPTY_PACKAGE(backing_enum_t::EMPTY_PACKAGE);
|
||||||
static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS);
|
static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS);
|
||||||
|
static constexpr type NO_DEBUG_BINARIES(backing_enum_t::NO_DEBUG_BINARIES);
|
||||||
|
|
||||||
static constexpr std::array<type, 2> values = { EMPTY_PACKAGE, DLLS_WITHOUT_LIBS };
|
static constexpr std::array<type, 3> values = { EMPTY_PACKAGE, DLLS_WITHOUT_LIBS, NO_DEBUG_BINARIES };
|
||||||
|
|
||||||
type parse(const std::string& s);
|
type parse(const std::string& s);
|
||||||
}
|
}
|
||||||
|
@ -601,6 +601,17 @@ namespace vcpkg::PostBuildLint
|
|||||||
left += static_cast<size_t>(right);
|
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)
|
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;
|
size_t error_count = 0;
|
||||||
|
|
||||||
auto it = build_info.policies.find(BuildPolicies::EMPTY_PACKAGE);
|
if (contains_and_enabled(build_info.policies, BuildPolicies::EMPTY_PACKAGE))
|
||||||
if (it != build_info.policies.cend() && it->second == opt_bool_t::ENABLED)
|
|
||||||
{
|
{
|
||||||
return error_count;
|
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_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);
|
error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, build_info.crt_linkage), release_libs, dumpbin_exe);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ namespace vcpkg::PostBuildLint::BuildPolicies
|
|||||||
|
|
||||||
static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage";
|
static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage";
|
||||||
static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs";
|
static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs";
|
||||||
|
static const std::string NAME_NO_DEBUG_BINARIES = "PolicyNoDebugBinaries";
|
||||||
|
|
||||||
const std::string& type::toString() const
|
const std::string& type::toString() const
|
||||||
{
|
{
|
||||||
@ -17,6 +18,8 @@ namespace vcpkg::PostBuildLint::BuildPolicies
|
|||||||
return NAME_EMPTY_PACKAGE;
|
return NAME_EMPTY_PACKAGE;
|
||||||
case DLLS_WITHOUT_LIBS:
|
case DLLS_WITHOUT_LIBS:
|
||||||
return NAME_DLLS_WITHOUT_LIBS;
|
return NAME_DLLS_WITHOUT_LIBS;
|
||||||
|
case NO_DEBUG_BINARIES:
|
||||||
|
return NAME_NO_DEBUG_BINARIES;
|
||||||
case NULLVALUE:
|
case NULLVALUE:
|
||||||
return NULLVALUE_STRING;
|
return NULLVALUE_STRING;
|
||||||
default:
|
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_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_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)
|
switch (this->backing_enum)
|
||||||
{
|
{
|
||||||
@ -35,6 +39,8 @@ namespace vcpkg::PostBuildLint::BuildPolicies
|
|||||||
return CMAKE_VARIABLE_EMPTY_PACKAGE;
|
return CMAKE_VARIABLE_EMPTY_PACKAGE;
|
||||||
case DLLS_WITHOUT_LIBS:
|
case DLLS_WITHOUT_LIBS:
|
||||||
return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS;
|
return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS;
|
||||||
|
case NO_DEBUG_BINARIES:
|
||||||
|
return CMAKE_VARIABLE_NO_DEBUG_BINARIES;
|
||||||
case NULLVALUE:
|
case NULLVALUE:
|
||||||
Enums::nullvalue_used(ENUM_NAME);
|
Enums::nullvalue_used(ENUM_NAME);
|
||||||
default:
|
default:
|
||||||
@ -54,6 +60,11 @@ namespace vcpkg::PostBuildLint::BuildPolicies
|
|||||||
return BuildPolicies::DLLS_WITHOUT_LIBS;
|
return BuildPolicies::DLLS_WITHOUT_LIBS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s == NAME_NO_DEBUG_BINARIES)
|
||||||
|
{
|
||||||
|
return BuildPolicies::NO_DEBUG_BINARIES;
|
||||||
|
}
|
||||||
|
|
||||||
return BuildPolicies::NULLVALUE;
|
return BuildPolicies::NULLVALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user