aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_build.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-03-10 16:40:43 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2017-03-10 17:04:29 -0800
commitf7f471c04afd1063b9150ee24789138f104ff5ba (patch)
treea63607ff534d88ab63014c57fa0fbb36ea68f640 /toolsrc/src/commands_build.cpp
parentf93b3ccc4fb85bb9ef3f3f15d240647b44769fc4 (diff)
downloadvcpkg-f7f471c04afd1063b9150ee24789138f104ff5ba.tar.gz
vcpkg-f7f471c04afd1063b9150ee24789138f104ff5ba.zip
`build`: Use make_cmake_cmd() and paths.get_cmake/git_exe()
Diffstat (limited to 'toolsrc/src/commands_build.cpp')
-rw-r--r--toolsrc/src/commands_build.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp
index 02b98e28d..f2dabe25e 100644
--- a/toolsrc/src/commands_build.cpp
+++ b/toolsrc/src/commands_build.cpp
@@ -39,22 +39,26 @@ namespace vcpkg::Commands::Build
}
}
- // If these environment variables are set while running the VS2017 developer prompt, it will not correctly initialize the build environment.
- System::set_environmental_variable(L"VSINSTALLDIR", L"");
- System::set_environmental_variable(L"DevEnvDir", L"");
+ const fs::path& cmake_exe_path = paths.get_cmake_exe();
+ const fs::path& git_exe_path = paths.get_git_exe();
const fs::path ports_cmake_script_path = paths.ports_cmake;
const Environment::vcvarsall_and_platform_toolset vcvarsall_bat = Environment::get_vcvarsall_bat(paths);
- const std::wstring command = Strings::wformat(LR"("%s" %s >nul 2>&1 && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s -DVCPKG_PLATFORM_TOOLSET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")",
- vcvarsall_bat.path.native(),
- Strings::utf8_to_utf16(target_triplet.architecture()),
- Strings::utf8_to_utf16(source_paragraph.name),
- Strings::utf8_to_utf16(target_triplet.canonical_name()),
- vcvarsall_bat.platform_toolset,
- port_dir.generic_wstring(),
- ports_cmake_script_path.generic_wstring());
+ const std::wstring cmd_set_environment = Strings::wformat(LR"("%s" %s >nul 2>&1)", vcvarsall_bat.path.native(), Strings::utf8_to_utf16(target_triplet.architecture()));
- ElapsedTime timer = ElapsedTime::createStarted();
+ const std::wstring cmd_launch_cmake = make_cmake_cmd(cmake_exe_path, ports_cmake_script_path,
+ {
+ { L"CMD", L"BUILD" },
+ { L"PORT", source_paragraph.name },
+ { L"CURRENT_PORT_DIR", port_dir / "/." },
+ { L"TARGET_TRIPLET", target_triplet.canonical_name() },
+ { L"VCPKG_PLATFORM_TOOLSET", vcvarsall_bat.platform_toolset },
+ { L"GIT", git_exe_path }
+ });
+
+ const std::wstring command = Strings::wformat(LR"(%s && %s)", cmd_set_environment, cmd_launch_cmake);
+
+ const ElapsedTime timer = ElapsedTime::createStarted();
int return_code = System::cmd_execute(command);
auto buildtimeus = timer.microseconds();
@@ -133,7 +137,6 @@ namespace vcpkg::Commands::Build
Checks::check_exit(!maybe_spgh.error_code(), "Could not find package named %s: %s", spec, maybe_spgh.error_code().message());
const SourceParagraph& spgh = *maybe_spgh.get();
- Environment::ensure_utilities_on_path(paths);
StatusParagraphs status_db = database_load_check(paths);
const BuildResult result = build_package(spgh, spec, paths, paths.port_dir(spec), status_db);
if (result == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES)