summaryrefslogtreecommitdiffstats
path: root/Source/cmXcFramework.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-08-14 17:24:31 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2023-08-15 13:45:17 (GMT)
commitb4565c8c91bd43d9b8ef315d47bb17c6dd929af0 (patch)
tree712cfb41b2b94bde698726547bab7d31eff3ee57 /Source/cmXcFramework.cxx
parentd688a213d5583098f04bedc4f5c9eafe62c854bd (diff)
downloadCMake-b4565c8c91bd43d9b8ef315d47bb17c6dd929af0.zip
CMake-b4565c8c91bd43d9b8ef315d47bb17c6dd929af0.tar.gz
CMake-b4565c8c91bd43d9b8ef315d47bb17c6dd929af0.tar.bz2
.xcframework: Check SupportedPlatformVariant
Diffstat (limited to 'Source/cmXcFramework.cxx')
-rw-r--r--Source/cmXcFramework.cxx39
1 files changed, 37 insertions, 2 deletions
diff --git a/Source/cmXcFramework.cxx b/Source/cmXcFramework.cxx
index 3c447e3..29d939d 100644
--- a/Source/cmXcFramework.cxx
+++ b/Source/cmXcFramework.cxx
@@ -68,6 +68,30 @@ bool PlistSupportedPlatformHelper(
return false;
}
+bool PlistSupportedPlatformVariantHelper(
+ cmXcFrameworkPlistSupportedPlatformVariant& variant,
+ const Json::Value* value, cmJSONState* /*state*/)
+{
+ if (!value) {
+ return false;
+ }
+
+ if (!value->isString()) {
+ return false;
+ }
+
+ if (value->asString() == "catalyst"_s) {
+ variant = cmXcFrameworkPlistSupportedPlatformVariant::catalyst;
+ return true;
+ }
+ if (value->asString() == "simulator"_s) {
+ variant = cmXcFrameworkPlistSupportedPlatformVariant::simulator;
+ return true;
+ }
+
+ return false;
+}
+
auto const PlistLibraryHelper =
cmJSONHelperBuilder::Object<cmXcFrameworkPlistLibrary>{}
.Bind("LibraryIdentifier"_s, &cmXcFrameworkPlistLibrary::LibraryIdentifier,
@@ -81,7 +105,13 @@ auto const PlistLibraryHelper =
cmJSONHelperBuilder::Vector<std::string>(
JsonErrors::EXPECTED_TYPE("array"), cmJSONHelperBuilder::String()))
.Bind("SupportedPlatform"_s, &cmXcFrameworkPlistLibrary::SupportedPlatform,
- PlistSupportedPlatformHelper);
+ PlistSupportedPlatformHelper)
+ .Bind("SupportedPlatformVariant"_s,
+ &cmXcFrameworkPlistLibrary::SupportedPlatformVariant,
+ cmJSONHelperBuilder::Optional<
+ cmXcFrameworkPlistSupportedPlatformVariant>(
+ PlistSupportedPlatformVariantHelper),
+ false);
auto const PlistHelper =
cmJSONHelperBuilder::Object<cmXcFrameworkPlist>{}.Bind(
@@ -139,6 +169,10 @@ const cmXcFrameworkPlistLibrary* cmXcFrameworkPlist::SelectSuitableLibrary(
const cmMakefile& mf, const cmListFileBacktrace& bt) const
{
auto systemName = mf.GetSafeDefinition("CMAKE_SYSTEM_NAME");
+ cm::optional<cmXcFrameworkPlistSupportedPlatformVariant> systemVariant;
+ if (mf.PlatformIsAppleSimulator()) {
+ systemVariant = cmXcFrameworkPlistSupportedPlatformVariant::simulator;
+ }
for (auto const& lib : this->AvailableLibraries) {
std::string supportedSystemName;
@@ -160,7 +194,8 @@ const cmXcFrameworkPlistLibrary* cmXcFrameworkPlist::SelectSuitableLibrary(
break;
}
- if (systemName == supportedSystemName) {
+ if (systemName == supportedSystemName &&
+ systemVariant == lib.SupportedPlatformVariant) {
return &lib;
}
}