Skip to content

Commit

Permalink
apply patch for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
MoAlyousef committed Jan 5, 2024
1 parent 9149d39 commit 257e73e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-10.15, ubuntu-18.04]
os: [windows-latest, macos-latest, ubuntu-latest]

steps:
- name: Download deps
Expand Down
11 changes: 5 additions & 6 deletions fltk-webview-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ fn compile_webview() {
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
let exe_pth = out_dir.clone();

Command::new("git")
.args(&["submodule", "update", "--init", "--recursive"])
.current_dir(&manifest_dir)
.status()
.expect("Git is needed to retrieve the fltk & webview source files!");

println!("cargo:rerun-if-changed=webview/webview.h");
println!("cargo:rerun-if-changed=webview/webview.cc");
println!("cargo:rerun-if-changed=src/gtk_helper.c");
Expand Down Expand Up @@ -132,6 +126,11 @@ fn compile_webview() {
}
}
} else if target.contains("apple") {
Command::new("git")
.args(&["apply", "webview.patch"])
.current_dir(&manifest_dir)
.status()
.expect("Git is needed to retrieve the fltk & webview source files!");
build.flag("-DWEBVIEW_COCOA");
build.flag("-std=c++11");
println!("cargo:rustc-link-lib=framework=Cocoa");
Expand Down
6 changes: 3 additions & 3 deletions webview.patch → fltk-webview-sys/webview.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ index 01f81e6..622bfdf 100644
+
#ifndef WEBVIEW_H
#define WEBVIEW_H

@@ -715,6 +718,12 @@ inline id operator"" _str(const char *s, std::size_t) {
return objc::msg_send<id>("NSString"_cls, "stringWithUTF8String:"_sel, s);
}

+inline std::string unique_name(std::string base) {
+ static int name_counter = 0;
+ base += std::to_string(name_counter++);
Expand Down Expand Up @@ -53,7 +53,7 @@ index 01f81e6..622bfdf 100644
class_addMethod(
cls,
@@ -2292,4 +2301,4 @@ WEBVIEW_API const webview_version_info_t *webview_version() {

#endif /* WEBVIEW_HEADER */
#endif /* __cplusplus */
-#endif /* WEBVIEW_H */
Expand Down

0 comments on commit 257e73e

Please sign in to comment.