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 authored and xdev committed Oct 23, 2023
1 parent 1180cda commit 9661070
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 0 additions & 1 deletion rust_icu_sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ icu_version_68_plus = []
icu_version_69_max = []
static = []


[badges]
maintenance = { status = "actively-developed" }
is-it-maintained-issue-resolution = { repository = "google/rust_icu" }
Expand Down
18 changes: 15 additions & 3 deletions rust_icu_sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
// 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.
<<<<<<< Updated upstream

=======
#![doc(test(ignore))]
>>>>>>> Stashed changes
// 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 +27,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 +91,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 +136,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 9661070

Please sign in to comment.