Skip to content

Commit

Permalink
Link against libc++ on Apple targets
Browse files Browse the repository at this point in the history
  • Loading branch information
gferon committed Oct 23, 2023
1 parent 1180cda commit 17a571a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions rust_icu_sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#![doc(test(ignore))]
// Notes:
// * deref_nullptr: since rustc 1.53, bindgen causes UB warnings -- see
// https://github.com/rust-lang/rust-bindgen/issues/1651 remove this once bindgen has fixed the
Expand All @@ -23,7 +23,7 @@
non_upper_case_globals,
unused_imports,
rustdoc::bare_urls,
deref_nullptr,
deref_nullptr
)]

#[cfg(all(feature = "icu_version_in_env", feature = "icu_config"))]
Expand Down Expand Up @@ -87,7 +87,15 @@ extern crate libc;
#[cfg_attr(feature = "static", link(name = "icui18n", kind = "static"))]
#[cfg_attr(feature = "static", link(name = "icuuc", kind = "static"))]
#[cfg_attr(feature = "static", link(name = "icudata", kind = "static"))]
#[cfg_attr(feature = "static", link(name = "stdc++", kind = "dylib"))]
// On systems such as macOS, libc++ is the default library
#[cfg_attr(
all(target_vendor = "apple", feature = "static"),
link(name = "c++", kind = "dylib")
)]
#[cfg_attr(
not(all(target_vendor = "apple", feature = "static")),
link(name = "stdc++", kind = "dylib")
)]
extern "C" {}

impl From<i8> for UCharCategory {
Expand Down Expand Up @@ -124,7 +132,7 @@ impl From<i8> for UCharCategory {
28 => UCharCategory::U_INITIAL_PUNCTUATION,
29 => UCharCategory::U_FINAL_PUNCTUATION,
30 => UCharCategory::U_CHAR_CATEGORY_COUNT,
_ => {
_ => {
panic!("could not convert: {}", value);
}
}
Expand Down

0 comments on commit 17a571a

Please sign in to comment.