aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2018-03-02 08:59:17 -0800
committerRobert Schumacher <roschuma@microsoft.com>2018-03-02 09:25:32 -0800
commitbad51b04626f25d323433ec159af1d60f93cadb1 (patch)
tree8338776b1b8901a11327b55663690aeb68f11f94 /toolsrc/src
parent01ba04e9a737a2b68993e196b7980ce56b8fde00 (diff)
downloadvcpkg-bad51b04626f25d323433ec159af1d60f93cadb1.tar.gz
vcpkg-bad51b04626f25d323433ec159af1d60f93cadb1.zip
[vcpkg] Improve handling of external toolchain files
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/vcpkg/base/cofffilereader.cpp3
-rw-r--r--toolsrc/src/vcpkg/build.cpp9
-rw-r--r--toolsrc/src/vcpkg/commands.env.cpp6
-rw-r--r--toolsrc/src/vcpkg/postbuildlint.cpp33
-rw-r--r--toolsrc/src/vcpkg/vcpkgpaths.cpp7
5 files changed, 32 insertions, 26 deletions
diff --git a/toolsrc/src/vcpkg/base/cofffilereader.cpp b/toolsrc/src/vcpkg/base/cofffilereader.cpp
index 1927e0b5e..96d280108 100644
--- a/toolsrc/src/vcpkg/base/cofffilereader.cpp
+++ b/toolsrc/src/vcpkg/base/cofffilereader.cpp
@@ -306,8 +306,5 @@ namespace vcpkg::CoffFileReader
return {std::vector<MachineType>(machine_types.cbegin(), machine_types.cend())};
}
-#else
- DllInfo read_dll(const fs::path& path) { exit(-1); }
- LibInfo read_lib(const fs::path& path) { exit(-1); }
#endif
}
diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp
index 0486039b7..5870bd187 100644
--- a/toolsrc/src/vcpkg/build.cpp
+++ b/toolsrc/src/vcpkg/build.cpp
@@ -208,9 +208,7 @@ namespace vcpkg::Build
std::string make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset)
{
- if (pre_build_info.external_toolchain_file)
- return Strings::format(
- R"("%s" %s 2>&1)", toolset.vcvarsall.u8string(), Strings::join(" ", toolset.vcvarsall_options));
+ if (pre_build_info.external_toolchain_file.has_value()) return "";
const char* tonull = " >nul";
if (GlobalState::debugging)
@@ -479,8 +477,9 @@ namespace vcpkg::Build
{"ALL_FEATURES", all_features},
});
- const auto cmd_set_environment = make_build_env_cmd(pre_build_info, toolset);
- const std::string command = Strings::format(R"(%s && %s)", cmd_set_environment, cmd_launch_cmake);
+ auto command = make_build_env_cmd(pre_build_info, toolset);
+ if (!command.empty()) command.append(" && ");
+ command.append(cmd_launch_cmake);
const auto timer = Chrono::ElapsedTimer::create_started();
diff --git a/toolsrc/src/vcpkg/commands.env.cpp b/toolsrc/src/vcpkg/commands.env.cpp
index 6e52383d8..f3beef6cd 100644
--- a/toolsrc/src/vcpkg/commands.env.cpp
+++ b/toolsrc/src/vcpkg/commands.env.cpp
@@ -21,7 +21,11 @@ namespace vcpkg::Commands::Env
const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, default_triplet);
const Toolset& toolset = paths.get_toolset(pre_build_info);
- System::cmd_execute_clean(Build::make_build_env_cmd(pre_build_info, toolset) + " && cmd");
+ auto env_cmd = Build::make_build_env_cmd(pre_build_info, toolset);
+ if (env_cmd.empty())
+ System::cmd_execute_clean("cmd");
+ else
+ System::cmd_execute_clean(env_cmd + " && cmd");
Checks::exit_success(VCPKG_LINE_INFO);
}
diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp
index 2b427737a..a31518ad7 100644
--- a/toolsrc/src/vcpkg/postbuildlint.cpp
+++ b/toolsrc/src/vcpkg/postbuildlint.cpp
@@ -391,6 +391,7 @@ namespace vcpkg::PostBuildLint
static LintStatus check_dll_architecture(const std::string& expected_architecture,
const std::vector<fs::path>& files)
{
+#if defined(_WIN32)
std::vector<FileAndArch> binaries_with_invalid_architecture;
for (const fs::path& file : files)
@@ -413,6 +414,7 @@ namespace vcpkg::PostBuildLint
print_invalid_architecture_files(expected_architecture, binaries_with_invalid_architecture);
return LintStatus::ERROR_DETECTED;
}
+#endif
return LintStatus::SUCCESS;
}
@@ -420,6 +422,7 @@ namespace vcpkg::PostBuildLint
static LintStatus check_lib_architecture(const std::string& expected_architecture,
const std::vector<fs::path>& files)
{
+#if defined(_WIN32)
std::vector<FileAndArch> binaries_with_invalid_architecture;
for (const fs::path& file : files)
@@ -451,6 +454,7 @@ namespace vcpkg::PostBuildLint
print_invalid_architecture_files(expected_architecture, binaries_with_invalid_architecture);
return LintStatus::ERROR_DETECTED;
}
+#endif
return LintStatus::SUCCESS;
}
@@ -790,11 +794,15 @@ namespace vcpkg::PostBuildLint
dlls.insert(dlls.cend(), debug_dlls.cbegin(), debug_dlls.cend());
dlls.insert(dlls.cend(), release_dlls.cbegin(), release_dlls.cend());
- error_count += check_exports_of_dlls(dlls, toolset.dumpbin);
- error_count += check_uwp_bit_of_dlls(pre_build_info.cmake_system_name, dlls, toolset.dumpbin);
- error_count += check_dll_architecture(pre_build_info.target_architecture, dlls);
+ if (!toolset.dumpbin.empty())
+ {
+ error_count += check_exports_of_dlls(dlls, toolset.dumpbin);
+ error_count += check_uwp_bit_of_dlls(pre_build_info.cmake_system_name, dlls, toolset.dumpbin);
+ error_count +=
+ check_outdated_crt_linkage_of_dlls(dlls, toolset.dumpbin, build_info, pre_build_info);
+ }
- error_count += check_outdated_crt_linkage_of_dlls(dlls, toolset.dumpbin, build_info, pre_build_info);
+ error_count += check_dll_architecture(pre_build_info.target_architecture, dlls);
break;
}
case Build::LinkageType::STATIC:
@@ -805,17 +813,20 @@ namespace vcpkg::PostBuildLint
error_count += check_bin_folders_are_not_present_in_static_build(fs, package_dir);
- if (!build_info.policies.is_enabled(BuildPolicy::ONLY_RELEASE_CRT))
+ if (!toolset.dumpbin.empty())
{
+ if (!build_info.policies.is_enabled(BuildPolicy::ONLY_RELEASE_CRT))
+ {
+ error_count += check_crt_linkage_of_libs(
+ BuildType::value_of(Build::ConfigurationType::DEBUG, build_info.crt_linkage),
+ debug_libs,
+ toolset.dumpbin);
+ }
error_count += check_crt_linkage_of_libs(
- BuildType::value_of(Build::ConfigurationType::DEBUG, build_info.crt_linkage),
- debug_libs,
+ BuildType::value_of(Build::ConfigurationType::RELEASE, build_info.crt_linkage),
+ release_libs,
toolset.dumpbin);
}
- error_count += check_crt_linkage_of_libs(
- BuildType::value_of(Build::ConfigurationType::RELEASE, build_info.crt_linkage),
- release_libs,
- toolset.dumpbin);
break;
}
default: Checks::unreachable(VCPKG_LINE_INFO);
diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp
index f2b39c110..e62ef8662 100644
--- a/toolsrc/src/vcpkg/vcpkgpaths.cpp
+++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp
@@ -628,13 +628,8 @@ namespace vcpkg
ret.dumpbin = "";
ret.supported_architectures = {
ToolsetArchOption{"", System::get_host_processor(), System::get_host_processor()}};
-#if defined(_WIN32)
- ret.vcvarsall = "cmd";
- ret.vcvarsall_options = {"/c", "echo done"};
-#else
- ret.vcvarsall = "true";
+ ret.vcvarsall = "";
ret.vcvarsall_options = {};
-#endif
ret.version = "external";
ret.visual_studio_root_path = "";
return ret;