From bd8c07217a27bcf357a393c891b756d3f54c3623 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Tue, 4 Feb 2020 10:58:38 +0100 Subject: [vcpkg] Add skip dumpbin checks and correct some cmake advices. Paths should always be handled with "${PATH}" due to possible spaces --- toolsrc/src/vcpkg/build.cpp | 3 +++ toolsrc/src/vcpkg/postbuildlint.cpp | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'toolsrc/src') diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index bcacb331a..2eab501f0 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -173,6 +173,7 @@ namespace vcpkg::Build static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder"; static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt"; static const std::string NAME_ALLOW_RESTRICTED_HEADERS = "PolicyAllowRestrictedHeaders"; + static const std::string SKIP_DUMPBIN_CHECKS = "PolicySkipDumpbinChecks"; const std::string& to_string(BuildPolicy policy) { @@ -185,6 +186,7 @@ namespace vcpkg::Build case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER; 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 SKIP_DUMPBIN_CHECKS; default: Checks::unreachable(VCPKG_LINE_INFO); } } @@ -200,6 +202,7 @@ namespace vcpkg::Build 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_RESTRICTED_HEADERS: return "VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS"; + case BuildPolicy::SKIP_DUMPBIN_CHECKS: return "VCPKG_POLICY_SKIP_DUMPBIN_CHECKS"; default: Checks::unreachable(VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp index b346e1721..64018f9d1 100644 --- a/toolsrc/src/vcpkg/postbuildlint.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.cpp @@ -200,7 +200,7 @@ namespace vcpkg::PostBuildLint System::print2(System::Color::warning, "Include files should not be duplicated into the /debug/include directory. If this cannot " "be disabled in the project cmake, use\n" - " file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)\n"); + " file(REMOVE_RECURSE \"${CURRENT_PACKAGES_DIR}/debug/include)\"\n"); return LintStatus::ERROR_DETECTED; } @@ -215,7 +215,7 @@ namespace vcpkg::PostBuildLint { System::print2(System::Color::warning, "/debug/share should not exist. Please reorganize any important files, then use\n" - " file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)\n"); + " file(REMOVE_RECURSE \"${CURRENT_PACKAGES_DIR}/debug/share)\"\n"); return LintStatus::ERROR_DETECTED; } @@ -349,8 +349,8 @@ namespace vcpkg::PostBuildLint const fs::path relative_path = found_file.string().erase( 0, current_buildtrees_dir.string().size() + 1); // The +1 is needed to remove the "/" System::printf( - "\n file(COPY ${CURRENT_BUILDTREES_DIR}/%s DESTINATION ${CURRENT_PACKAGES_DIR}/share/%s)\n" - " file(RENAME ${CURRENT_PACKAGES_DIR}/share/%s/%s ${CURRENT_PACKAGES_DIR}/share/%s/copyright)\n", + "\n file(COPY \"${CURRENT_BUILDTREES_DIR}/%s\" DESTINATION \"${CURRENT_PACKAGES_DIR}/share/%s\")\n" + " file(RENAME \"${CURRENT_PACKAGES_DIR}/share/%s/%s\" \"${CURRENT_PACKAGES_DIR}/share/%s/copyright\")\n", relative_path.generic_string(), spec.name(), spec.name(), @@ -662,7 +662,7 @@ namespace vcpkg::PostBuildLint "\n" R"###( if(VCPKG_LIBRARY_LINKAGE STREQUAL "static"))###" "\n" - R"###( file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin))###" + R"###( file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin"))###" "\n" R"###( endif())###" "\n\n"); @@ -689,7 +689,7 @@ namespace vcpkg::PostBuildLint "If the directories are not needed and their creation cannot be disabled, use something like this in " "the portfile to remove them:\n" "\n" - R"###( file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/a/dir ${CURRENT_PACKAGES_DIR}/some/other/dir))###" + R"###( file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/a/dir" "${CURRENT_PACKAGES_DIR}/some/other/dir"))###" "\n" "\n" "\n"); @@ -903,7 +903,7 @@ namespace vcpkg::PostBuildLint dlls.insert(dlls.cend(), debug_dlls.cbegin(), debug_dlls.cend()); dlls.insert(dlls.cend(), release_dlls.cbegin(), release_dlls.cend()); - if (!toolset.dumpbin.empty()) + if (!toolset.dumpbin.empty() && !build_info.policies.is_enabled(BuildPolicy::SKIP_DUMPBIN_CHECKS)) { 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); @@ -924,7 +924,7 @@ namespace vcpkg::PostBuildLint error_count += check_bin_folders_are_not_present_in_static_build(fs, package_dir); - if (!toolset.dumpbin.empty()) + if (!toolset.dumpbin.empty() && !build_info.policies.is_enabled(BuildPolicy::SKIP_DUMPBIN_CHECKS)) { if (!build_info.policies.is_enabled(BuildPolicy::ONLY_RELEASE_CRT)) { -- cgit v1.2.3 From 9298dec358d145b0feb0d7336f755c639fbacde8 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Tue, 4 Feb 2020 20:36:54 +0100 Subject: rename string variable to NAME_SKIP_DUMPBIN_CHECKS --- toolsrc/src/vcpkg/build.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toolsrc/src') diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 2eab501f0..c65cf9b77 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -173,7 +173,7 @@ namespace vcpkg::Build static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder"; static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt"; static const std::string NAME_ALLOW_RESTRICTED_HEADERS = "PolicyAllowRestrictedHeaders"; - static const std::string SKIP_DUMPBIN_CHECKS = "PolicySkipDumpbinChecks"; + static const std::string NAME_SKIP_DUMPBIN_CHECKS = "PolicySkipDumpbinChecks"; const std::string& to_string(BuildPolicy policy) { @@ -186,7 +186,7 @@ namespace vcpkg::Build case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER; 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 SKIP_DUMPBIN_CHECKS; + case BuildPolicy::SKIP_DUMPBIN_CHECKS: return NAME_SKIP_DUMPBIN_CHECKS; default: Checks::unreachable(VCPKG_LINE_INFO); } } -- cgit v1.2.3 From 877ebc43249461196670dbecd3c1cfd5a6265d2a Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Wed, 5 Feb 2020 08:59:05 +0100 Subject: Move " to correct position and change copyright copy to use configure_file --- toolsrc/src/vcpkg/postbuildlint.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'toolsrc/src') diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp index 64018f9d1..663d2e3c9 100644 --- a/toolsrc/src/vcpkg/postbuildlint.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.cpp @@ -200,7 +200,7 @@ namespace vcpkg::PostBuildLint System::print2(System::Color::warning, "Include files should not be duplicated into the /debug/include directory. If this cannot " "be disabled in the project cmake, use\n" - " file(REMOVE_RECURSE \"${CURRENT_PACKAGES_DIR}/debug/include)\"\n"); + " file(REMOVE_RECURSE \"${CURRENT_PACKAGES_DIR}/debug/include\")\n"); return LintStatus::ERROR_DETECTED; } @@ -215,7 +215,7 @@ namespace vcpkg::PostBuildLint { System::print2(System::Color::warning, "/debug/share should not exist. Please reorganize any important files, then use\n" - " file(REMOVE_RECURSE \"${CURRENT_PACKAGES_DIR}/debug/share)\"\n"); + " file(REMOVE_RECURSE \"${CURRENT_PACKAGES_DIR}/debug/share\")\n"); return LintStatus::ERROR_DETECTED; } @@ -349,11 +349,8 @@ namespace vcpkg::PostBuildLint const fs::path relative_path = found_file.string().erase( 0, current_buildtrees_dir.string().size() + 1); // The +1 is needed to remove the "/" System::printf( - "\n file(COPY \"${CURRENT_BUILDTREES_DIR}/%s\" DESTINATION \"${CURRENT_PACKAGES_DIR}/share/%s\")\n" - " file(RENAME \"${CURRENT_PACKAGES_DIR}/share/%s/%s\" \"${CURRENT_PACKAGES_DIR}/share/%s/copyright\")\n", + "\n configure_file(\"${CURRENT_BUILDTREES_DIR}/%s/%s\" \"${CURRENT_PACKAGES_DIR}/share/%s/copyright\" COPYONLY)\n", relative_path.generic_string(), - spec.name(), - spec.name(), found_file.filename().generic_string(), spec.name()); } -- cgit v1.2.3