-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vcpkg] Fix create by extracting common paths settings (#11842)
Resolves #11784
- Loading branch information
1 parent
7192d3a
commit 04e214e
Showing
11 changed files
with
94 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <vcpkg/base/system.process.h> | ||
#include <vcpkg/vcpkgpaths.h> | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
namespace vcpkg | ||
{ | ||
std::string make_cmake_cmd(const VcpkgPaths& paths, | ||
const fs::path& cmake_script, | ||
std::vector<System::CMakeVariable>&& pass_variables); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <catch2/catch.hpp> | ||
|
||
#include <string> | ||
#include <iterator> | ||
#include <vcpkg/base/files.h> | ||
#include <vcpkg/commands.h> | ||
#include <vcpkg/vcpkgcmdarguments.h> | ||
#include <vcpkg/vcpkgpaths.h> | ||
|
||
TEST_CASE ("smoke test", "[create]") | ||
{ | ||
using namespace vcpkg; | ||
static const std::string argsRaw[] = {"create", "zlib2", "http://zlib.net/zlib-1.2.11.tar.gz", "zlib-1.2.11.zip"}; | ||
|
||
auto& fsWrapper = Files::get_real_filesystem(); | ||
VcpkgCmdArguments args = VcpkgCmdArguments::create_from_arg_sequence(std::begin(argsRaw), std::end(argsRaw)); | ||
VcpkgPaths paths(fsWrapper, args); | ||
const auto exit_code = Commands::Create::perform(args, paths); | ||
REQUIRE(exit_code == 0); | ||
const auto expected_port = paths.ports / fs::u8path("zlib2"); | ||
const auto expected_portfile_cmake = expected_port / fs::u8path("portfile.cmake"); | ||
const auto lines = fsWrapper.read_lines(expected_portfile_cmake); | ||
REQUIRE(lines.has_value()); | ||
fsWrapper.remove_all(expected_port, ignore_errors); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "pch.h" | ||
|
||
#include <vcpkg/buildenvironment.h> | ||
|
||
namespace vcpkg | ||
{ | ||
std::string make_cmake_cmd(const VcpkgPaths& paths, | ||
const fs::path& cmake_script, | ||
std::vector<System::CMakeVariable>&& pass_variables) | ||
{ | ||
auto local_variables = std::move(pass_variables); | ||
local_variables.emplace_back("VCPKG_ROOT_DIR", paths.root); | ||
local_variables.emplace_back("PACKAGES_DIR", paths.packages); | ||
local_variables.emplace_back("BUILDTREES_DIR", paths.buildtrees); | ||
local_variables.emplace_back("_VCPKG_INSTALLED_DIR", paths.installed); | ||
local_variables.emplace_back("DOWNLOADS", paths.downloads); | ||
return System::make_basic_cmake_cmd(paths.get_tool_exe(Tools::CMAKE), cmake_script, local_variables); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters