Add support for overlays (still needs a custom pmm to work)

vcpkg-wip
Duncan Ogilvie 3 years ago
parent 7cf16eaf70
commit b3b2688a28

@ -34,7 +34,11 @@ struct Package {
struct Vcpkg { struct Vcpkg {
std::string version; std::string version;
std::string triplet;
std::vector<std::string> packages; std::vector<std::string> packages;
std::vector<std::string> ports;
std::vector<std::string> overlay_ports;
std::vector<std::string> overlay_triplets;
}; };
enum TargetType { enum TargetType {

@ -33,6 +33,7 @@ static EnumType to_enum(const std::string &str, const std::string &help_name) {
return value; return value;
} }
// If the key is found, get strongly-typed value (throws on user-error)
template <typename T> template <typename T>
static void get_optional(const TomlBasicValue &v, const toml::key &ky, T &destination); static void get_optional(const TomlBasicValue &v, const toml::key &ky, T &destination);
@ -249,6 +250,8 @@ CMake::CMake(const std::string &path, bool build) {
const auto &v = toml::find(toml, "vcpkg"); const auto &v = toml::find(toml, "vcpkg");
vcpkg.version = toml::find(v, "version").as_string(); vcpkg.version = toml::find(v, "version").as_string();
vcpkg.packages = toml::find<decltype(vcpkg.packages)>(v, "packages"); vcpkg.packages = toml::find<decltype(vcpkg.packages)>(v, "packages");
get_optional(v, "overlay-ports", vcpkg.overlay_ports);
get_optional(v, "overlay-triplets", vcpkg.overlay_triplets);
// This allows the user to use a custom pmm version if desired // This allows the user to use a custom pmm version if desired
if (contents.count("pmm") == 0) { if (contents.count("pmm") == 0) {

@ -526,7 +526,11 @@ int generate_cmake(const char *path, bool root) {
cmd("include")("${pmm_SOURCE_DIR}/pmm.cmake"); cmd("include")("${pmm_SOURCE_DIR}/pmm.cmake");
tsl::ordered_map<std::string, std::vector<std::string>> vcpkg_args; tsl::ordered_map<std::string, std::vector<std::string>> vcpkg_args;
vcpkg_args["REVISION"] = {cmake.vcpkg.version}; vcpkg_args["REVISION"] = {cmake.vcpkg.version};
vcpkg_args["TRIPLET"] = {cmake.vcpkg.triplet};
vcpkg_args["REQUIRES"] = cmake.vcpkg.packages; vcpkg_args["REQUIRES"] = cmake.vcpkg.packages;
vcpkg_args["PORTS"] = cmake.vcpkg.ports;
vcpkg_args["OVERLAY_PORTS"] = cmake.vcpkg.overlay_ports;
vcpkg_args["OVERLAY_TRIPLETS"] = cmake.vcpkg.overlay_triplets;
auto vcpkg = std::make_pair("VCPKG", vcpkg_args); auto vcpkg = std::make_pair("VCPKG", vcpkg_args);
cmd("pmm")(vcpkg).endl(); cmd("pmm")(vcpkg).endl();
} }

Loading…
Cancel
Save