diff --git a/scripts/build_info.cmake b/scripts/build_info.cmake new file mode 100644 index 0000000000..45d81513f4 --- /dev/null +++ b/scripts/build_info.cmake @@ -0,0 +1,34 @@ +set(BUILD_INFO_FILE_PATH ${CURRENT_PACKAGES_DIR}/BUILD_INFO) +file(WRITE ${BUILD_INFO_FILE_PATH} "CRTLinkage: ${VCPKG_CRT_LINKAGE}\n") +file(APPEND ${BUILD_INFO_FILE_PATH} "LibraryLinkage: ${VCPKG_LIBRARY_LINKAGE}\n") + +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_DLLS_WITHOUT_EXPORTS) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutExports: ${VCPKG_POLICY_DLLS_WITHOUT_EXPORTS}\n") +endif() +if (DEFINED VCPKG_POLICY_EMPTY_PACKAGE) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyPackage: ${VCPKG_POLICY_EMPTY_PACKAGE}\n") +endif() +if (DEFINED VCPKG_POLICY_ONLY_RELEASE_CRT) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyOnlyReleaseCRT: ${VCPKG_POLICY_ONLY_RELEASE_CRT}\n") +endif() +if (DEFINED VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyAllowObsoleteMsvcrt: ${VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT}\n") +endif() +if (DEFINED VCPKG_POLICY_EMPTY_INCLUDE_FOLDER) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyIncludeFolder: ${VCPKG_POLICY_EMPTY_INCLUDE_FOLDER}\n") +endif() +if (DEFINED VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyAllowRestrictedHeaders: ${VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS}\n") +endif() +if (DEFINED VCPKG_POLICY_SKIP_DUMPBIN_CHECKS) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicySkipDumpbinChecks: ${VCPKG_POLICY_SKIP_DUMPBIN_CHECKS}\n") +endif() +if (DEFINED VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK) + file(APPEND ${BUILD_INFO_FILE_PATH} "PolicySkipArchitectureCheck: ${VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK}\n") +endif() +if (DEFINED VCPKG_HEAD_VERSION) + file(APPEND ${BUILD_INFO_FILE_PATH} "Version: ${VCPKG_HEAD_VERSION}\n") +endif() \ No newline at end of file diff --git a/scripts/ports.cmake b/scripts/ports.cmake index 9681427d76..fcec5ad2fb 100644 --- a/scripts/ports.cmake +++ b/scripts/ports.cmake @@ -88,38 +88,7 @@ if(CMD MATCHES "^BUILD$") include(${SCRIPTS}/cmake/vcpkg_common_definitions.cmake) include(${SCRIPTS}/cmake/vcpkg_common_functions.cmake) include(${CURRENT_PORT_DIR}/portfile.cmake) - - set(BUILD_INFO_FILE_PATH ${CURRENT_PACKAGES_DIR}/BUILD_INFO) - file(WRITE ${BUILD_INFO_FILE_PATH} "CRTLinkage: ${VCPKG_CRT_LINKAGE}\n") - file(APPEND ${BUILD_INFO_FILE_PATH} "LibraryLinkage: ${VCPKG_LIBRARY_LINKAGE}\n") - - 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_DLLS_WITHOUT_EXPORTS) - file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyDLLsWithoutExports: ${VCPKG_POLICY_DLLS_WITHOUT_EXPORTS}\n") - endif() - if (DEFINED VCPKG_POLICY_EMPTY_PACKAGE) - file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyPackage: ${VCPKG_POLICY_EMPTY_PACKAGE}\n") - endif() - if (DEFINED VCPKG_POLICY_ONLY_RELEASE_CRT) - file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyOnlyReleaseCRT: ${VCPKG_POLICY_ONLY_RELEASE_CRT}\n") - endif() - if (DEFINED VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT) - file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyAllowObsoleteMsvcrt: ${VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT}\n") - endif() - if (DEFINED VCPKG_POLICY_EMPTY_INCLUDE_FOLDER) - file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyEmptyIncludeFolder: ${VCPKG_POLICY_EMPTY_INCLUDE_FOLDER}\n") - endif() - if (DEFINED VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS) - file(APPEND ${BUILD_INFO_FILE_PATH} "PolicyAllowRestrictedHeaders: ${VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS}\n") - endif() - if (DEFINED VCPKG_POLICY_SKIP_DUMPBIN_CHECKS) - file(APPEND ${BUILD_INFO_FILE_PATH} "PolicySkipDumpbinChecks: ${VCPKG_POLICY_SKIP_DUMPBIN_CHECKS}\n") - endif() - if (DEFINED VCPKG_HEAD_VERSION) - file(APPEND ${BUILD_INFO_FILE_PATH} "Version: ${VCPKG_HEAD_VERSION}\n") - endif() + include(${SCRIPTS}/build_info.cmake) 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/vcpkg/build.h b/toolsrc/include/vcpkg/build.h index 892fb23707..d8e87f1316 100644 --- a/toolsrc/include/vcpkg/build.h +++ b/toolsrc/include/vcpkg/build.h @@ -222,6 +222,7 @@ namespace vcpkg::Build ALLOW_OBSOLETE_MSVCRT, ALLOW_RESTRICTED_HEADERS, SKIP_DUMPBIN_CHECKS, + SKIP_ARCHITECTURE_CHECK, // Must be last COUNT, }; @@ -235,6 +236,7 @@ namespace vcpkg::Build BuildPolicy::ALLOW_OBSOLETE_MSVCRT, BuildPolicy::ALLOW_RESTRICTED_HEADERS, BuildPolicy::SKIP_DUMPBIN_CHECKS, + BuildPolicy::SKIP_ARCHITECTURE_CHECK }; const std::string& to_string(BuildPolicy policy); diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 937c6b0a79..e4c7667d55 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -160,6 +160,7 @@ namespace vcpkg::Build static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt"; static const std::string NAME_ALLOW_RESTRICTED_HEADERS = "PolicyAllowRestrictedHeaders"; static const std::string NAME_SKIP_DUMPBIN_CHECKS = "PolicySkipDumpbinChecks"; + static const std::string NAME_SKIP_ARCHITECTURE_CHECK = "PolicySkipArchitectureCheck"; const std::string& to_string(BuildPolicy policy) { @@ -173,6 +174,7 @@ namespace vcpkg::Build case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT; case BuildPolicy::ALLOW_RESTRICTED_HEADERS: return NAME_ALLOW_RESTRICTED_HEADERS; case BuildPolicy::SKIP_DUMPBIN_CHECKS: return NAME_SKIP_DUMPBIN_CHECKS; + case BuildPolicy::SKIP_ARCHITECTURE_CHECK: return NAME_SKIP_ARCHITECTURE_CHECK; default: Checks::unreachable(VCPKG_LINE_INFO); } } @@ -189,6 +191,7 @@ namespace vcpkg::Build case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT"; case BuildPolicy::ALLOW_RESTRICTED_HEADERS: return "VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS"; case BuildPolicy::SKIP_DUMPBIN_CHECKS: return "VCPKG_POLICY_SKIP_DUMPBIN_CHECKS"; + case BuildPolicy::SKIP_ARCHITECTURE_CHECK: return "VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK"; default: Checks::unreachable(VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp index 663d2e3c9c..8b2810200b 100644 --- a/toolsrc/src/vcpkg/postbuildlint.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.cpp @@ -871,11 +871,11 @@ namespace vcpkg::PostBuildLint if (!pre_build_info.build_type) error_count += check_matching_debug_and_release_binaries(debug_libs, release_libs); + if (!build_info.policies.is_enabled(BuildPolicy::SKIP_ARCHITECTURE_CHECK)) { std::vector libs; libs.insert(libs.cend(), debug_libs.cbegin(), debug_libs.cend()); libs.insert(libs.cend(), release_libs.cbegin(), release_libs.cend()); - error_count += check_lib_architecture(pre_build_info.target_architecture, libs); }