diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-01-24 14:55:38 -0800 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-01-24 14:55:38 -0800 |
| commit | d98d7b386dc894ff1aaf620900c8b5a96aa1836b (patch) | |
| tree | b41834e3d524c96db977124f4832858f93d51324 /toolsrc/src | |
| parent | c09e6ff69ac353cee7538d073e9c35dfef392836 (diff) | |
| parent | e3c3497dbc03607492f38e54122106bc8f00ca20 (diff) | |
| download | vcpkg-d98d7b386dc894ff1aaf620900c8b5a96aa1836b.tar.gz vcpkg-d98d7b386dc894ff1aaf620900c8b5a96aa1836b.zip | |
Merge branch 'master' of https://github.com/microsoft/vcpkg
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/commands_build.cpp | 7 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_Environment.cpp | 38 |
2 files changed, 24 insertions, 21 deletions
diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index af1b3dc24..e7e005100 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -30,12 +30,13 @@ namespace vcpkg::Commands::Build const triplet& target_triplet = spec.target_triplet(); const fs::path ports_cmake_script_path = paths.ports_cmake; - const fs::path vcvarsall_bat = Environment::get_vcvarsall_bat(paths); - const std::wstring command = Strings::wformat(LR"("%s" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", - vcvarsall_bat.native(), + 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()); diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index aaa6bb106..66d33edeb 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -46,6 +46,13 @@ namespace vcpkg::Environment } } + static std::wstring create_default_install_cmd(const vcpkg_paths& paths, const std::wstring& tool_name) + { + const fs::path script = paths.scripts / "fetchDependency.ps1"; + // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned + return Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency %s", script.native(), tool_name); + } + void ensure_git_on_path(const vcpkg_paths& paths) { const fs::path downloaded_git = paths.downloads / "PortableGit" / "cmd"; @@ -58,9 +65,7 @@ namespace vcpkg::Environment static constexpr std::array<int, 3> git_version = {2,0,0}; static const std::wstring version_check_cmd = L"git --version 2>&1"; - const fs::path script = paths.scripts / "fetchDependency.ps1"; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency git", script.native()); + const std::wstring install_cmd = create_default_install_cmd(paths, L"git"); ensure_on_path(git_version, version_check_cmd, install_cmd); } @@ -76,22 +81,19 @@ namespace vcpkg::Environment static constexpr std::array<int, 3> cmake_version = {3,7,2}; static const std::wstring version_check_cmd = L"cmake --version 2>&1"; - const fs::path script = paths.scripts / "fetchDependency.ps1"; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency cmake", script.native()); + const std::wstring install_cmd = create_default_install_cmd(paths, L"cmake"); ensure_on_path(cmake_version, version_check_cmd, install_cmd); } void ensure_nuget_on_path(const vcpkg_paths& paths) { - const std::wstring path_buf = Strings::wformat(L"%s;%s", paths.downloads.native(), System::wdupenv_str(L"PATH")); + const fs::path downloaded_nuget = paths.downloads / "nuget-3.5.0"; + const std::wstring path_buf = Strings::wformat(L"%s;%s", downloaded_nuget.native(), System::wdupenv_str(L"PATH")); _wputenv_s(L"PATH", path_buf.c_str()); - static constexpr std::array<int, 3> nuget_version = {1,0,0}; + static constexpr std::array<int, 3> nuget_version = {3,3,0}; static const std::wstring version_check_cmd = L"nuget 2>&1"; - const fs::path script = paths.scripts / "fetchDependency.ps1"; - // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency nuget", script.native()); + const std::wstring install_cmd = create_default_install_cmd(paths, L"nuget"); ensure_on_path(nuget_version, version_check_cmd, install_cmd); } @@ -155,7 +157,7 @@ namespace vcpkg::Environment System::println("The following paths were examined:"); for (const fs::path& path : paths_examined) { - System::println(path.generic_string()); + System::println(" %s", path.generic_string()); } exit(EXIT_FAILURE); } @@ -166,7 +168,7 @@ namespace vcpkg::Environment return dumpbin_exe; } - static fs::path find_vcvarsall_bat(const vcpkg_paths& paths) + static vcvarsall_and_platform_toolset find_vcvarsall_bat(const vcpkg_paths& paths) { const std::vector<std::string> vs2017_installation_instances = get_VS2017_installation_instances(paths); std::vector<fs::path> paths_examined; @@ -178,7 +180,7 @@ namespace vcpkg::Environment paths_examined.push_back(vcvarsall_bat); if (fs::exists(vcvarsall_bat)) { - return vcvarsall_bat; + return { vcvarsall_bat , L"v141"}; } } @@ -187,21 +189,21 @@ namespace vcpkg::Environment paths_examined.push_back(vs2015_vcvarsall_bat); if (fs::exists(vs2015_vcvarsall_bat)) { - return vs2015_vcvarsall_bat; + return { vs2015_vcvarsall_bat, L"v140" }; } System::println(System::color::error, "Could not detect vccarsall.bat."); System::println("The following paths were examined:"); for (const fs::path& path : paths_examined) { - System::println(path.generic_string()); + System::println(" %s",path.generic_string()); } exit(EXIT_FAILURE); } - const fs::path& get_vcvarsall_bat(const vcpkg_paths& paths) + const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths) { - static const fs::path vcvarsall_bat = find_vcvarsall_bat(paths); + static const vcvarsall_and_platform_toolset vcvarsall_bat = find_vcvarsall_bat(paths); return vcvarsall_bat; } } |
