mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-24 03:27:12 +01:00
[vcpkg_Build.cpp] USe const. Misc fixes
This commit is contained in:
parent
265fb7e0b5
commit
f3156ae3e4
@ -64,8 +64,8 @@ namespace vcpkg::Build
|
|||||||
tonull = L"";
|
tonull = L"";
|
||||||
}
|
}
|
||||||
|
|
||||||
auto arch = to_vcvarsall_toolchain(pre_build_info.target_architecture, toolset);
|
const auto arch = to_vcvarsall_toolchain(pre_build_info.target_architecture, toolset);
|
||||||
auto target = to_vcvarsall_target(pre_build_info.cmake_system_name);
|
const auto target = to_vcvarsall_target(pre_build_info.cmake_system_name);
|
||||||
|
|
||||||
return Strings::wformat(LR"("%s" %s %s %s 2>&1)", toolset.vcvarsall.native(), arch, target, tonull);
|
return Strings::wformat(LR"("%s" %s %s %s 2>&1)", toolset.vcvarsall.native(), arch, target, tonull);
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ namespace vcpkg::Build
|
|||||||
BinaryControlFile& bcf)
|
BinaryControlFile& bcf)
|
||||||
{
|
{
|
||||||
BinaryParagraph bpgh(source_paragraph, triplet);
|
BinaryParagraph bpgh(source_paragraph, triplet);
|
||||||
if (auto p_ver = build_info.version.get())
|
if (const auto p_ver = build_info.version.get())
|
||||||
{
|
{
|
||||||
bpgh.version = *p_ver;
|
bpgh.version = *p_ver;
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ namespace vcpkg::Build
|
|||||||
const fs::path& git_exe_path = paths.get_git_exe();
|
const fs::path& git_exe_path = paths.get_git_exe();
|
||||||
|
|
||||||
const fs::path ports_cmake_script_path = paths.ports_cmake;
|
const fs::path ports_cmake_script_path = paths.ports_cmake;
|
||||||
auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet);
|
const auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet);
|
||||||
const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset);
|
const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset);
|
||||||
const auto cmd_set_environment = make_build_env_cmd(pre_build_info, toolset);
|
const auto cmd_set_environment = make_build_env_cmd(pre_build_info, toolset);
|
||||||
|
|
||||||
@ -171,8 +171,8 @@ namespace vcpkg::Build
|
|||||||
|
|
||||||
const ElapsedTime timer = ElapsedTime::create_started();
|
const ElapsedTime timer = ElapsedTime::create_started();
|
||||||
|
|
||||||
int return_code = System::cmd_execute_clean(command);
|
const int return_code = System::cmd_execute_clean(command);
|
||||||
auto buildtimeus = timer.microseconds();
|
const auto buildtimeus = timer.microseconds();
|
||||||
const auto spec_string = spec.to_string();
|
const auto spec_string = spec.to_string();
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -186,7 +186,7 @@ namespace vcpkg::Build
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto build_info = read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec));
|
const BuildInfo build_info = read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec));
|
||||||
const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info);
|
const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info);
|
||||||
|
|
||||||
BinaryControlFile bcf;
|
BinaryControlFile bcf;
|
||||||
@ -269,7 +269,7 @@ namespace vcpkg::Build
|
|||||||
parser.required_field(BuildInfoRequiredField::CRT_LINKAGE, crt_linkage_as_string);
|
parser.required_field(BuildInfoRequiredField::CRT_LINKAGE, crt_linkage_as_string);
|
||||||
|
|
||||||
auto crtlinkage = to_linkage_type(crt_linkage_as_string);
|
auto crtlinkage = to_linkage_type(crt_linkage_as_string);
|
||||||
if (auto p = crtlinkage.get())
|
if (const auto p = crtlinkage.get())
|
||||||
build_info.crt_linkage = *p;
|
build_info.crt_linkage = *p;
|
||||||
else
|
else
|
||||||
Checks::exit_with_message(VCPKG_LINE_INFO, "Invalid crt linkage type: [%s]", crt_linkage_as_string);
|
Checks::exit_with_message(VCPKG_LINE_INFO, "Invalid crt linkage type: [%s]", crt_linkage_as_string);
|
||||||
@ -279,7 +279,7 @@ namespace vcpkg::Build
|
|||||||
std::string library_linkage_as_string;
|
std::string library_linkage_as_string;
|
||||||
parser.required_field(BuildInfoRequiredField::LIBRARY_LINKAGE, library_linkage_as_string);
|
parser.required_field(BuildInfoRequiredField::LIBRARY_LINKAGE, library_linkage_as_string);
|
||||||
auto liblinkage = to_linkage_type(library_linkage_as_string);
|
auto liblinkage = to_linkage_type(library_linkage_as_string);
|
||||||
if (auto p = liblinkage.get())
|
if (const auto p = liblinkage.get())
|
||||||
build_info.library_linkage = *p;
|
build_info.library_linkage = *p;
|
||||||
else
|
else
|
||||||
Checks::exit_with_message(
|
Checks::exit_with_message(
|
||||||
@ -292,9 +292,8 @@ namespace vcpkg::Build
|
|||||||
for (auto policy : g_all_policies)
|
for (auto policy : g_all_policies)
|
||||||
{
|
{
|
||||||
const auto setting = parser.optional_field(to_string(policy));
|
const auto setting = parser.optional_field(to_string(policy));
|
||||||
if (setting.empty())
|
if (setting.empty()) continue;
|
||||||
continue;
|
if (setting == "enabled")
|
||||||
else if (setting == "enabled")
|
|
||||||
policies.emplace(policy, true);
|
policies.emplace(policy, true);
|
||||||
else if (setting == "disabled")
|
else if (setting == "disabled")
|
||||||
policies.emplace(policy, false);
|
policies.emplace(policy, false);
|
||||||
@ -303,7 +302,7 @@ namespace vcpkg::Build
|
|||||||
VCPKG_LINE_INFO, "Unknown setting for policy '%s': %s", to_string(policy), setting);
|
VCPKG_LINE_INFO, "Unknown setting for policy '%s': %s", to_string(policy), setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto err = parser.error_info("PostBuildInformation"))
|
if (const auto err = parser.error_info("PostBuildInformation"))
|
||||||
{
|
{
|
||||||
print_error_message(err);
|
print_error_message(err);
|
||||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||||
@ -337,14 +336,14 @@ namespace vcpkg::Build
|
|||||||
});
|
});
|
||||||
|
|
||||||
const std::wstring command = Strings::wformat(LR"(%s)", cmd_launch_cmake);
|
const std::wstring command = Strings::wformat(LR"(%s)", cmd_launch_cmake);
|
||||||
auto ec_data = System::cmd_execute_and_capture_output(command);
|
const auto ec_data = System::cmd_execute_and_capture_output(command);
|
||||||
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0);
|
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0);
|
||||||
|
|
||||||
const std::vector<std::string> lines = Strings::split(ec_data.output, "\n");
|
const std::vector<std::string> lines = Strings::split(ec_data.output, "\n");
|
||||||
|
|
||||||
PreBuildInfo pre_build_info;
|
PreBuildInfo pre_build_info;
|
||||||
|
|
||||||
auto e = lines.cend();
|
const auto e = lines.cend();
|
||||||
auto cur = std::find(lines.cbegin(), e, FLAG_GUID);
|
auto cur = std::find(lines.cbegin(), e, FLAG_GUID);
|
||||||
if (cur != e) ++cur;
|
if (cur != e) ++cur;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user