diff options
-rw-r--r-- | libbutl/target-triplet.cxx | 20 | ||||
-rw-r--r-- | libbutl/target-triplet.mxx | 4 | ||||
-rw-r--r-- | tests/target-triplet/driver.cxx | 19 |
3 files changed, 41 insertions, 2 deletions
diff --git a/libbutl/target-triplet.cxx b/libbutl/target-triplet.cxx index db71e3c..611b758 100644 --- a/libbutl/target-triplet.cxx +++ b/libbutl/target-triplet.cxx @@ -129,6 +129,14 @@ namespace butl version.assign (system, v, string::npos); system.resize (system.size () - version.size ()); } + else if (vendor == "apple" && system.compare (0, 3, "ios") == 0) + { + // Handle iosNN[-...]. + // + string::size_type p (system.find ('-')); + version.assign (system, 3, p == string::npos ? p : p - 3); + system.erase (3, version.size ()); + } // Determine class for some recognized systems. // @@ -136,6 +144,8 @@ namespace butl class_ = "linux"; else if (vendor == "apple" && system == "darwin") class_ = "macos"; + else if (vendor == "apple" && system.compare (0, 3, "ios") == 0) + class_ = "ios"; else if (system == "freebsd" || system == "openbsd" || system == "netbsd") @@ -167,7 +177,10 @@ namespace butl if (!version.empty ()) { - r += version; + if (vendor == "apple" && system.compare (0, 3, "ios") == 0) + r.insert (r.size () - system.size () + 3, version); + else + r += version; } return r; @@ -191,7 +204,10 @@ namespace butl if (!version.empty ()) { - r += version; + if (vendor == "apple" && system.compare (0, 3, "ios") == 0) + r.insert (r.size () - system.size () + 3, version); + else + r += version; } return r; diff --git a/libbutl/target-triplet.mxx b/libbutl/target-triplet.mxx index 1ecc7e5..3861809 100644 --- a/libbutl/target-triplet.mxx +++ b/libbutl/target-triplet.mxx @@ -99,6 +99,9 @@ LIBBUTL_MODEXPORT namespace butl // x86_64-pc-windows-msvc19.11.25547 x86_64 windows-msvc 19.11.25547 // wasm32-unknown-emscripten wasm32 emscripten // arm64-apple-darwin20.1.0 aarch64 apple darwin 20.1.0 + // arm64-apple-ios14.4 aarch64 apple ios 14.4 + // arm64-apple-ios14.4-simulator aarch64 apple ios-simulator 14.4 + // x86_64-apple-ios14.4-macabi x86_64 apple ios-macabi 14.4 // // Similar to version splitting, for certain commonly-used targets we also // derive the "target class" which can be used as a shorthand, more @@ -110,6 +113,7 @@ LIBBUTL_MODEXPORT namespace butl // macos *-apple-darwin* // bsd *-*-(freebsd|openbsd|netbsd)* // windows *-*-win32-* | *-*-windows-* | *-*-mingw32 + // ios *-apple-ios* // // References: // diff --git a/tests/target-triplet/driver.cxx b/tests/target-triplet/driver.cxx index a6eff05..bfa01fa 100644 --- a/tests/target-triplet/driver.cxx +++ b/tests/target-triplet/driver.cxx @@ -117,6 +117,25 @@ main () "aarch64-apple-darwin20.1.0", "aarch64", "apple", "darwin", "20.1.0", "macos")); + assert (test ("arm64-apple-ios14.4", + "aarch64-apple-ios14.4", + "aarch64", "apple", "ios", "14.4", "ios")); + + assert (test ("arm64-apple-ios", + "aarch64-apple-ios", + "aarch64", "apple", "ios", "", "ios")); + + assert (test ("arm64-apple-ios14.4-simulator", + "aarch64-apple-ios14.4-simulator", + "aarch64", "apple", "ios-simulator", "14.4", "ios")); + + assert (test ("arm64-apple-ios-simulator", + "aarch64-apple-ios-simulator", + "aarch64", "apple", "ios-simulator", "", "ios")); + + assert (test ("x86_64-apple-ios14.4-macabi", + "x86_64-apple-ios14.4-macabi", + "x86_64", "apple", "ios-macabi", "14.4", "ios")); // Version extraction. // |