Skip to content

Commit 8b4fd39

Browse files
authored
Merge pull request #21 from konovod/patch-1
On Windows OS , use `webview.dll` and do a dynamic link. Thanks @konovod for this PR
2 parents b72768d + c30ff13 commit 8b4fd39

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ BSD-based systems:
2727

2828
* FreeBSD packages: `pkg install webkit2-gtk3`
2929
* Execution on BSD-based systems may require adding the `wxallowed` option (see [mount(8)](https://man.openbsd.org/mount.8)) to your fstab to bypass [W^X](https://en.wikipedia.org/wiki/W%5EX "write xor execute") memory protection for your executable. Please see if it works without disabling this security feature first.
30+
31+
Microsoft Windows:
32+
33+
* You should have Visual C++ Build tools already as it's a pre-requisite for crystal compiler
34+
* `git clone https://github.com/webview/webview` to get WebView sources
35+
* `webview\script\build.bat` to compile them (it will download required nuget package)
36+
* copy `webview\dll\x64\webview.lib` to `<your crystal installation>\lib`
37+
* copy `webview\dll\x64\webview.dll` to directory with your program
3038

3139
## Installation
3240

shard.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: webview
2-
version: 0.2.1
2+
version: 0.2.2
33

44
authors:
55
- Ali Naqvi <syed.alinaqvi@gmail.com>

src/lib.cr

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ module Webview
66
@[Link(ldflags: "`command -v pkg-config > /dev/null && pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0`")]
77
@[Link(ldflags: "#{__DIR__}/../ext/libwebview.a -lstdc++")]
88
{% elsif flag?(:windows) %}
9-
# Windows requires special linker flags for GUI apps.
10-
@[Link(ldflags: "-L#{__DIR__}/../ext -lwebview.o -lc++")]
11-
@[Link(ldflags: "-lole32 -lcomctl32 -loleaut32 -luuid -lgdi32 -H windowsgui")]
12-
{% else %}
9+
@[Link("webview")]
10+
# TODO - Windows requires special linker flags for GUI apps, but this doesn't work with crystal stdlib (tried with Crystal 1.6.2).
11+
# @[Link(ldflags: "/subsystem:windows")]
12+
{% else %}
1313
raise "Platform not supported"
1414
{% end %}
1515
lib LibWebView

src/webview.cr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require "json"
22

33
# Crystal bindings for [zserge's Webview](https://github.com/zserge/webview) which is an excellent cross-platform single header webview library for C/C++ using Gtk, Cocoa or MSHTML repectively.
44
module Webview
5-
VERSION = "0.2.1"
5+
VERSION = "0.2.2"
66

77
# Window size hints
88
enum SizeHints

0 commit comments

Comments
 (0)