mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-23 11:07:10 +01:00
Introduce new policy to skip post verification of dll exports (#9642)
* - Introduce new policy to skip post verification of dll exports (see issue #9641). * - Fixed line endings.
This commit is contained in:
parent
bdae0904c4
commit
299c7c730c
@ -100,6 +100,9 @@ if(CMD MATCHES "^BUILD$")
|
|||||||
if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_LIBS)
|
if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_LIBS)
|
||||||
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutLIBs: ${VCPKG_POLICY_DLLS_WITHOUT_LIBS}\n")
|
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutLIBs: ${VCPKG_POLICY_DLLS_WITHOUT_LIBS}\n")
|
||||||
endif()
|
endif()
|
||||||
|
if (DEFINED VCPKG_POLICY_DLLS_WITHOUT_EXPORTS)
|
||||||
|
file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutExports: ${VCPKG_POLICY_DLLS_WITHOUT_EXPORTS}\n")
|
||||||
|
endif()
|
||||||
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()
|
||||||
|
@ -219,6 +219,7 @@ namespace vcpkg::Build
|
|||||||
{
|
{
|
||||||
EMPTY_PACKAGE,
|
EMPTY_PACKAGE,
|
||||||
DLLS_WITHOUT_LIBS,
|
DLLS_WITHOUT_LIBS,
|
||||||
|
DLLS_WITHOUT_EXPORTS,
|
||||||
ONLY_RELEASE_CRT,
|
ONLY_RELEASE_CRT,
|
||||||
EMPTY_INCLUDE_FOLDER,
|
EMPTY_INCLUDE_FOLDER,
|
||||||
ALLOW_OBSOLETE_MSVCRT,
|
ALLOW_OBSOLETE_MSVCRT,
|
||||||
@ -229,6 +230,7 @@ namespace vcpkg::Build
|
|||||||
constexpr std::array<BuildPolicy, size_t(BuildPolicy::COUNT)> G_ALL_POLICIES = {
|
constexpr std::array<BuildPolicy, size_t(BuildPolicy::COUNT)> G_ALL_POLICIES = {
|
||||||
BuildPolicy::EMPTY_PACKAGE,
|
BuildPolicy::EMPTY_PACKAGE,
|
||||||
BuildPolicy::DLLS_WITHOUT_LIBS,
|
BuildPolicy::DLLS_WITHOUT_LIBS,
|
||||||
|
BuildPolicy::DLLS_WITHOUT_EXPORTS,
|
||||||
BuildPolicy::ONLY_RELEASE_CRT,
|
BuildPolicy::ONLY_RELEASE_CRT,
|
||||||
BuildPolicy::EMPTY_INCLUDE_FOLDER,
|
BuildPolicy::EMPTY_INCLUDE_FOLDER,
|
||||||
BuildPolicy::ALLOW_OBSOLETE_MSVCRT,
|
BuildPolicy::ALLOW_OBSOLETE_MSVCRT,
|
||||||
|
@ -129,6 +129,7 @@ namespace vcpkg::Build
|
|||||||
{
|
{
|
||||||
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_DLLS_WITHOUT_EXPORTS = "PolicyDLLsWithoutExports";
|
||||||
static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT";
|
static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT";
|
||||||
static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder";
|
static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder";
|
||||||
static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt";
|
static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt";
|
||||||
@ -139,6 +140,7 @@ namespace vcpkg::Build
|
|||||||
{
|
{
|
||||||
case BuildPolicy::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE;
|
case BuildPolicy::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE;
|
||||||
case BuildPolicy::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS;
|
case BuildPolicy::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS;
|
||||||
|
case BuildPolicy::DLLS_WITHOUT_EXPORTS: return NAME_DLLS_WITHOUT_EXPORTS;
|
||||||
case BuildPolicy::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT;
|
case BuildPolicy::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT;
|
||||||
case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER;
|
case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER;
|
||||||
case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT;
|
case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT;
|
||||||
@ -152,6 +154,7 @@ namespace vcpkg::Build
|
|||||||
{
|
{
|
||||||
case BuildPolicy::EMPTY_PACKAGE: return "VCPKG_POLICY_EMPTY_PACKAGE";
|
case BuildPolicy::EMPTY_PACKAGE: return "VCPKG_POLICY_EMPTY_PACKAGE";
|
||||||
case BuildPolicy::DLLS_WITHOUT_LIBS: return "VCPKG_POLICY_DLLS_WITHOUT_LIBS";
|
case BuildPolicy::DLLS_WITHOUT_LIBS: return "VCPKG_POLICY_DLLS_WITHOUT_LIBS";
|
||||||
|
case BuildPolicy::DLLS_WITHOUT_EXPORTS: return "VCPKG_POLICY_DLLS_WITHOUT_EXPORTS";
|
||||||
case BuildPolicy::ONLY_RELEASE_CRT: return "VCPKG_POLICY_ONLY_RELEASE_CRT";
|
case BuildPolicy::ONLY_RELEASE_CRT: return "VCPKG_POLICY_ONLY_RELEASE_CRT";
|
||||||
case BuildPolicy::EMPTY_INCLUDE_FOLDER: return "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER";
|
case BuildPolicy::EMPTY_INCLUDE_FOLDER: return "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER";
|
||||||
case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT";
|
case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT";
|
||||||
|
@ -295,8 +295,10 @@ namespace vcpkg::PostBuildLint
|
|||||||
return LintStatus::SUCCESS;
|
return LintStatus::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static LintStatus check_exports_of_dlls(const std::vector<fs::path>& dlls, const fs::path& dumpbin_exe)
|
static LintStatus check_exports_of_dlls(const Build::BuildPolicies& policies, const std::vector<fs::path>& dlls, const fs::path& dumpbin_exe)
|
||||||
{
|
{
|
||||||
|
if (policies.is_enabled(BuildPolicy::DLLS_WITHOUT_EXPORTS)) return LintStatus::SUCCESS;
|
||||||
|
|
||||||
std::vector<fs::path> dlls_with_no_exports;
|
std::vector<fs::path> dlls_with_no_exports;
|
||||||
for (const fs::path& dll : dlls)
|
for (const fs::path& dll : dlls)
|
||||||
{
|
{
|
||||||
@ -316,6 +318,10 @@ namespace vcpkg::PostBuildLint
|
|||||||
System::print2(System::Color::warning, "The following DLLs have no exports:\n");
|
System::print2(System::Color::warning, "The following DLLs have no exports:\n");
|
||||||
Files::print_paths(dlls_with_no_exports);
|
Files::print_paths(dlls_with_no_exports);
|
||||||
System::print2(System::Color::warning, "DLLs without any exports are likely a bug in the build script.\n");
|
System::print2(System::Color::warning, "DLLs without any exports are likely a bug in the build script.\n");
|
||||||
|
System::printf(System::Color::warning,
|
||||||
|
"If this is intended, add the following line in the portfile:\n"
|
||||||
|
" SET(%s enabled)\n",
|
||||||
|
to_cmake_variable(BuildPolicy::DLLS_WITHOUT_EXPORTS));
|
||||||
return LintStatus::ERROR_DETECTED;
|
return LintStatus::ERROR_DETECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,7 +815,7 @@ namespace vcpkg::PostBuildLint
|
|||||||
|
|
||||||
if (!toolset.dumpbin.empty())
|
if (!toolset.dumpbin.empty())
|
||||||
{
|
{
|
||||||
error_count += check_exports_of_dlls(dlls, toolset.dumpbin);
|
error_count += check_exports_of_dlls(build_info.policies, dlls, toolset.dumpbin);
|
||||||
error_count += check_uwp_bit_of_dlls(pre_build_info.cmake_system_name, dlls, toolset.dumpbin);
|
error_count += check_uwp_bit_of_dlls(pre_build_info.cmake_system_name, dlls, toolset.dumpbin);
|
||||||
error_count +=
|
error_count +=
|
||||||
check_outdated_crt_linkage_of_dlls(dlls, toolset.dumpbin, build_info, pre_build_info);
|
check_outdated_crt_linkage_of_dlls(dlls, toolset.dumpbin, build_info, pre_build_info);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user