Skip to content

Commit

Permalink
Add triplet variables to control abi entries for binarycache
Browse files Browse the repository at this point in the history
  • Loading branch information
Osyotr committed Nov 19, 2022
1 parent 16d6d44 commit 4dbb954
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/vcpkg/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <vcpkg/vcpkgpaths.h>

#include <array>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

namespace vcpkg
Expand Down Expand Up @@ -259,6 +259,8 @@ namespace vcpkg
Optional<std::string> public_abi_override;
std::vector<std::string> passthrough_env_vars;
std::vector<std::string> passthrough_env_vars_tracked;
std::unordered_set<std::string> ignored_abi_keys;
std::unordered_map<std::string, std::string> additional_abi_entries;

Path toolchain_file() const;
bool using_vcvars() const;
Expand Down
27 changes: 27 additions & 0 deletions src/vcpkg/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,14 @@ namespace vcpkg

abi_tag_entries.emplace_back("features", Strings::join(";", sorted_feature_list));

abi_tag_entries = Util::filter(abi_tag_entries, [&](const AbiEntry& p) {
return !Util::Sets::contains(abi_info.pre_build_info->ignored_abi_keys, p.key);
});
for (auto&& entry : abi_info.pre_build_info->additional_abi_entries)
{
abi_tag_entries.emplace_back(entry.first, entry.second);
}

Util::sort(abi_tag_entries);

const std::string full_abi_info =
Expand Down Expand Up @@ -1639,6 +1647,8 @@ namespace vcpkg
PUBLIC_ABI_OVERRIDE,
LOAD_VCVARS_ENV,
DISABLE_COMPILER_TRACKING,
IGNORED_ABI_KEYS,
ADDITIONAL_ABI_ENTRIES,
};

static const std::vector<std::pair<std::string, VcpkgTripletVar>> VCPKG_OPTIONS = {
Expand All @@ -1656,6 +1666,8 @@ namespace vcpkg
// Note: this value must come after VCPKG_CHAINLOAD_TOOLCHAIN_FILE because its default depends upon it.
{"VCPKG_LOAD_VCVARS_ENV", VcpkgTripletVar::LOAD_VCVARS_ENV},
{"VCPKG_DISABLE_COMPILER_TRACKING", VcpkgTripletVar::DISABLE_COMPILER_TRACKING},
{"VCPKG_IGNORED_ABI_KEYS", VcpkgTripletVar::IGNORED_ABI_KEYS},
{"VCPKG_ADDITIONAL_ABI_ENTRIES", VcpkgTripletVar::ADDITIONAL_ABI_ENTRIES},
};

std::string empty;
Expand Down Expand Up @@ -1732,6 +1744,21 @@ namespace vcpkg
from_cmake_bool(variable_value, kv.first).value_or_exit(VCPKG_LINE_INFO);
}
break;
case VcpkgTripletVar::IGNORED_ABI_KEYS:
for (auto&& abi_key : Strings::split(variable_value, ';'))
ignored_abi_keys.emplace(std::move(abi_key));
break;
case VcpkgTripletVar::ADDITIONAL_ABI_ENTRIES:
for (auto&& abi_entry_str : Strings::split(variable_value, ';'))
{
auto const sep_pos = abi_entry_str.find_first_of(' ');
if (sep_pos != std::string::npos)
{
additional_abi_entries.emplace(abi_entry_str.substr(0, sep_pos),
abi_entry_str.substr(sep_pos + 1));
}
}
break;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/vcpkg/cmakevars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ VCPKG_ENV_PASSTHROUGH=${VCPKG_ENV_PASSTHROUGH}
VCPKG_ENV_PASSTHROUGH_UNTRACKED=${VCPKG_ENV_PASSTHROUGH_UNTRACKED}
VCPKG_LOAD_VCVARS_ENV=${VCPKG_LOAD_VCVARS_ENV}
VCPKG_DISABLE_COMPILER_TRACKING=${VCPKG_DISABLE_COMPILER_TRACKING}
VCPKG_IGNORED_ABI_KEYS=${VCPKG_IGNORED_ABI_KEYS}
VCPKG_ADDITIONAL_ABI_ENTRIES=${VCPKG_ADDITIONAL_ABI_ENTRIES}
e1e74b5c-18cb-4474-a6bd-5c1c8bc81f3f
8c504940-be29-4cba-9f8f-6cd83e9d87b7")
endfunction()
Expand Down

0 comments on commit 4dbb954

Please sign in to comment.